Skip to content

Document strategies to handle invalid tool input #50391

@verdie-g

Description

@verdie-g

Type of issue

Missing information

Description

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

Page URL

https://learn.microsoft.com/en-us/dotnet/ai/quickstarts/use-function-calling

Content source URL

https://github.com/dotnet/docs/blob/main/docs/ai/quickstarts/use-function-calling.md

Document Version Independent Id

7228f348-6649-a87d-bae5-4a70817c03bb

Platform Id

5a517f05-b64b-c471-b99d-72253c213be1

Article author

@gewarren

Metadata

  • ID: 27e2bbca-36b0-3883-11f7-321c044ee29a
  • PlatformId: 5a517f05-b64b-c471-b99d-72253c213be1
  • Service: dotnet
  • Sub-service: intelligent-apps

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions