I Implemented your solution in a chat bot but I have got the message : You exceeded your current quota, please check your plan and billing details. #1

Open
opened 2026-02-15 23:16:02 -05:00 by yindo · 2 comments
Owner

Originally created by @etouraille on GitHub (Nov 13, 2023).

Though, I have got the paying option : Here is my code :

`const essay = await fs.readFile(
"cv.txt",
"utf-8",
);

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

const nodes = getNodesFromDocument(
    new Document({text: essay}),
    new SentenceSplitter({chunkSize: 1024, chunkOverlap: 20}),
);

const nodesWithEmbeddings = await VectorStoreIndex.getNodeEmbeddingResults(
    nodes,
    serviceContextFromDefaults(),
    true,
);

const _nodesWithEmbedding = nodesWithEmbeddings.map((nodeWithEmbedding) => ({
    text: nodeWithEmbedding.getContent(MetadataMode.NONE),
    embedding: nodeWithEmbedding.getEmbedding(),
}))

const embeddingResults = _nodesWithEmbedding.map((config) => {
    return new TextNode({text: config.text, embedding: config.embedding});
});

const indexDict = new IndexDict();
for (const node of embeddingResults) {
    indexDict.addNode(node);
}

// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.init({
    indexStruct: indexDict,
    serviceContext: serviceContextFromDefaults({
        llm: new OpenAI({
            model: "gpt-4",
            temperature: 0.5,
            topP: 0.8,
        }),
    }),
});

await index.vectorStore.add(embeddingResults);
if (!index.vectorStore.storesText) {
    await index.docStore.addDocuments(embeddingResults, true);
}
await index.indexStore?.addIndexStruct(indexDict);
index.indexStruct = indexDict;

const retriever = index.asRetriever();
retriever.similarityTopK = 20 ?? 2;

const queryEngine = new RetrieverQueryEngine(retriever);`
Originally created by @etouraille on GitHub (Nov 13, 2023). Though, I have got the paying option : Here is my code : `const essay = await fs.readFile( "cv.txt", "utf-8", ); // Create Document object with essay const document = new Document({text: essay}); const nodes = getNodesFromDocument( new Document({text: essay}), new SentenceSplitter({chunkSize: 1024, chunkOverlap: 20}), ); const nodesWithEmbeddings = await VectorStoreIndex.getNodeEmbeddingResults( nodes, serviceContextFromDefaults(), true, ); const _nodesWithEmbedding = nodesWithEmbeddings.map((nodeWithEmbedding) => ({ text: nodeWithEmbedding.getContent(MetadataMode.NONE), embedding: nodeWithEmbedding.getEmbedding(), })) const embeddingResults = _nodesWithEmbedding.map((config) => { return new TextNode({text: config.text, embedding: config.embedding}); }); const indexDict = new IndexDict(); for (const node of embeddingResults) { indexDict.addNode(node); } // Split text and create embeddings. Store them in a VectorStoreIndex const index = await VectorStoreIndex.init({ indexStruct: indexDict, serviceContext: serviceContextFromDefaults({ llm: new OpenAI({ model: "gpt-4", temperature: 0.5, topP: 0.8, }), }), }); await index.vectorStore.add(embeddingResults); if (!index.vectorStore.storesText) { await index.docStore.addDocuments(embeddingResults, true); } await index.indexStore?.addIndexStruct(indexDict); index.indexStruct = indexDict; const retriever = index.asRetriever(); retriever.similarityTopK = 20 ?? 2; const queryEngine = new RetrieverQueryEngine(retriever);`
Author
Owner

@yisding commented on GitHub (Nov 13, 2023):

Your issue is probably an OpenAI related throttling issue. I know they've been having some API instability the last few days. Maybe try taking a look at your OpenAI settings on their UI?

@yisding commented on GitHub (Nov 13, 2023): Your issue is probably an OpenAI related throttling issue. I know they've been having some API instability the last few days. Maybe try taking a look at your OpenAI settings on their UI?
Author
Owner

@blacksoulx37 commented on GitHub (Nov 25, 2023):

const nodes = getNodesFromDocument(
new Document({text: essay}),
new SentenceSplitter({chunkSize: 1024, chunkOverlap: 20}),
);

const nodesWithEmbeddings = await VectorStoreIndex.getNodeEmbeddingResults(
nodes,
serviceContextFromDefaults(),
true,
);

const _nodesWithEmbedding = nodesWithEmbeddings.map((nodeWithEmbedding) => ({
text: nodeWithEmbedding.getContent(MetadataMode.NONE),
embedding: nodeWithEmbedding.getEmbedding(),
}))

const embeddingResults = _nodesWithEmbedding.map((config) => {
return new TextNode({text: config.text, embedding: config.embedding});
});

const indexDict = new IndexDict();
for (const node of embeddingResults) {
indexDict.addNode(node);
}

// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.init({
indexStruct: indexDict,
serviceContext: serviceContextFromDefaults({
llm: new OpenAI({
model: "gpt-4",
temperature: 0.5,
topP: 0.8,
}),
}),
});

await index.vectorStore.add(embeddingResults);
if (!index.vectorStore.storesText) {
await index.docStore.addDocuments(embeddingResults, true);
}
await index.indexStore?.addIndexStruct(indexDict);
index.indexStruct = indexDict;

const retriever = index.asRetriever();
retriever.similarityTopK = 20 ?? 2;

const queryEngine = new RetrieverQueryEngine(retriever);`

@blacksoulx37 commented on GitHub (Nov 25, 2023): const nodes = getNodesFromDocument( new Document({text: essay}), new SentenceSplitter({chunkSize: 1024, chunkOverlap: 20}), ); const nodesWithEmbeddings = await VectorStoreIndex.getNodeEmbeddingResults( nodes, serviceContextFromDefaults(), true, ); const _nodesWithEmbedding = nodesWithEmbeddings.map((nodeWithEmbedding) => ({ text: nodeWithEmbedding.getContent(MetadataMode.NONE), embedding: nodeWithEmbedding.getEmbedding(), })) const embeddingResults = _nodesWithEmbedding.map((config) => { return new TextNode({text: config.text, embedding: config.embedding}); }); const indexDict = new IndexDict(); for (const node of embeddingResults) { indexDict.addNode(node); } // Split text and create embeddings. Store them in a VectorStoreIndex const index = await VectorStoreIndex.init({ indexStruct: indexDict, serviceContext: serviceContextFromDefaults({ llm: new OpenAI({ model: "gpt-4", temperature: 0.5, topP: 0.8, }), }), }); await index.vectorStore.add(embeddingResults); if (!index.vectorStore.storesText) { await index.docStore.addDocuments(embeddingResults, true); } await index.indexStore?.addIndexStruct(indexDict); index.indexStruct = indexDict; const retriever = index.asRetriever(); retriever.similarityTopK = 20 ?? 2; const queryEngine = new RetrieverQueryEngine(retriever);`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/ts-playground#1