add initial support for multimodal_embedding vertex

This commit is contained in:
Ishaan Jaff 2024-08-21 14:29:05 -07:00
parent 710ae63957
commit be6eb52036
2 changed files with 279 additions and 13 deletions

View file

@ -3477,19 +3477,35 @@ def embedding(
or get_secret("VERTEX_CREDENTIALS")
)
response = vertex_ai.embedding(
model=model,
input=input,
encoding=encoding,
logging_obj=logging,
optional_params=optional_params,
model_response=EmbeddingResponse(),
vertex_project=vertex_ai_project,
vertex_location=vertex_ai_location,
vertex_credentials=vertex_credentials,
aembedding=aembedding,
print_verbose=print_verbose,
)
if "image" in optional_params or "video" in optional_params:
# multimodal embedding is supported on vertex httpx
response = vertex_chat_completion.multimodal_embedding(
model=model,
input=input,
encoding=encoding,
logging_obj=logging,
optional_params=optional_params,
model_response=EmbeddingResponse(),
vertex_project=vertex_ai_project,
vertex_location=vertex_ai_location,
vertex_credentials=vertex_credentials,
aembedding=aembedding,
print_verbose=print_verbose,
)
else:
response = vertex_ai.embedding(
model=model,
input=input,
encoding=encoding,
logging_obj=logging,
optional_params=optional_params,
model_response=EmbeddingResponse(),
vertex_project=vertex_ai_project,
vertex_location=vertex_ai_location,
vertex_credentials=vertex_credentials,
aembedding=aembedding,
print_verbose=print_verbose,
)
elif custom_llm_provider == "oobabooga":
response = oobabooga.embedding(
model=model,