Ecosystem
LLMs
- Overview
- OpenAI
- Anthropic
- Google Gemini
- Google Vertex AI
- Azure
- Bedrock
- AWS SageMaker
- Ollama
- More
- Bring Your Own LLM
Google Vertex AI
Embeddings
Get embeddings from Vertex AI
Vertex AI offers wide ranging support for embedding text, images and videos. Obiguard provides a standardized interface for embedding multiple modalities.
Embedding Text
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="textembedding-gecko@003",
input_type="classification",
input="The food was delicious and the waiter...",
# input=["text to embed", "more text to embed"], # if you would like to embed multiple texts
)
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="textembedding-gecko@003",
input_type="classification",
input="The food was delicious and the waiter...",
# input=["text to embed", "more text to embed"], # if you would like to embed multiple texts
)
OpenAI Python
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='NOT_REQUIRED',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="sk-obg******", # Your Obiguard API key
)
)
embeddings = client.embeddings.create(
model="textembedding-gecko@003",
input_type="classification",
input="The food was delicious and the waiter...",
# input=["text to embed", "more text to embed"], # if you would like to embed multiple texts
)
Embeddings Images
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
# "url": "gcs://..." # if you want to use a url
}
}
]
)
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
# "url": "gcs://..." # if you want to use a url
}
}
]
)
OpenAI Python
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='NOT_REQUIRED',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="sk-obg******", # Your Obiguard API key
)
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
# "url": "gcs://..." # if you want to use a url
}
}
]
)
cURL
Copy
curl --location 'https://gateway.obiguard.ai/v1/embeddings' \
--header 'Content-Type: application/json' \
--header 'x-obiguard-api-key: $OBIGUARD_API_KEY' \
--data-raw '{
"model": "multimodalembedding@001",
"input": [
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B....."
# "url": "gcs://..." # if you want to use a url
}
}
]
}'
Embeddings Videos
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the video",
"video": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
"start_offset": 0,
"end_offset": 10,
"interval": 5,
# "url": "gcs://..." # if you want to use a url
}
}
]
)
Python
Copy
from obiguard import Obiguard
client = Obiguard(
obiguard_api_key="sk-obg***", # Your Obiguard API key
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the video",
"video": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
"start_offset": 0,
"end_offset": 10,
"interval": 5,
# "url": "gcs://..." # if you want to use a url
}
}
]
)
OpenAI Python
Copy
from openai import OpenAI
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders
client = OpenAI(
api_key='NOT_REQUIRED',
base_url=OBIGUARD_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
obiguard_api_key="sk-obg******", # Your Obiguard API key
)
)
embeddings = client.embeddings.create(
model="multimodalembedding@001",
input=[
{
"text": "this is the caption of the video",
"video": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
"start_offset": 0,
"end_offset": 10,
"interval": 5,
# "url": "gcs://..." # if you want to use a url
}
}
]
)
cURL
Copy
curl --location 'https://gateway.obiguard.ai/v1/embeddings' \
--header 'Content-Type: application/json' \
--header 'x-obiguard-api-key: $OBIGUARD_API_KEY' \
--data-raw '{
"model": "multimodalembedding@001",
"input": [
{
"text": "this is the caption of the video",
"video": {
"base64": "UklGRkacAABXRUJQVlA4IDqcAACQggKdASqpAn8B.....",
"start_offset": 0,
"end_offset": 10,
"interval": 5
# "url": "gcs://..." # if you want to use a url
}
}
]
}'
On this page
Assistant
Responses are generated using AI and may contain mistakes.