Skip to content

Commit

Permalink
Update indexer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed Jan 21, 2025
1 parent 5e355bf commit 51443b4
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions api/src/libs/indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const chromaClient = new ChromaClient({
});

const collection = await chromaClient.getOrCreateCollection({
name: process.env.CHROMA_COLLECTION_NAME || "index_mainnet",
name: process.env.CHROMA_COLLECTION_NAME || "index_mainnet_v3",
});


Expand Down Expand Up @@ -126,23 +126,7 @@ class Indexer {
model: process.env.MODEL_EMBEDDING,
input: docText,
});



/*
const embeddingService = new EmbeddingService(this.definition).setSession(
indexSession,
);
const embedding = await embeddingService.createEmbedding({
indexId: indexItem.indexId,
itemId: indexItem.itemId,
modelName: process.env.MODEL_EMBEDDING,
category: "document",
vector: embeddingResponse.data[0].embedding,
description: "Default document embeddings",
});
*/

console.log({
ids: [indexItem.itemId],
Expand Down Expand Up @@ -173,6 +157,19 @@ class Indexer {
}]
});

const embeddingService = new EmbeddingService(this.definition).setSession(
indexSession,
);
const embedding = await embeddingService.createEmbedding({
indexId: indexItem.indexId,
itemId: indexItem.itemId,
modelName: process.env.MODEL_EMBEDDING,
category: "document",
vector: embeddingResponse.data[0].embedding,
description: "Default document embeddings",
});


try {
const updatePayload = {
vector: embeddingResponse.data[0].embedding,
Expand Down

0 comments on commit 51443b4

Please sign in to comment.