-
Notifications
You must be signed in to change notification settings - Fork 150
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
Conversation
64b4b0d
to
2df4405
Compare
libs/vertexai/pyproject.toml
Outdated
@@ -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] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
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"], | ||
) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
#109