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

Retries via LiteLLM RetryPolicy #1866

Merged
merged 17 commits into from
Dec 17, 2024
Merged

Retries via LiteLLM RetryPolicy #1866

merged 17 commits into from
Dec 17, 2024

Conversation

dbczumar
Copy link
Collaborator

@dbczumar dbczumar commented Nov 27, 2024

Retries via LiteLLM RetryPolicy

This depends on BerriAI/litellm#6916 being merged and released (may take some coordination)

Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
@dbczumar dbczumar changed the title DRAFT: Retries via LiteLLM RetryPolicy [DO NOT MERGE] Retries via LiteLLM RetryPolicy Nov 27, 2024
@dbczumar
Copy link
Collaborator Author

cc @okhat - feel free to test this out in the meantime while I work with @krrishdholakia on BerriAI/litellm#6916

Signed-off-by: dbczumar <[email protected]>
@dbczumar dbczumar changed the title [DO NOT MERGE] Retries via LiteLLM RetryPolicy Retries via LiteLLM RetryPolicy Dec 10, 2024
dbczumar and others added 7 commits December 9, 2024 23:44
@@ -36,7 +37,7 @@ def __init__(
max_tokens: int = 1000,
cache: bool = True,
callbacks: Optional[List[BaseCallback]] = None,
num_retries: int = 3,
num_retries: int = 8,
Copy link
Collaborator Author

@dbczumar dbczumar Dec 17, 2024

Choose a reason for hiding this comment

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

Empirically, this provides roughly 1 minute of retries, which is typically necessary to overcome rate limit errors (providers like Azure OpenAI & Databricks support RPM rate limits)

@@ -102,14 +103,13 @@ def __call__(self, prompt=None, messages=None, **kwargs):
outputs = [
{
"text": c.message.content if hasattr(c, "message") else c["text"],
"logprobs": c.logprobs if hasattr(c, "logprobs") else c["logprobs"]
"logprobs": c.logprobs if hasattr(c, "logprobs") else c["logprobs"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just the linter being itself...

@@ -7,6 +7,7 @@ model_list:
model: "dspy-test-provider/dspy-test-model"

litellm_settings:
num_retries: 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Disable retries on the server side to ensure that server retries don't stack atop client retries, which can result in test failures due to a mismatch between expected and actual # of retries

Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
@@ -38,7 +38,7 @@ dependencies = [
"pydantic~=2.0",
"jinja2",
"magicattr~=0.1.6",
"litellm",
"litellm==1.55.3",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

LiteLLM version 1.55.3 is the only version that correctly supports passing retry_policy to completion() while respecting the number of retries specified by the policy

Comment on lines -21 to -22
cloudpickle
jinja2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Linter reordering

@okhat okhat merged commit 1bae71c into stanfordnlp:main Dec 17, 2024
4 checks passed
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