Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Add top_k as endpoint parameter
  • Loading branch information
dexters1 committed Jun 5, 2025
commit 790baee8085a3e5e6a33bee203247e54e260a8c5
7 changes: 6 additions & 1 deletion cognee/api/v1/search/routers/get_search_router.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from uuid import UUID
from datetime import datetime
from fastapi import Depends, APIRouter
Expand All @@ -12,6 +13,7 @@
class SearchPayloadDTO(InDTO):
search_type: SearchType
query: str
top_k: Optional[int] = 10


def get_search_router() -> APIRouter:
Expand Down Expand Up @@ -39,7 +41,10 @@ async def search(payload: SearchPayloadDTO, user: User = Depends(get_authenticat

try:
results = await cognee_search(
query_text=payload.query, query_type=payload.search_type, user=user
query_text=payload.query,
query_type=payload.search_type,
user=user,
top_k=payload.top_k,
)

return results
Expand Down