Not planned
Description
Description:
I’d like to suggest a feature that enables structured output for tools when interacting with the model. Currently, the model decides how to format and display the results, which may not always fit specific needs. This feature would allow users to specify the desired output format for their tools.
Example:
In my case, I have a tool that fetches products from my API and presents them to the user. However, I don’t want the model to decide the structure of the output. Instead, I’ve specified a JSON schema that dictates the format of the response.
For instance, the result would look something like this:
{
"type": "products",
"products": [
{
"name": "Product 1",
"url": "https://example.com/product1",
"price": 29.99
},
{
"name": "Product 2",
"url": "https://example.com/product2",
"price": 49.99
}
]
}
With this response, my frontend knows which renderer to use.
Expected Behavior:
- The model should follow the given JSON schema when returning the result.
- The user should have the ability to predefine how the output is structured, without the model altering it.
This would improve consistency and allow for more flexible tool integrations.
Activity
chr-hertel commentedon Sep 26, 2024
could potentially be an easy pick after #47 with an extension like
#[AsTool('product_search', ... , outputStructure: Product::class)]
🤔chr-hertel commentedon Sep 29, 2024
Nailing it down to:
minLength
or regexpattern
ChainProcessor
of ToolBoxOskarStark commentedon Oct 2, 2024
Done in #75
Work in progress in #74
chr-hertel commentedon Jan 5, 2025
Still valid or obsolete @OskarStark?
OskarStark commentedon Jan 6, 2025
Could be a nice addition, but not needed for now