Function
make
(options: {
/**
* Function to tokenize a prompt into an array of token numbers.
*/
readonly tokenize: (
/**
* The prompt to tokenize.
*/
content: Prompt.Prompt
) => Effect.Effect<Array<number>, AiError.AiError>
})
Source from the content-addressed store, hash-verified
| 148 | * @category Constructors |
| 149 | */ |
| 150 | export const make = (options: { |
| 151 | /** |
| 152 | * Function to tokenize a prompt into an array of token numbers. |
| 153 | */ |
| 154 | readonly tokenize: ( |
| 155 | /** |
| 156 | * The prompt to tokenize. |
| 157 | */ |
| 158 | content: Prompt.Prompt |
| 159 | ) => Effect.Effect<Array<number>, AiError.AiError> |
| 160 | }): Service => |
| 161 | Tokenizer.of({ |
| 162 | tokenize(input) { |
| 163 | return options.tokenize(Prompt.make(input)) |
| 164 | }, |
| 165 | truncate(input, tokens) { |
| 166 | return truncate(Prompt.make(input), options.tokenize, tokens) |
| 167 | } |
| 168 | }) |
| 169 | |
| 170 | const truncate = ( |
| 171 | self: Prompt.Prompt, |
Callers
nothing calls this directly
Tested by
no test coverage detected