Skip to content

Feat/anthropic#10

Merged
Pascal-Delange merged 4 commits into
mainfrom
feat/anthropic
Mar 19, 2026
Merged

Feat/anthropic#10
Pascal-Delange merged 4 commits into
mainfrom
feat/anthropic

Conversation

@Pascal-Delange

@Pascal-Delange Pascal-Delange commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Add the option for Anthropic model provider, either with aistudio or anthropic backend.

@coderabbitai

coderabbitai Bot commented Mar 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ed7dd43-0e7c-483e-81fc-37c014c487a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/anthropic
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

… support

Create the Anthropic adapter structure with support for both Anthropic API and
Vertex AI backends. Includes request/response adaptation logic, message history
management, and extended thinking configuration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

fix(anthropic): add nil check for tool responses and fix variable scope in adaptRequest

test(anthropic): add adapter tests for request adaptation and backend configuration

feat(anthropic): complete anthropic sdk adapter implementation

Implement full Anthropic SDK adapter with:
- Fixed API compatibility issues with anthropic-sdk-go v1.27.0
- Proper request/response adaptation using SDK types
- Support for system prompts via message roles
- Tool support with proper input schema handling
- Thinking budget token configuration for extended thinking
- Both Anthropic and Vertex AI backend support
- Comprehensive test coverage

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

fix(anthropic): only set MaxTokens if explicitly provided to support Vertex AI

fix

fix lint

rm test file that's not useful and breaks in CI
opts := []option.RequestOption{
vertex.WithGoogleAuth(p.vertexCtx, p.region, p.project),
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it necessary to inject the Http client from the adapter?

	if adapter.HttpClient() != nil {
		opts = append(opts, option.WithHTTPClient(adapter.HttpClient()))
	}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a valid question and I must confess here I'm unsure about the implication in the SDK.
It looks like yes, it would make sense ?
But I'm not sure what happens if we dont.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, I checked this and if we pass a http client, it overrides the http client with google credentials that the anthropic SDK generates using "WithGoogleAuth"

Comment thread llms/anthropic/anthropic.go Outdated
@Pascal-Delange Pascal-Delange merged commit c268269 into main Mar 19, 2026
2 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.

3 participants