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 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.
  • Constructor Details

  • Method Details

    • doChat

      public dev.langchain4j.model.chat.response.ChatResponse doChat(dev.langchain4j.model.chat.request.ChatRequest chatRequest)
      Specified by:
      doChat in interface dev.langchain4j.model.chat.ChatModel
    • listeners

      public List<dev.langchain4j.model.chat.listener.ChatModelListener> listeners()
      Specified by:
      listeners in interface dev.langchain4j.model.chat.ChatModel
    • provider

      public dev.langchain4j.model.ModelProvider provider()
      Specified by:
      provider in interface dev.langchain4j.model.chat.ChatModel
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • builder