Class VertexAiAnthropicChatModel
java.lang.Object
dev.langchain4j.model.vertexai.anthropic.VertexAiAnthropicChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.ChatModel, Closeable, AutoCloseable
public class VertexAiAnthropicChatModel
extends Object
implements dev.langchain4j.model.chat.ChatModel, Closeable
Represents a Google Vertex AI Anthropic language model with a chat completion interface.
Supports Claude models through Vertex AI's Model Garden.
Please follow these steps before using this model:
1. Authentication
When developing locally, you can use one of:
a) Google Cloud SDK
b) Service account When using service account, ensure that
2. Enable Vertex AI Model Garden
3. Request access to Claude models in Vertex AI Model Garden
4. Model names must include version suffixes. Try one of these formats:
- "claude-3-5-sonnet-v2@20241022" (Claude 3.5 Sonnet v2) - "claude-3-5-haiku@20241022" (Claude 3.5 Haiku) - "claude-3-5-sonnet@20240620" (Claude 3.5 Sonnet) - "claude-3-opus@20240229" (Claude 3 Opus)
Note: Model availability depends on your Google Cloud project's access to Anthropic models in Vertex AI Model Garden.
Please follow these steps before using this model:
1. Authentication
When developing locally, you can use one of:
a) Google Cloud SDK
b) Service account When using service account, ensure that
GOOGLE_APPLICATION_CREDENTIALS environment variable points to your JSON service account key.
2. Enable Vertex AI Model Garden
3. Request access to Claude models in Vertex AI Model Garden
4. Model names must include version suffixes. Try one of these formats:
- "claude-3-5-sonnet-v2@20241022" (Claude 3.5 Sonnet v2) - "claude-3-5-haiku@20241022" (Claude 3.5 Haiku) - "claude-3-5-sonnet@20240620" (Claude 3.5 Sonnet) - "claude-3-opus@20240229" (Claude 3 Opus)
Note: Model availability depends on your Google Cloud project's access to Anthropic models in Vertex AI Model Garden.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.ChatModel
chat, chat, chat, chat, chat, defaultRequestParameters, supportedCapabilities
-
Constructor Details
-
VertexAiAnthropicChatModel
public VertexAiAnthropicChatModel(VertexAiAnthropicChatModel.VertexAiAnthropicChatModelBuilder builder)
-
-
Method Details
-
doChat
public dev.langchain4j.model.chat.response.ChatResponse doChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) - Specified by:
doChatin interfacedev.langchain4j.model.chat.ChatModel
-
listeners
- Specified by:
listenersin interfacedev.langchain4j.model.chat.ChatModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
providerin interfacedev.langchain4j.model.chat.ChatModel
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
builder
-