-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature anthropic action #22
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add Role, ContentType, SourceType enums for Anthropic chat messages - Define ContentBlock, MessageParam, Metadata, ToolInputSchema, Tool models - Implement AnthropicChatCompletionRequest model - Add method to convert from OpenAI ChatCompletionRequest to AnthropicChatCompletionRequest [/COMMIT_MSG]
Add from_kwargs classmethod to ChatCompletionRequest for validation - Raises ValueError if messages or model not provided - Calls model_validate on the kwargs
- Update AnthropicAction to support AnthropicChatCompletionRequest - Convert ChatCompletionRequest to AnthropicChatCompletionRequest - Call Anthropic's messages.create API with the converted request - Map the API response back to ChatCompletion model - Set default value of stream to False in AnthropicChatCompletionRequest - Remove unused text_completion and text_completion_stream methods
- Update AnthropicAction to use the latest Anthropic API - Add new types for Anthropic's API, including Role, ContentType, SourceType, Source, ContentBlock, and MessageParam - Update tests for AnthropicAction - Handle different stop reasons from Anthropic API and map them to OpenAI's finish_reason - Include model name in the ChatCompletion response
- Implement chat_stream method in AnthropicAction class - Validate model name, stream, and prepare request - Send streaming request and yield ChatCompletionChunk - Handle different message event types (message_start, message_delta, content_block_delta) - Process stop reasons and update finish_reason accordingly - Yield final ChatCompletionChunk with finish_reason and empty content - Enable test for anthropic_action_chat_stream
- Add languru-llm-anthropic service to docker-compose.yml - Define environment variables and configurations for the service - Create dockerfile.anthropic.dev to build the languru-llm-anthropic image - Install required dependencies and set up the working directory - Expose port 80 and define entrypoint and default command
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22 +/- ##
==========================================
+ Coverage 80.97% 81.34% +0.37%
==========================================
Files 41 43 +2
Lines 1798 1941 +143
==========================================
+ Hits 1456 1579 +123
- Misses 342 362 +20 ☔ View full report in Codecov by Sentry. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.