forked from innovacion/searchbox
Se agrego la implementacion de Embedding
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
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():
|
||||
@@ -15,19 +13,18 @@ async def mcp_client():
|
||||
|
||||
|
||||
async def test_mcp_qdrant_backend(mcp_client):
|
||||
embedding = list(embedding_model.embed("Quien es el mas guapo"))[0].tolist()
|
||||
|
||||
"""Test MCP server with automatic Azure embedding."""
|
||||
result = await mcp_client.call_tool(
|
||||
name="get_information",
|
||||
arguments={
|
||||
"query": "dummy value",
|
||||
"collection": "dummy_collection",
|
||||
"embedding": embedding,
|
||||
"query": "Quien es el mas guapo",
|
||||
"collection": "azure_collection",
|
||||
},
|
||||
)
|
||||
|
||||
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"}
|
||||
assert content["score"] >= 0.65
|
||||
assert content["payload"]["page_content"] == "Rick es el mas guapo"
|
||||
assert content["payload"]["filename"] == "test.txt"
|
||||
assert content["payload"]["page"] == 1
|
||||
|
||||
Reference in New Issue
Block a user