botisan-ai / gpt3-tokenizer

Isomorphic JavaScript/TypeScript Tokenizer for GPT-3 and Codex Models by OpenAI.
MIT License
171 stars 19 forks source link

Fix types #18

Open qgustavor opened 1 year ago

qgustavor commented 1 year ago

The types of the library are wrong: https://arethetypeswrong.github.io/?p=gpt3-tokenizer%401.1.3

Because of this issue the example in the documentation does not work in some environments, at the moment you need to use const tokenizer = new GPT3Tokenizer.default({ type: 'gpt3' }); on those instead.

Is a common issue with TypeScript projects... so common someone had to make a website to detect that issue. If the types are hard to fix (the website above makes fixing it look simple) just add a note in documentation. It's a bit frustrating testing out a new library, the first example in the documentation does not work and having to debug why, then you find the solution and question yourself why you are a JavaScript programmer and how those kind of issues still exist even with TypeScript... 😑

arnaudbzn commented 11 months ago

Issue reproduced with Deno. The workaround is to use.default.