- Sync
- Async
Parameters
query(str): Search query textfilters(Dict[str, Any], optional): Optional metadata filtersk(int, optional): Number of results. Defaults to 4.min_score(float, optional): Minimum similarity threshold. Defaults to 0.0.use_colpali(bool, optional): Whether to use ColPali-style embedding model to retrieve the chunks (only works for documents ingested withuse_colpali=True). Defaults to True.padding(int, optional): Number of additional chunks/pages to retrieve before and after matched chunks (ColPali only). Defaults to 0.output_format(str, optional): Controls how image chunks are returned. Set to"url"to receive presigned URLs; omit or set to"base64"(default) to receive base64 content.
Metadata Filters
Filters follow the same JSON syntax across the API. See the Metadata Filtering guide for supported operators and typed comparisons. Example:Returns
List[FinalChunkResult]: List of chunk results
Examples
- Sync
- Async
FinalChunkResult Properties
TheFinalChunkResult objects returned by this method have the following properties:
content(str | PILImage): Chunk content (text or image)score(float): Relevance scoredocument_id(str): Parent document IDchunk_number(int): Chunk sequence numbermetadata(Dict[str, Any]): Document metadatacontent_type(str): Content typefilename(Optional[str]): Original filenamedownload_url(Optional[str]): URL to download full document
Image URL output
- When
output_format="url"is provided, image chunks are returned as presigned HTTPS URLs incontent. This is convenient for UIs and LLMs that accept remote image URLs (e.g., viaimage_url). - When
output_formatis omitted or set to"base64"(default), image chunks are returned as base64 data (the SDK attempts to decode these into aPIL.ImageforFinalChunkResult.content). - Text chunks are unaffected by
output_formatand are always returned as strings. - The
download_urlfield may be populated for image chunks. When usingoutput_format="url", it will typically matchcontentfor those chunks.
get_document_download_url.
