Class VertexBetaMessagesStreamingAsyncExample
-
- All Implemented Interfaces:
public final class VertexBetaMessagesStreamingAsyncExampleAn example of retrieving a stream of "beta" messages asynchronously from an Anthropic model running on the Google Cloud Vertex AI backend.
To use the VertexBackend, the SDK module for Vertex must be added to the dependencies. Many of the other examples can be adapted to create a client with the
VertexBackend(subject to the endpoint being supported). Once a client is created, the rest of the code is the same. See the SDK documentation for details on dependencies and endpoint support for Vertex AI.Google OAuth2 credentials must be configured to access Vertex AI. This example resolves the application default credentials (ADC), which may be configured using the Google Cloud CLI. See Google Cloud documentation for details. Alternatively, the Google credentials, region and project can be set explicitly from other sources. See VertexMessagesExample for comparison.
In addition to the ADC configuration, the following environment variables are expected to be defined:
CLOUD_ML_REGION: The name of the Google Cloud region hosting the service.ANTHROPIC_VERTEX_PROJECT_ID: The ID of the Google Cloud Vertex AI project.