forked from innovacion/searchbox
Initial commit
This commit is contained in:
16
scripts/client.py
Normal file
16
scripts/client.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import asyncio
|
||||
from fastmcp import Client
|
||||
from fastembed import TextEmbedding
|
||||
|
||||
|
||||
embedding_model = TextEmbedding()
|
||||
client = Client("http://localhost:8000/sse")
|
||||
|
||||
async def call_tool(input: str, collection: str):
|
||||
embedding: list[float] = list(embedding_model.embed(input))[0].tolist()
|
||||
|
||||
async with client:
|
||||
result = await client.call_tool("semantic_search", {"embedding": embedding, "collection": collection})
|
||||
print(result)
|
||||
|
||||
asyncio.run(call_tool("Dime sobre las cucarachas", "dummy_collection"))
|
||||
Reference in New Issue
Block a user