SearchFileConfig
Configuration for the search.file() middleware.
Properties
Section titled “Properties”
optionalmode?:"tool"|"auto"
Retrieval mode.
"tool"(default): registers asearch_knowledgetool, model decides when to search."auto": retrieves every turn using the latest user message.
retrieve
Section titled “retrieve”retrieve: (
query) =>Promise<Chunk[]>
Retriever function — returns relevant chunks for a query.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Chunk[]>
rewriteQuery?
Section titled “rewriteQuery?”
optionalrewriteQuery?: (message,history) =>string
Custom query rewrite function (auto mode only).
Parameters
Section titled “Parameters”message
Section titled “message”string
history
Section titled “history”Message[]
Returns
Section titled “Returns”string
optionaltopK?:number
Maximum chunks to inject into context. Default: 5.