| 36 | } |
| 37 | |
| 38 | class NonWorkerAsyncEncoder implements AsyncEncoder { |
| 39 | constructor(private readonly encoding: Encoding) {} |
| 40 | |
| 41 | async close(): Promise<void> {} |
| 42 | |
| 43 | async encode(text: string): Promise<number[]> { |
| 44 | return this.encoding.encode(text); |
| 45 | } |
| 46 | |
| 47 | async decode(tokens: number[]): Promise<string> { |
| 48 | return this.encoding.decode(tokens); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | let gptEncoding: Encoding | null = null; |
| 53 | const llamaEncoding = new LlamaEncoding(); |
nothing calls this directly
no outgoing calls
no test coverage detected