forked from innovacion/searchbox
17 lines
516 B
Python
17 lines
516 B
Python
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"))
|