Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ClientModel.ClientResultException: 'HTTP 400 (invalid_request_error: array_above_max_length) #317

Open
Raivr-dev opened this issue Dec 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Raivr-dev
Copy link

Service

OpenAI

Describe the bug

When AllowParallelToolCalls is true and more than 128 ToolChatMessages are sent back to the AI, this exception is thrown:

System.ClientModel.ClientResultException: 'HTTP 400 (invalid_request_error: array_above_max_length)
Parameter: messages[2].tool_calls

Invalid 'messages[2].tool_calls': array too long. Expected an array with maximum length 128, but got an array with length 200 instead.'

Steps to reproduce

Set AllowParallelToolCalls to true in the ChatCompletionOptions object.
Prompt the AI such that it's going to call your ChatTool more than 128 times.
This call will then generate the exception: chatClient.CompleteChat(messages, options);

Code snippets

No response

OS

Windows 11

.NET version

9.0

Library version

2.1.0

@Raivr-dev Raivr-dev added the bug Something isn't working label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant