Install and configure LlamaIndex.TS data framework for building LLM applications with custom data integration across Node.js, Deno, Bun, and edge runtimes.
Install and configure LlamaIndex.TS, a lightweight data framework for integrating large language models with your own data in JavaScript/TypeScript environments.
This skill helps you set up LlamaIndex.TS in your project, including:
Follow these steps to set up LlamaIndex.TS:
Check that the project uses a supported JavaScript runtime:
Note: Browser support is currently limited due to AsyncLocalStorage API requirements.
Install the llamaindex package using the project's package manager:
```bash
npm install llamaindex
pnpm install llamaindex
yarn add llamaindex
```
Ask the user which providers they need, or analyze existing code to determine requirements:
**LLM Providers** (choose one or more):
**Other Providers**:
Install the identified provider packages. For example, for OpenAI:
```bash
npm install @llamaindex/openai
```
If the project uses TypeScript, ensure `tsconfig.json` is properly configured:
Provide a minimal working example based on the installed providers. For OpenAI:
```typescript
import { OpenAI } from "@llamaindex/openai";
import { Document, VectorStoreIndex } from "llamaindex";
// Initialize LLM
const llm = new OpenAI({ model: "gpt-4", apiKey: process.env.OPENAI_API_KEY });
// Create documents
const document = new Document({ text: "Your text here" });
// Create index and query
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = index.asQueryEngine({ llm });
const response = await queryEngine.query("Your question here");
```
Remind the user to add necessary API keys to their environment:
```bash
OPENAI_API_KEY=your_api_key_here
```
Point the user to key resources:
**User Request**: "Set up LlamaIndex with OpenAI for my Next.js app"
**Agent Actions**:
1. Verify Node.js version is >= 20
2. Install `llamaindex` and `@llamaindex/openai`
3. Check for existing `tsconfig.json` configuration
4. Create example code showing basic document indexing and querying
5. Add `OPENAI_API_KEY` to `.env.local` (if not present)
6. Provide link to Next.js-specific documentation
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/llamaindexts-setup/raw