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

Add context manager streaming support for Anthropic #595

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

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 19, 2024

🔍 Review Summary

Purpose

This update enhances the Anthropic provider by implementing context handler streaming, thus enabling synchronous and asynchronous message streaming, featuring a new model version claude-3-sonnet-20240229.

Key Changes

  • New Feature

    • Added create_stream and __call__ methods for context handler streaming.
    • Integrated model claude-3-sonnet-20240229 to the AnthropicProvider class.
  • Enhancement

    • Enhanced example scripts to demonstrate evolving context handler pattern for both synchronous and asynchronous streaming.
  • Test

    • Updated and expanded test cases for the new model version.
    • Provided comprehensive coverage of the streaming patterns.

Impact

  • Accelerates and optimizes the streaming process by introducing new methods.
  • Ensures robustness by providing comprehensive test case coverage.
  • Improves understanding of the new features through updated example scripts.
Original Description

No existing description found

devin-ai-integration bot and others added 17 commits December 19, 2024 06:20
- Add create_stream and __call__ methods to AnthropicProvider
- Update sync and async examples to use context handler pattern
- Update model version to claude-3-sonnet-20240229
- Maintain backward compatibility with existing streaming

Co-Authored-By: Alex Reibman <[email protected]>
- Update all test cases to use claude-3-sonnet-20240229
- Maintain comprehensive test coverage for streaming patterns
- Keep backward compatibility with legacy streaming

Co-Authored-By: Alex Reibman <[email protected]>
- Simplify function call arguments in anthropic.py
- Remove trailing newlines in example files

Co-Authored-By: Alex Reibman <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add "(aside)" to your comment to have me ignore it.

Copy link

Walkthrough

This update enhances the Anthropic provider by implementing context handler streaming, enabling both synchronous and asynchronous message streaming. Key changes include the addition of create_stream and __call__ methods in the AnthropicProvider class, and the update of the model version to claude-3-sonnet-20240229. New example scripts and updates to existing ones demonstrate the context handler pattern for streaming. Test cases have been revised to ensure compatibility and coverage with the new model version.

Changes

File(s) Summary
agentops/llms/providers/anthropic.py Added create_stream and __call__ methods for context handler streaming; updated to model claude-3-sonnet-20240229.
examples/anthropic_examples/anthropic-example-async.ipynb Updated async example to demonstrate context handler streaming with the new model version.
examples/anthropic_examples/anthropic-example-sync.ipynb Updated sync example to demonstrate context handler streaming with the new model version.
examples/anthropic_examples/anthropic-example-async.py Introduced new async example script showcasing context handler pattern for streaming.
tests/core_manual_tests/providers/anthropic_canary.py Updated test cases for new model version and comprehensive streaming pattern coverage.

🔗 Related PRs

Instructions

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @bot + *your message*
Example: @bot Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @bot + *feedback*
Example: @bot Do not comment on `save_auth` function !

Execute a command using the format:

@bot + */command*

Example: @bot /updateCommit

Available Commands:

  • /updateCommit ✨: Apply the suggested changes and commit them (or Click on the Github Action button to apply the changes !)
  • /updateGuideline 🛠️: Modify an existing guideline.
  • /addGuideline ➕: Introduce a new guideline.

Tips for Using @bot Effectively:

  • Specific Queries: For the best results, be specific with your requests.
    🔍 Example: @bot summarize the changes in this PR.
  • Focused Discussions: Tag @bot directly on specific code lines or files for detailed feedback.
    📑 Example: @bot review this line of code.
  • Managing Reviews: Use review comments for targeted discussions on code snippets, and PR comments for broader queries about the entire PR.
    💬 Example: @bot comment on the entire PR.

Need More Help?

📚 Visit our documentation for detailed guides on using Entelligence.AI.
🌐 Join our community to connect with others, request features, and share feedback.
🔔 Follow us for updates on new features and improvements.

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.

0 participants