Files
Axon/axon/routers/index.py
T
arsam f0693409a7 Import source: axon/routers/index
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
2026-09-18 23:06:22 +03:30

25 lines
709 B
Python

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),
)