refactor: Add docs for new search arguments

This commit is contained in:
Igor Ilic 2025-08-29 14:16:18 +02:00
parent c3f5840bff
commit 614055c850

View file

@ -1,9 +1,11 @@
from uuid import UUID
import pathlib
from typing import Optional
from datetime import datetime
from pydantic import Field
from fastapi import Depends, APIRouter
from fastapi.responses import JSONResponse
from cognee.modules.search.types import SearchType
from cognee.api.DTO import InDTO, OutDTO
from cognee.modules.users.exceptions.exceptions import PermissionDeniedError
@ -20,7 +22,9 @@ class SearchPayloadDTO(InDTO):
datasets: Optional[list[str]] = Field(default=None)
dataset_ids: Optional[list[UUID]] = Field(default=None, examples=[[]])
query: str = Field(default="What is in the document?")
system_prompt: Optional[str] = Field(default="")
system_prompt: Optional[str] = Field(
default="Answer the question using the provided context. Be as brief as possible."
)
top_k: Optional[int] = Field(default=10)
only_context: bool = Field(default=False)
@ -81,7 +85,9 @@ def get_search_router() -> APIRouter:
- **datasets** (Optional[List[str]]): List of dataset names to search within
- **dataset_ids** (Optional[List[UUID]]): List of dataset UUIDs to search within
- **query** (str): The search query string
- **system_prompt** Optional[str]: System prompt to be used for Completion type searches in Cognee
- **top_k** (Optional[int]): Maximum number of results to return (default: 10)
- **only_context** bool: Set to true to only return context Cognee will be sending to LLM in Completion type searches. This will be returned instead of LLM calls for completion type searches.
## Response
Returns a list of search results containing relevant nodes from the graph.