Skip to content

Document strategies to handle invalid tool input #50391

@verdie-g

Description

@verdie-g

Describe the issue or suggestion

A LLM can provide invalid input when request tool calls. In this discussion with Stephen, several strategies were mentioned to deal with that.

The documentation could be improved with:

  • FunctionInvokingChatClient.IncludeDetailedErrors to send serialization (and other) exceptions back to the LLM
  • FunctionInvokingChatClient.FunctionInvoker to, for example, catch serialization exceptions. It could also be interesting to document that it can be used to implement a retry mechanism, like throwing a MyRetryException from a tool (because of incoherent input or something), catching it in the FunctionInvoker and returning a message to make the LLM retry "invalid something, please retry". Sharing good prompts that make some models retry a tool call would be a plus.
  • strictJsonSchema special property for OpenAI

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions