Skip to content

Retrieval

Retrieve
client.beta.retrieval.retrieve(RetrievalRetrieveParams { index_id, query, organization_id, 9 more } params, RequestOptionsoptions?): RetrievalRetrieveResponse { results }
POST/api/v1/retrieval/retrieve
Search Files
client.beta.retrieval.search(RetrievalSearchParams { index_id, organization_id, project_id, 3 more } params, RequestOptionsoptions?): RetrievalSearchResponse { files }
POST/api/v1/retrieval/files/search
Grep File
client.beta.retrieval.grep(RetrievalGrepParams { file_id, index_id, pattern, 4 more } params, RequestOptionsoptions?): RetrievalGrepResponse { matches }
POST/api/v1/retrieval/files/grep
Read File
client.beta.retrieval.read(RetrievalReadParams { file_id, index_id, organization_id, 3 more } params, RequestOptionsoptions?): RetrievalReadResponse { content }
POST/api/v1/retrieval/files/read
ModelsExpand Collapse
RetrievalRetrieveResponse { results }

Response containing retrieval results.

results: Array<Result>

Ordered list of retrieved chunks.

content: string

Text content of the retrieved chunk.

metadata?: Record<string, string | number | boolean | Array<string> | null> | null

User-defined metadata associated with the chunk.

One of the following:
string
number
boolean
Array<string>
rerank_score?: number | null

Relevance score from the reranker, if reranking was applied.

score?: number | null

Hybrid search relevance score.

static_fields?: StaticFields { attachments, chunk_end_char, chunk_index, 5 more }

Built-in fields stored for every exported chunk.

attachments?: Array<Attachment>

Attachments associated with the chunk

attachment_name: string

Attachment-relative path, e.g. ‘screenshots/page_7.jpg’.

source_id: string

File ID to pass as source_id when fetching the attachment.

type: string

Attachment kind, e.g. ‘screenshot’, ‘items’.

chunk_end_char?: number | null

End character offset of the chunk.

chunk_index?: number | null

Index of the chunk within the file.

chunk_start_char?: number | null

Start character offset of the chunk.

chunk_token_count?: number | null

Token count of the chunk.

page_range_end?: number | null

Last page number covered by this chunk.

page_range_start?: number | null

First page number covered by this chunk.

parsed_directory_file_id?: string | null

ID of the parsed file.

RetrievalSearchResponse { files }

File search results.

files: Array<File>

Matching files with names.

file_id: string

ID of the file.

file_name: string

Display name of the file.

RetrievalGrepResponse { matches }

Grep results for a file.

matches: Array<Match>

Regex matches found in the file.

content: string

Matched text content.

end_char: number

End character offset of the match.

start_char: number

Start character offset of the match.

RetrievalReadResponse { content }

File read result.

content: string

Parsed text content of the file.