With Node.js/Bun/Deno
In this guide, you'll learn how to use LlamaIndex with Node.js, Bun, and Deno.
Adding environment variables
By default, LlamaIndex uses OpenAI provider, which requires an API key. You can set the OPENAI_API_KEY
environment variable to authenticate with OpenAI.
Or you can use a .env
file:
Do not commit the api key to git repository.
For more information, see the How to read environment variables from Node.js.
Performance Optimization
By the default, we are using js-tiktoken
for tokenization. You can install gpt-tokenizer
which is then automatically used by LlamaIndex to get a 60x speedup for tokenization:
Note: This only works for Node.js
TypeScript support
Getting Started with LlamaIndex.TS in TypeScript
Edit on GitHub
Last updated on