Class VertexAiAnthropicClient

java.lang.Object
dev.langchain4j.model.vertexai.anthropic.internal.client.VertexAiAnthropicClient

public class VertexAiAnthropicClient extends Object
  • Constructor Details

    • VertexAiAnthropicClient

      public VertexAiAnthropicClient(String project, String location, String model)
    • VertexAiAnthropicClient

      public VertexAiAnthropicClient(String project, String location, String model, com.google.auth.oauth2.GoogleCredentials credentials)
  • Method Details

    • resolveEndpoint

      public static String resolveEndpoint(String location)
      Maps a Vertex AI location to the API endpoint host serving it. Vertex AI uses a different host format for each of its three location types:
      • globalaiplatform.googleapis.com
      • multi-region (us, eu) → aiplatform.<location>.rep.googleapis.com
      • region (e.g. us-east5) → <location>-aiplatform.googleapis.com
      See Claude on Vertex AI.
      Parameters:
      location - the Vertex AI location, case-insensitive
      Returns:
      the host:port endpoint to use for PredictionServiceSettings
    • generateContent

      public AnthropicResponse generateContent(AnthropicRequest request, String modelName) throws IOException
      Throws:
      IOException
    • generateContentStreaming

      public void generateContentStreaming(AnthropicRequest request, String modelName, StreamingResponseHandler handler) throws IOException
      Streaming version of generateContent - simulates streaming by chunking the response
      Throws:
      IOException
    • close

      public void close()