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

added ChatAnthropicVertex #119

Merged
merged 2 commits into from
Apr 6, 2024
Merged

added ChatAnthropicVertex #119

merged 2 commits into from
Apr 6, 2024

Conversation

lkuligin
Copy link
Collaborator

@lkuligin lkuligin commented Apr 5, 2024

@lkuligin lkuligin force-pushed the antr branch 2 times, most recently from 64b4b0d to 2df4405 Compare April 5, 2024 16:27
@@ -18,6 +18,12 @@ google-cloud-storage = "^2.14.0"
types-requests = "^2.31.0"
types-protobuf = "^4.24.0.4"

[tool.poetry.group.anthropic]
Copy link
Member

Choose a reason for hiding this comment

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

should we make this an extra instead, so people can pip install "langchain-google-vertexai[anthropic]" and get everything they need?

Copy link
Member

Choose a reason for hiding this comment

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

The other option, if this mostly relies on the anthropic sdk, is that it might make more sense in the langchain-anthropic package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


class ChatAnthropicVertex(_VertexAICommon, BaseChatModel):
async_client: Any = None #: :meta private:
model_name: str = "claude-3-sonnet@20240229"
Copy link
Member

Choose a reason for hiding this comment

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

lets not set a default here. Can add a validator raising an error with this string to make it easy for people to init it properly.

Otherwise will fall out of date and require a breaking change when they ship a new model

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done.

Comment on lines +101 to +115
from anthropic import ( # type: ignore[import-not-found]
AnthropicVertex,
AsyncAnthropicVertex,
)

values["client"] = AnthropicVertex(
project_id=values["project"],
region=values["location"],
max_retries=values["max_retries"],
)
values["async_client"] = AsyncAnthropicVertex(
project_id=values["project"],
region=values["location"],
max_retries=values["max_retries"],
)
Copy link
Member

Choose a reason for hiding this comment

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

This makes me think this makes more sense in langchain-anthropic - happy to discuss though! If it's co-dependent on both google-cloud-aiplatform and anthropic then it matters less.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd rather keep it here, since we might have other partner integrations on Vertex Model Garden eventually, so langchain-google-vertexai sounds like a more general place to me when people are looking for this integration. wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Works for me. From what I can tell here: https://docs.anthropic.com/claude/reference/claude-on-vertex-ai

It looks like it requires both sdks

@lkuligin lkuligin requested a review from efriis April 5, 2024 17:19
@lkuligin lkuligin merged commit d7131df into main Apr 6, 2024
13 checks passed
@lkuligin lkuligin deleted the antr branch April 6, 2024 07:31
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.

2 participants