mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-25 07:52:02 +00:00
test: Add faiss provider to openai_vector_stores test suite
- Add faiss vector_io provider to openai vector store test fixtures - Fix FaissVectorIOAdapter to maintain in-memory cache consistency - Update test mocks to work with faiss provider's cache structure - Add missing assertions in vector store file deletion tests Enables the faiss provider to be tested alongside milvus and sqlite_vec providers in the OpenAI vector store test suite. Signed-off-by: Derek Higgins <derekh@redhat.com>
This commit is contained in:
parent
4ecd6bf5d3
commit
5785ddd6a6
3 changed files with 50 additions and 4 deletions
|
|
@ -267,6 +267,7 @@ class FaissVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocolPr
|
|||
assert self.kvstore is not None
|
||||
key = f"{OPENAI_VECTOR_STORES_PREFIX}{store_id}"
|
||||
await self.kvstore.set(key=key, value=json.dumps(store_info))
|
||||
self.openai_vector_stores[store_id] = store_info
|
||||
|
||||
async def _load_openai_vector_stores(self) -> dict[str, dict[str, Any]]:
|
||||
"""Load all vector store metadata from kvstore."""
|
||||
|
|
@ -286,12 +287,15 @@ class FaissVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocolPr
|
|||
assert self.kvstore is not None
|
||||
key = f"{OPENAI_VECTOR_STORES_PREFIX}{store_id}"
|
||||
await self.kvstore.set(key=key, value=json.dumps(store_info))
|
||||
self.openai_vector_stores[store_id] = store_info
|
||||
|
||||
async def _delete_openai_vector_store_from_storage(self, store_id: str) -> None:
|
||||
"""Delete vector store metadata from kvstore."""
|
||||
assert self.kvstore is not None
|
||||
key = f"{OPENAI_VECTOR_STORES_PREFIX}{store_id}"
|
||||
await self.kvstore.delete(key)
|
||||
if store_id in self.openai_vector_stores:
|
||||
del self.openai_vector_stores[store_id]
|
||||
|
||||
async def _save_openai_vector_store_file(
|
||||
self, store_id: str, file_id: str, file_info: dict[str, Any], file_contents: list[dict[str, Any]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue