forked from innovacion/searchbox
34 lines
822 B
Python
34 lines
822 B
Python
import json
|
|
import pytest
|
|
from fastmcp import Client
|
|
from fastembed import TextEmbedding
|
|
|
|
from searchbox.mcp_server.server import mcp
|
|
|
|
embedding_model = TextEmbedding()
|
|
|
|
|
|
@pytest.fixture
|
|
async def mcp_client():
|
|
async with Client(mcp) as client:
|
|
yield client
|
|
|
|
|
|
async def test_mcp_qdrant_backend(mcp_client):
|
|
embedding = list(embedding_model.embed("Quien es el mas guapo"))[0].tolist()
|
|
|
|
result = await mcp_client.call_tool(
|
|
name="get_information",
|
|
arguments={
|
|
"query": "dummy value",
|
|
"collection": "dummy_collection",
|
|
"embedding": embedding,
|
|
},
|
|
)
|
|
|
|
content = json.loads(result.content[0].text)[0]
|
|
|
|
assert content["chunk_id"] == "0"
|
|
assert content["score"] >= 0.7
|
|
assert content["payload"] == {"text": "Rick es el mas guapo"}
|