forked from innovacion/searchbox
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e9900d6a7 | |||
| 611c2c4b81 | |||
| 23a4ce9fe3 | |||
| 9ddb970ca4 | |||
| 6d91c6cd45 |
3
.github/workflows/ci.yaml
vendored
3
.github/workflows/ci.yaml
vendored
@@ -4,6 +4,9 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
|
||||
@@ -22,3 +22,6 @@ spec:
|
||||
image: gitea.ia-innovacion.work/innovacion/searchbox-mcp:latest
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: vault-readonly-token
|
||||
|
||||
5
.mise/config.toml
Normal file
5
.mise/config.toml
Normal file
@@ -0,0 +1,5 @@
|
||||
[tasks.check]
|
||||
run = ["uv run ruff check --fix", "uv run ruff format"]
|
||||
|
||||
[tasks.test]
|
||||
run = "uv run pytest --cov"
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "searchbox"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
|
||||
1
src/searchbox/embedder/__init__.py
Normal file
1
src/searchbox/embedder/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Embedder class using Azure AI Foundry."""
|
||||
7
src/searchbox/embedder/azure.py
Normal file
7
src/searchbox/embedder/azure.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Embedder class using Azure AI Foundry."""
|
||||
|
||||
from .base import BaseEmbedder
|
||||
|
||||
|
||||
class AzureEmbedder(BaseEmbedder):
|
||||
def embed(self, text: str) -> list[float]: ...
|
||||
6
src/searchbox/embedder/base.py
Normal file
6
src/searchbox/embedder/base.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class BaseEmbedder(ABC):
|
||||
@abstractmethod
|
||||
def embed(self, text: str) -> list[float]: ...
|
||||
@@ -17,12 +17,10 @@ Example:
|
||||
|
||||
"""
|
||||
|
||||
from fastmcp.server.server import Transport
|
||||
|
||||
from .server import mcp
|
||||
|
||||
|
||||
def run(transport: Transport = "sse"): # pragma: no cover
|
||||
def run(): # pragma: no cover
|
||||
"""Run the vector search MCP server with the specified transport.
|
||||
|
||||
Args:
|
||||
@@ -34,4 +32,4 @@ def run(transport: Transport = "sse"): # pragma: no cover
|
||||
>>> run("stdio") # Start with stdio transport
|
||||
|
||||
"""
|
||||
mcp.run(transport=transport)
|
||||
mcp.run(transport="sse", host="0.0.0.0", port=8000)
|
||||
|
||||
@@ -19,6 +19,8 @@ Example:
|
||||
from typing import Annotated
|
||||
|
||||
from fastmcp import FastMCP
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
from ..engine import get_engine
|
||||
|
||||
@@ -49,3 +51,9 @@ async def get_information(
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@mcp.custom_route("/health", methods=["GET"])
|
||||
async def health_check(_request: Request):
|
||||
"""Health check endpoint."""
|
||||
return JSONResponse({"status": "ok", "service": "searchbox-mcp"})
|
||||
|
||||
Reference in New Issue
Block a user