Import source: axon/routers/index

Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
arsam
2026-09-18 23:06:22 +03:30
parent d748376603
commit f0693409a7
+24
View File
@@ -0,0 +1,24 @@
from fastapi import APIRouter
from axon.models import (
IndexSearchRequest,
IndexSearchResponse,
IngestRequest,
IngestResponse,
)
from axon.services.index import ingest_documents, search_index
router = APIRouter()
@router.post("/ingest", response_model=IngestResponse)
async def ingest(request: IngestRequest) -> IngestResponse:
return IngestResponse(indexed=await ingest_documents(request.documents))
@router.post("/index/search", response_model=IndexSearchResponse)
async def index_search(request: IndexSearchRequest) -> IndexSearchResponse:
return IndexSearchResponse(
query=request.query,
results=await search_index(request.query, request.max_results),
)