forked from innovacion/searchbox
Add testing
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
from .main import mcp
|
||||
|
||||
def run():
|
||||
mcp.run(transport="sse")
|
||||
7
src/vector_search_mcp/__init__.py
Normal file
7
src/vector_search_mcp/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from fastmcp.server.server import Transport
|
||||
|
||||
from .main import mcp
|
||||
|
||||
|
||||
def run(transport: Transport = "sse"):
|
||||
mcp.run(transport=transport)
|
||||
@@ -1,7 +1,6 @@
|
||||
from pydantic import Field
|
||||
from vault_settings import VaultSettings
|
||||
|
||||
|
||||
class Settings(VaultSettings):
|
||||
url: str = Field(...)
|
||||
url: str
|
||||
api_key: str | None = None
|
||||
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
from typing import Any, final
|
||||
|
||||
from qdrant_client import AsyncQdrantClient, models
|
||||
|
||||
@@ -7,9 +7,10 @@ from .config import Settings
|
||||
from .models import SearchRow
|
||||
|
||||
|
||||
@final
|
||||
class QdrantEngine:
|
||||
def __init__(self) -> None:
|
||||
self.settings = Settings()
|
||||
self.settings = Settings() # type: ignore[reportCallIssue]
|
||||
self.client = AsyncQdrantClient(
|
||||
url=self.settings.url, api_key=self.settings.api_key
|
||||
)
|
||||
@@ -32,4 +33,8 @@ class QdrantEngine:
|
||||
score_threshold=threshold,
|
||||
)
|
||||
|
||||
return [SearchRow(chunk_id=str(point.id), score=point.score, payload=point.payload) for point in points if point.payload is not None]
|
||||
return [
|
||||
SearchRow(chunk_id=str(point.id), score=point.score, payload=point.payload)
|
||||
for point in points
|
||||
if point.payload is not None
|
||||
]
|
||||
@@ -2,7 +2,7 @@ from fastmcp import FastMCP
|
||||
|
||||
from .engine import QdrantEngine
|
||||
|
||||
mcp = FastMCP("Qdrant MCP")
|
||||
mcp = FastMCP("Vector Search MCP")
|
||||
|
||||
engine = QdrantEngine()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class SearchRow(BaseModel):
|
||||
chunk_id: str
|
||||
score: float
|
||||
Reference in New Issue
Block a user