Class VertexAiAnthropicClient
java.lang.Object
dev.langchain4j.model.vertexai.anthropic.internal.client.VertexAiAnthropicClient
-
Constructor Summary
ConstructorsConstructorDescriptionVertexAiAnthropicClient(String project, String location, String model) VertexAiAnthropicClient(String project, String location, String model, com.google.auth.oauth2.GoogleCredentials credentials) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()generateContent(AnthropicRequest request, String modelName) voidgenerateContentStreaming(AnthropicRequest request, String modelName, StreamingResponseHandler handler) Streaming version of generateContent - simulates streaming by chunking the responsestatic StringresolveEndpoint(String location) Maps a Vertex AI location to the API endpoint host serving it.
-
Constructor Details
-
VertexAiAnthropicClient
-
VertexAiAnthropicClient
-
-
Method Details
-
resolveEndpoint
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:global→aiplatform.googleapis.com- multi-region (
us,eu) →aiplatform.<location>.rep.googleapis.com - region (e.g.
us-east5) →<location>-aiplatform.googleapis.com
- Parameters:
location- the Vertex AI location, case-insensitive- Returns:
- the
host:portendpoint to use forPredictionServiceSettings
-
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()
-