Skip to main content

Interface: DocsQAProps<ChunkMetadata>

batteries/docs.DocsQAProps

Properties to be passed to the DocsQA component.

Type parameters

NameType
ChunkMetadataextends Jsonifiable = Jsonifiable

Hierarchy

Properties

corpus

corpus: Corpus<ChunkMetadata>

The corpus of documents that may be relevant to a query.

Defined in

packages/ai-jsx/src/batteries/docs.tsx:743


question

question: string

The question to answer.

Defined in

packages/ai-jsx/src/batteries/docs.tsx:748


chunkFormatter

Optional chunkFormatter: (props: { doc: ScoredChunk<ChunkMetadata> }) => Node

Type declaration

▸ (props): Node

The component used to format document chunks when they're presented to the model. This can be used to present the model with some metadata about the chunk, in a format that is appropriate to the type of document.

 function FormatChunk({ chunk }: { chunk: ScoredChunk }) {
return <>
Title: {chunk.chunk.documentName}
Content: {chunk.chunk.content}
</>
}
Parameters
NameType
propsObject
props.docScoredChunk<ChunkMetadata>
Returns

Node

Defined in

packages/ai-jsx/src/batteries/docs.tsx:772


chunkLimit

Optional chunkLimit: number

When processing a DocsQA query, the most relevent chunks are presented to the model. This field limits the number of chunks to consider. If this value is too large, the size of the chunks may exceed the token limit of the model.

Defined in

packages/ai-jsx/src/batteries/docs.tsx:756