mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-16 14:57:20 +00:00
chore: Support embedding params from metadata for Vector Store (#3811)
Some checks failed
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Python Package Build Test / build (3.13) (push) Failing after 1s
Python Package Build Test / build (3.12) (push) Failing after 2s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 6s
Test External API and Providers / test-external (venv) (push) Failing after 3s
Vector IO Integration Tests / test-matrix (push) Failing after 5s
Unit Tests / unit-tests (3.12) (push) Failing after 4s
Unit Tests / unit-tests (3.13) (push) Failing after 5s
API Conformance Tests / check-schema-compatibility (push) Successful in 13s
UI Tests / ui-tests (22) (push) Successful in 42s
Pre-commit / pre-commit (push) Successful in 1m34s
Some checks failed
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Python Package Build Test / build (3.13) (push) Failing after 1s
Python Package Build Test / build (3.12) (push) Failing after 2s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 6s
Test External API and Providers / test-external (venv) (push) Failing after 3s
Vector IO Integration Tests / test-matrix (push) Failing after 5s
Unit Tests / unit-tests (3.12) (push) Failing after 4s
Unit Tests / unit-tests (3.13) (push) Failing after 5s
API Conformance Tests / check-schema-compatibility (push) Successful in 13s
UI Tests / ui-tests (22) (push) Successful in 42s
Pre-commit / pre-commit (push) Successful in 1m34s
# What does this PR do? Support reading embedding model and dimensions from metadata for vector store ## Test Plan Unit Tests
This commit is contained in:
parent
ef4bc70bbe
commit
ce8ea2f505
3 changed files with 256 additions and 6 deletions
|
@ -1454,3 +1454,52 @@ def test_openai_vector_store_file_batch_error_handling(
|
|||
vector_store_id="non_existent_vector_store",
|
||||
file_ids=["any_file_id"],
|
||||
)
|
||||
|
||||
|
||||
def test_openai_vector_store_embedding_config_from_metadata(
|
||||
compat_client_with_empty_stores, client_with_models, embedding_model_id, embedding_dimension
|
||||
):
|
||||
"""Test that embedding configuration works from metadata source."""
|
||||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
client = compat_client_with_empty_stores
|
||||
|
||||
# Test 1: Create vector store with embedding config in metadata only
|
||||
vector_store_metadata = client.vector_stores.create(
|
||||
name="metadata_config_store",
|
||||
metadata={
|
||||
"embedding_model": embedding_model_id,
|
||||
"embedding_dimension": str(embedding_dimension),
|
||||
"test_source": "metadata",
|
||||
},
|
||||
)
|
||||
|
||||
assert vector_store_metadata is not None
|
||||
assert vector_store_metadata.name == "metadata_config_store"
|
||||
assert vector_store_metadata.status in ["completed", "in_progress"]
|
||||
assert vector_store_metadata.metadata["test_source"] == "metadata"
|
||||
|
||||
# Test 2: Create vector store with consistent config in both sources
|
||||
vector_store_consistent = client.vector_stores.create(
|
||||
name="consistent_config_store",
|
||||
metadata={
|
||||
"embedding_model": embedding_model_id,
|
||||
"embedding_dimension": str(embedding_dimension),
|
||||
"test_source": "consistent",
|
||||
},
|
||||
extra_body={
|
||||
"embedding_model": embedding_model_id,
|
||||
"embedding_dimension": int(embedding_dimension), # Ensure same type/value
|
||||
},
|
||||
)
|
||||
|
||||
assert vector_store_consistent is not None
|
||||
assert vector_store_consistent.name == "consistent_config_store"
|
||||
assert vector_store_consistent.status in ["completed", "in_progress"]
|
||||
assert vector_store_consistent.metadata["test_source"] == "consistent"
|
||||
|
||||
# Verify both vector stores can be listed
|
||||
response = client.vector_stores.list()
|
||||
store_names = [store.name for store in response.data]
|
||||
|
||||
assert "metadata_config_store" in store_names
|
||||
assert "consistent_config_store" in store_names
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue