Skip to content

Latest commit

 

History

History
31 lines (16 loc) · 574 Bytes

trimTokens.md

File metadata and controls

31 lines (16 loc) · 574 Bytes

@elizaos/core v0.1.7-alpha.1 / trimTokens

Function: trimTokens()

trimTokens(context, maxTokens, model): string

Truncate the context to the maximum length allowed by the model.

Parameters

context: string

The text to truncate

maxTokens: number

Maximum number of tokens to keep

model: TiktokenModel

The tokenizer model to use

Returns

string

The truncated text

Defined in

packages/core/src/generation.ts:581