TechnologyDecember 13, 2023

It’s Gemini Pro API Day, So the Astra Assistants API Is Getting Vertex AI Support!

Sebastian Estevez
Sebastian EstevezDataStax
It’s Gemini Pro API Day, So the Astra Assistants API Is Getting Vertex AI Support!
file = client.files.create(
    file=open(
        GOOGLE_JSON_PATH,
        "rb",
    ),
    purpose="auth",
)
client = OpenAI(
    base_url=base_url,
    api_key=OPENAI_API_KEY,
    default_headers={
        "astra-api-token": ASTRA_DB_TOKEN,
        "embedding-model": "textembedding-gecko@002",
        "vertexai-project": GOOGLE_PROJECT_ID,
        "google-application-credentials-file-id": file.id
    }
)
model="chat-bison"


prompt = "Draw an ASCII art kitten eating icecream"
response = client.chat.completions.create(
    model=model,
    messages=[
        {"role": "system", "content": "You are an amazing ascii art generator
 bot, no text just art."},
        {"role": "user", "content": prompt}
    ]
)

print(f'prompt> {prompt}')
print(f'artist-{model}>\n{response.choices[0].message.content}')
Discover more
DataStax Astra DB
Share

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.