mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-30 11:50:14 +00:00
fix for model in OpenAIEmbeddingsResponse and rebase
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
15042c6c31
commit
179399edf4
2 changed files with 9 additions and 1 deletions
|
@ -419,9 +419,10 @@ class OllamaInferenceAdapter(
|
||||||
prompt_tokens=response.usage.prompt_tokens,
|
prompt_tokens=response.usage.prompt_tokens,
|
||||||
total_tokens=response.usage.total_tokens,
|
total_tokens=response.usage.total_tokens,
|
||||||
)
|
)
|
||||||
|
# TODO: Investigate why model_obj.identifier is used instead of response.model
|
||||||
return OpenAIEmbeddingsResponse(
|
return OpenAIEmbeddingsResponse(
|
||||||
data=data,
|
data=data,
|
||||||
model=response.model,
|
model=model_obj.identifier,
|
||||||
usage=usage,
|
usage=usage,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,12 @@ def skip_if_model_doesnt_support_openai_embeddings(client, model_id):
|
||||||
pytest.skip(f"Model {model_id} hosted by {provider.provider_type} doesn't support OpenAI embeddings.")
|
pytest.skip(f"Model {model_id} hosted by {provider.provider_type} doesn't support OpenAI embeddings.")
|
||||||
|
|
||||||
|
|
||||||
|
def skip_if_client_doesnt_support_base64_encoding(client, model_id):
|
||||||
|
provider = provider_from_model(client, model_id)
|
||||||
|
if provider.provider_type in ("remote::ollama",):
|
||||||
|
pytest.skip(f"Client {client} doesn't support base64 encoding for embeddings.")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def openai_client(client_with_models):
|
def openai_client(client_with_models):
|
||||||
base_url = f"{client_with_models.base_url}/v1/openai/v1"
|
base_url = f"{client_with_models.base_url}/v1/openai/v1"
|
||||||
|
@ -247,6 +253,7 @@ def test_openai_embeddings_with_encoding_format_base64(compat_client, client_wit
|
||||||
def test_openai_embeddings_base64_batch_processing(compat_client, client_with_models, embedding_model_id):
|
def test_openai_embeddings_base64_batch_processing(compat_client, client_with_models, embedding_model_id):
|
||||||
"""Test OpenAI embeddings endpoint with base64 encoding for batch processing."""
|
"""Test OpenAI embeddings endpoint with base64 encoding for batch processing."""
|
||||||
skip_if_model_doesnt_support_openai_embeddings(client_with_models, embedding_model_id)
|
skip_if_model_doesnt_support_openai_embeddings(client_with_models, embedding_model_id)
|
||||||
|
skip_if_client_doesnt_support_base64_encoding(client_with_models, embedding_model_id)
|
||||||
|
|
||||||
input_texts = ["First text for base64", "Second text for base64", "Third text for base64"]
|
input_texts = ["First text for base64", "Second text for base64", "Third text for base64"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue