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

community: Expose Anthropic Retry Logic #17069

Merged
merged 14 commits into from
Feb 14, 2024

Conversation

notAlex2
Copy link
Contributor

@notAlex2 notAlex2 commented Feb 5, 2024

Description:

Expose Anthropic's retry logic, so that max_retries can be configured via langchain. Anthropic's retry logic is implemented in their Python SDK here: https://github.com/anthropics/anthropic-sdk-python?tab=readme-ov-file#retries

Copy link

vercel bot commented Feb 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Feb 13, 2024 3:45pm

@notAlex2 notAlex2 marked this pull request as ready for review February 5, 2024 22:38
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. Ɑ: models Related to LLMs or chat model modules 🤖:improvement Medium size change to existing code to handle new use-cases labels Feb 5, 2024
@notAlex2 notAlex2 changed the title community: Expose Anthropic Retry Logic Control community: Expose Anthropic Retry Logic Feb 5, 2024
@@ -92,11 +95,13 @@ def validate_environment(cls, values: Dict) -> Dict:
base_url=values["anthropic_api_url"],
api_key=values["anthropic_api_key"].get_secret_value(),
timeout=values["default_request_timeout"],
max_retries=values["max_retries"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

believe anthropic.Anthropic() doesn't accept None for max_retries, should we give it same default as they do (2)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, looks None isn't valid here. Updated to match their implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think @baskaryan ?

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Feb 6, 2024
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 6, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Feb 12, 2024
@notAlex2
Copy link
Contributor Author

@baskaryan could you run those workflows one more time? 🙏

@notAlex2
Copy link
Contributor Author

Merged from origin/main to resolve unrelated linting issue.

@baskaryan baskaryan merged commit 70c296a into langchain-ai:master Feb 14, 2024
58 checks passed
snsten pushed a commit to snsten/langchain that referenced this pull request Feb 15, 2024
**Description:**

Expose Anthropic's retry logic, so that `max_retries` can be configured
via langchain. Anthropic's retry logic is implemented in their Python
SDK here:
https://github.com/anthropics/anthropic-sdk-python?tab=readme-ov-file#retries

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
haydeniw pushed a commit to haydeniw/langchain that referenced this pull request Feb 27, 2024
**Description:**

Expose Anthropic's retry logic, so that `max_retries` can be configured
via langchain. Anthropic's retry logic is implemented in their Python
SDK here:
https://github.com/anthropics/anthropic-sdk-python?tab=readme-ov-file#retries

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. Ɑ: models Related to LLMs or chat model modules size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants