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

feat: Improve retry mechanism for _get_ai_reply and refactor method #2113

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mattzh72
Copy link
Collaborator

Description

Improve retry mechanism for _get_ai_reply and refactor method to improve code quality. We add an exponential backoff, and differentiate between retryable errors v.s. generic errors.

Testing

Rely on existing unit testing.

if response.choices[0].finish_reason not in ["stop", "function_call", "tool_calls"]:
if response.choices[0].finish_reason == "length":
# This is not retryable, hence RuntimeError v.s. ValueError
raise RuntimeError("Finish reason was length (maximum context length)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this get caught by the summarizer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpacker

Seems to pass summarizer tests though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants