Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser and Vanilla JS #4

Open
jordymeow opened this issue Mar 14, 2023 · 2 comments
Open

Browser and Vanilla JS #4

jordymeow opened this issue Mar 14, 2023 · 2 comments

Comments

@jordymeow
Copy link

Hi,

This seems nice but I am not sure; are you currently converting this for vanilla JS, to run this into the browser? If yes, where, which branch? Can I try it already, or it's not ready? Thanks :)

@syonfox
Copy link
Owner

syonfox commented Mar 15, 2023

I believe

npm install gptoken

<script type="application/javascript" src="./node_modules/gptoken/browser.js"></script>

<script> 
console.log(gptoken.countTokens("hello world"))
</script>

the build is npm run build

and it outputs browser.js

this should be included in the npm package

@syonfox
Copy link
Owner

syonfox commented Mar 15, 2023

        const tokens = gpt3encoder.encode('Hello, world!');
        const text = gpt3encoder.decode(tokens);
        const tokenCount = gpt3encoder.countTokens('Hello, world!'); 
    It used to be gpt3encoder but I will renam the browser export to gptoken and rerelease now npm version 0.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants