Find answers from the community

Home
Members
EmanueleG
E
EmanueleG
Offline, last seen 3 months ago
Joined September 25, 2024
I want to use llama to create an AI chatbot for PDFs. I've tried to start with the documentation example but nothing.. i've understand how llama works but it cause openaiapikey error..how can i solve this?
i've copied this
// example.ts
import fs from "fs/promises";
import { Document, VectorStoreIndex } from "llamaindex";

async function main() {
// Load essay from abramov.txt in Node
const essay = await fs.readFile(
"node_modules/llamaindex/examples/abramov.txt",
"utf-8"
);

// Create Document object with essay
const document = new Document({ text: essay });

// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments([document]);

// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What did the author do in college?"
);

// Output response
console.log(response.toString());
}

main();
AND THIS IS THE PROBLEM AuthenticationError: Incorrect API key provided: sk-pgr1k***NI0x.
right
what does it means?
export OPENAI_API_KEY="sk-......" # Replace with your key from https://platform.openai.com/account/api-keys
OpenAI Platform
Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.
where i have to put my OPENAI_API_KEY??
Please, if you can, help me
5 comments
L
R
: Error: Attempting to initialize VectorStoreIndex with non-vector indexStruct
1 comment
L
where i have to put my OPENAI_API_KEY??
7 comments
L
E
W