-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Raise IncompleteToolCall when token limit is reached during generation of tool call
#3137
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
Raise IncompleteToolCall when token limit is reached during generation of tool call
#3137
Conversation
…ments, check if args actually are incomplete or not
4ec19d6 to
537d6ce
Compare
| try: | ||
| tool_call.args_as_dict() | ||
| except Exception: | ||
| raise exceptions.ToolExceedsTokenLimitError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a subclass of UnexpectedModelBehavior for backward compatibility, and I suggest renaming it IncompleteToolCall
| # as the empty response and request will not create any items in the API payload, | ||
| # in the hope the model will return a non-empty response this time. | ||
| ctx.state.increment_retries(ctx.deps.max_result_retries) | ||
| max_tokens = (ctx.deps.model_settings or {}).get('max_tokens') if ctx.deps.model_settings else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass in the entire model_settings object to clean these repeated sections up a bit?
…ol-exceeds-token-limit-error
…ckwards compat, simplify by passing in model settings instead of determining tokens on each call of increment_retries
IncompleteToolCall when token limit is reached during generation of tool call
|
@erhuve Thank you! |
Closes #3118