mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
test: add unit tests for vector db search mode validation
This commit is contained in:
parent
7f43bc6d76
commit
bfef0ee0e9
1 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from llama_stack.apis.tools.rag_tool import RAGQueryConfig
|
||||||
from llama_stack.apis.vector_io import (
|
from llama_stack.apis.vector_io import (
|
||||||
Chunk,
|
Chunk,
|
||||||
ChunkMetadata,
|
ChunkMetadata,
|
||||||
|
@ -60,3 +61,14 @@ class TestRagQuery:
|
||||||
)
|
)
|
||||||
assert expected_metadata_string in result.content[1].text
|
assert expected_metadata_string in result.content[1].text
|
||||||
assert result.content is not None
|
assert result.content is not None
|
||||||
|
|
||||||
|
async def test_query_raises_incorrect_mode(self):
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
RAGQueryConfig(mode="invalid_mode")
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_query_accepts_valid_modes(self):
|
||||||
|
RAGQueryConfig() # Test default (vector)
|
||||||
|
RAGQueryConfig(mode="vector") # Test vector
|
||||||
|
RAGQueryConfig(mode="keyword") # Test keyword
|
||||||
|
RAGQueryConfig(mode="hybrid") # Test hybrid
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue