feat: add Anthropic Claude provider support with flexible authentication#285
feat: add Anthropic Claude provider support with flexible authentication#285nicdaCosta wants to merge 5 commits intovitali87:mainfrom
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Summary of ChangesHello @nicdaCosta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the system's LLM capabilities by integrating Anthropic Claude models. The primary goal was to provide robust and flexible support for Anthropic, ensuring compatibility with different user setups, from individual developers using direct API keys to enterprise environments leveraging proxy services or existing Claude Code CLI configurations. This broadens the range of powerful models available for both orchestrator and cypher generation tasks, making the system more versatile and accessible to a wider user base. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for Anthropic Claude models, including flexible authentication methods like direct API keys, proxy services via custom headers, and automatic configuration from Claude Code settings. The implementation is well-structured, with a new AnthropicProvider class, corresponding configuration options, and thorough tests. The documentation in README.md and .env.example is also updated clearly.
My review focuses on a small area of code duplication for parsing custom headers, which can be refactored into a shared utility function for better maintainability. I've also suggested adding a comment to clarify the use of a broad exception catch, in line with the project's coding practices. Additionally, I've ensured that the suggested utility function adheres to the project's rule against docstrings. Overall, this is a great addition that significantly expands the tool's capabilities.
…ethod Updated to extract common method parse headers which can be re-used elsewhere Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
using newly created method as per pr code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@greptile |
Greptile OverviewGreptile SummaryThis PR adds Anthropic Claude provider support with flexible authentication (API key, Claude Code settings, or proxy headers like Portkey). Major Changes
Critical Issues Found
Style Violations
TestingTests are comprehensive and well-structured, covering all three authentication modes with proper mocking. Confidence Score: 0/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Config
participant AnthropicProvider
participant ClaudeSettings
participant PydanticAI
User->>Config: Configure anthropic provider
alt Direct API Key
Config->>AnthropicProvider: init with api_key
AnthropicProvider->>AnthropicProvider: validate_config()
AnthropicProvider->>PydanticAI: create provider with key
end
alt Claude Code Settings
Config->>AnthropicProvider: init without api_key
AnthropicProvider->>ClaudeSettings: get_anthropic_config_from_claude_settings()
ClaudeSettings->>ClaudeSettings: read settings file
ClaudeSettings->>ClaudeSettings: ❌ parse_custom_headers() UNDEFINED
ClaudeSettings-->>AnthropicProvider: return base_url and headers
AnthropicProvider->>PydanticAI: create provider with headers
end
alt Portkey Proxy
Config->>Config: ❌ parse_custom_headers() UNDEFINED
Config->>AnthropicProvider: init with custom_headers
AnthropicProvider->>AnthropicProvider: validate_config()
AnthropicProvider->>PydanticAI: create provider with http_client
end
|
vitali87
left a comment
There was a problem hiding this comment.
Please have a look at the greptile comments
Added support for Anthropic models, thus making the current availability OpenAI, Gemini, OLlama, and Anthropic.
I have added support for a new model provider, as well as multiple authentication methods for Anthropic to work for various setups, including the usage of 3rd party key providers like Portkey.ai. The reason for the multiple auth options is to allow for various setups to work, from personal to enterprise solutions.