Type Alias: LlamaDecisionContextDecideOptions
ts
type LlamaDecisionContextDecideOptions = {
signal?: AbortSignal;
evaluationPriority?: EvaluationPriority;
onOverflow?: | "throw"
| "truncateDocument"
| {
type: "compressDocument";
compressDocument: | string
| Promise<string>;
};
};Defined in: evaluator/LlamaDecisionContext/LlamaDecisionContext.ts:66
Properties
signal?
ts
optional signal: AbortSignal;Defined in: evaluator/LlamaDecisionContext/LlamaDecisionContext.ts:67
evaluationPriority?
ts
optional evaluationPriority: EvaluationPriority;Defined in: evaluator/LlamaDecisionContext/LlamaDecisionContext.ts:72
See the parameter evaluationPriority on the LlamaContextSequence.evaluate() function for more information.
onOverflow?
ts
optional onOverflow:
| "throw"
| "truncateDocument"
| {
type: "compressDocument";
compressDocument: | string
| Promise<string>;
};Defined in: evaluator/LlamaDecisionContext/LlamaDecisionContext.ts:83
What to do when the room left for the document with the provided questions is insufficient in the context window.
"throw"- throw an error when there is not enough room for the document."truncateDocument"- truncate the end of the document to fit within the available context window.{type: "compressDocument", compressDocument: ...}- compress the document using the provided compression function.
Defaults to "throw".
Type Declaration
"throw"
"truncateDocument"
ts
{
type: "compressDocument";
compressDocument: | string
| Promise<string>;
}type
ts
type: "compressDocument";compressDocument()
ts
compressDocument(options: {
document: string;
maxTokensCount: number;
tokenizer: Tokenizer;
}):
| string
| Promise<string>;Compress the document to fit within the given maxTokensCount.
You can use the provided tokenizer to determine the token count of the document before returning it.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { document: string; maxTokensCount: number; tokenizer: Tokenizer; } | - |
options.document | string | The document to compress |
options.maxTokensCount | number | Maximum number of tokens that the document should fit under when tokenized |
options.tokenizer | Tokenizer | Tokenizer used to tokenize the document |
Returns
| string | Promise<string>