Remove previously implemented ContextAwarePluginInterface from FunctionCall(Interface/Base)

Created on 12 March 2025, about 1 month ago

Problem/Motivation

We currently have ContextAwarePluginInterface implemented in both FunctionCallBase and FunctionCallInterface, it should be removed from one of these. Technically, you could probably create your own function call implementing FunctionCallInterface that does not extend FunctionCallBase, and that does not have any Contexts, but then we may need to have checks elsewhere prior to any method calls expecting contexts.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States michaellander

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @michaellander
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia anjaliprasannan

    If someone implements FunctionCallInterface directly (without extending FunctionCallBase), theyโ€™ll need to provide their own implementations of normalize() and populateValues(). For example:

    <?php
    
    class CustomFunctionCall extends PluginBase implements FunctionCallInterface {
    
      public function populateValues(ToolsFunctionOutput $output) {
        // Custom logic without contexts.
        $this->configuration['values'] = $output->getArguments();
      }
    
      public function normalize(): ToolsFunctionInput {
        $function = new ToolsFunctionInput($this->getFunctionName(), []);
        $function->setDescription($this->pluginDefinition['description']);
        return $function;
      }
    }

    Code that interacts with FunctionCallInterface instances and expects context-related methods (e.g., getContextDefinitions()) should check if the plugin implements ContextAwarePluginInterface. For example:

    if ($function_call instanceof ContextAwarePluginInterface) {
      $context_definitions = $function_call->getContextDefinitions();
      // Work with contexts...
    } else {
      // Handle context-free plugin...
    }
  • Pipeline finished with Success
    4 days ago
    Total: 321s
    #467958
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom MrDaleSmith

    Looks good to me.

Production build 0.71.5 2024