Ecosystem
LLM Integrations
- Overview
- OpenAI
- Anthropic
- Google Gemini
- Google Vertex AI
- Azure
- Bedrock
- AWS SageMaker
- Ollama
- More
- Bring Your Own LLM
Cloud Platforms
Guardrails
Plugins
Agents
AI Apps
Libraries
Tracing Providers
Embeddings
Get embeddings from Bedrock
Bedrock supports embedding text and images through Amazon Titan and Cohere models. Portkey provides a standardized interface for embedding multiple modalities.
Bedrock Titan
Embedding Text
Copy
Ask AI
from portkey_ai import Portkey
client = Portkey(
api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
virtual_key="VIRTUAL_KEY",
)
embeddings = client.embeddings.create(
model="amazon.titan-embed-text-v2:0",
input="Hello this is a test",
# normalize=False # if you would like to disable normalization
# dimensions=1024, # embedding dimensions
# encoding_format="float", # embedding format
)
Embeddings Images
Copy
Ask AI
from portkey_ai import Portkey
client = Portkey(
api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
virtual_key="VIRTUAL_KEY",
)
embeddings = client.embeddings.create(
model="amazon.titan-embed-image-v1",
dimensions=256,
input=[
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B....."
}
}
]
)
Cohere
Embedding Text
Copy
Ask AI
from portkey_ai import Portkey
client = Portkey(
api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
virtual_key="VIRTUAL_KEY",
)
embeddings = client.embeddings.create(
model="cohere.embed-english-v3",
input=["Hello this is a test", "skibidi"],
input_type="classification"
)
Embeddings Images
Copy
Ask AI
from portkey_ai import Portkey
client = Portkey(
api_key="YOUR_PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
virtual_key="VIRTUAL_KEY",
)
embeddings = client.embeddings.create(
model="cohere.embed-english-v3",
input_type="image",
dimensions=256,
input=[
{
"image": {
"base64": "Data:image/webp;base64,UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B....."
}
}
]
)
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.