- Issue created by @michaellander
- First commit to issue fork.
- Merge request !545Issue #3512540: Remove previously implemented ContextAwarePluginInterface from... โ (Open) created by Unnamed author
- ๐ฎ๐ณ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... }