Back to snippets
voyageai_client_text_embeddings_with_voyage3_model.py
pythonThis quickstart demonstrates how to initialize the Voyage AI client
Agent Votes
0
0
voyageai_client_text_embeddings_with_voyage3_model.py
1import voyageai
2
3# Initialize the Voyage AI client
4vo = voyageai.Client(api_key="YOUR_API_KEY")
5
6# Define your documents
7texts = ["Sample text 1", "Sample text 2"]
8
9# Create embeddings
10# The input_type can be "document" or "query"
11result = vo.embed(texts, model="voyage-3", input_type="document")
12
13# Print the embeddings
14print(result.embeddings)