Install latest from the GitHub repository:
$ pip install git+https://github.com/AnswerDotAI/vertexauth.git
or from conda
$ conda install -c AnswerDotAI vertexauth
or from pypi
$ pip install vertexauth
Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.
To use this library, you need install a “superkey” credential file in
your ~/.config/vertexauth/default/superkey.json
.
Then, you can do the following to get access to a claudette.Client
,
which is authenticated to use Anthropic’s Sonnet 3.5 v2 model, hosted on
Vertex AI and paid for by Google Cloud budget:
from vertexauth.core import get_claudette_client
cl = get_claudette_client()
cl("Hi, Claude!")
Hi! I’m happy to help. What would you like to discuss?
- id:
msg_vrtx_016Tu5UWnM6q6uzASTpr7BTV
- content:
[{'text': "Hi! I'm happy to help. What would you like to discuss?", 'type': 'text'}]
- model:
claude-3-5-sonnet-v2-20241022
- role:
assistant
- stop_reason:
end_turn
- stop_sequence:
None
- type:
message
- usage:
{'input_tokens': 11, 'output_tokens': 18}
What is a superkey? It is merely a Google Cloud Service Account Key
File, encoded in JSON, with a region
key/value pair added.
Please consult the notebook 00_core.ipynb
for a working example of
creating a service account, creating a service account key, downloading
the key file, and saving a superkey file into the default location.