You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I think it would be nice to have native-implemented ability to share objects between Agent Tools.
Or perhaps the description of the StructuredOutput properties could be adjusted to match the format expected by the Symfony Serializer.
Use case:
Imagine that you have "Main Agent" with defined tools
read_invoice_from_file - tool where "InvoiceAgent" is invoked to read a file, parse it to StructuredOutput, validates readed data with database for example with companies table. This "InvoiceAgent" has tools needed to process invoice files, validate them, checking database, etc.
save_invoice - simple tool, where Main Agent can pass Invoice readed from "read_invoice_from_file" tool
<?php$tool_1 =Tool::make('read_invoice_from_file', 'Analyze invoice from passed file.After invoice is analysed, propose user to save this invoice',
)->addProperty(
newToolProperty(name: 'file_id', type: 'string', description: 'ID', required: true)
)->addProperty(
newToolProperty(name: 'file_name', type: 'string', description: 'File name', required: true)
)->addProperty(
newToolProperty(name: 'mimeType', type: 'string', description: 'mimeType', required: true)
)->addProperty(
newToolProperty(name: 'file_url', type: 'string', description: 'URL', required: true)
)->setCallable(newReadInvoiceTool($this->inspector));
$tool_2 = Tool::make('save_invoice', 'Save invoice to database',
)->addProperty(
newToolProperty(
name: 'invoice_json',
type: 'string',
description: 'Invoice object in JSON format returned from read_invoice_from_file tool',
required: true
)
)->setCallable(newSaveInvoiceTool($this->getUserId()));
?>
At the moment, I’m manually transforming the StructuredOutput produced by the read_invoice_from_file tool into JSON. And when I ask "MainAgent" to save the invoice, it passes this json to "save_invoice" tool, where I must deserialize this object.
As you can see, there’s a ton of code written just to pass objects between tools (agents).
I have tried implementing Symfony Serializer, but with no luck, because of incompatible PHPDoc in StructuredOutput Classes.
I found that the Symfony Serializer requires the following structure:
/** * @var InvoicePosition[] */
#[SchemaProperty(description: 'List of positions.', required: true)]
#[Valid]
#[NotBlank]
public array $positions;
While Neuron library is using different phpdoc:
/** * @var array<\App\Neuron\Structures\InvoicePosition> */
#[SchemaProperty(description: 'List of positions.', required: true)]
#[Valid]
#[NotBlank]
public array $positions;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I think it would be nice to have native-implemented ability to share objects between Agent Tools.
Or perhaps the description of the StructuredOutput properties could be adjusted to match the format expected by the Symfony Serializer.
Use case:
Imagine that you have "Main Agent" with defined tools
At the moment, I’m manually transforming the StructuredOutput produced by the read_invoice_from_file tool into JSON. And when I ask "MainAgent" to save the invoice, it passes this json to "save_invoice" tool, where I must deserialize this object.
My example Mapper code:
As you can see, there’s a ton of code written just to pass objects between tools (agents).
I have tried implementing Symfony Serializer, but with no luck, because of incompatible PHPDoc in StructuredOutput Classes.
I found that the Symfony Serializer requires the following structure:
While Neuron library is using different phpdoc:
Beta Was this translation helpful? Give feedback.
All reactions