MCPcopy Index your code
hub / github.com/Effect-TS/effect / make

Function make

packages/ai/ai/src/Tokenizer.ts:150–168  ·  view source on GitHub ↗
(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 */
150export 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
170const truncate = (
171 self: Prompt.Prompt,

Callers

nothing calls this directly

Calls 1

ofMethod · 0.65

Tested by

no test coverage detected