Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add body indexing #27

Merged
merged 15 commits into from
Mar 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove multipleEmebddings commented code
plante-msft committed Mar 13, 2024
commit f27dd8c2e944acd57e67c6b59b161c4ed6f3bc2e
41 changes: 0 additions & 41 deletions backendsrc/embeddingsHandler.js
Original file line number Diff line number Diff line change
@@ -32,17 +32,6 @@ class embeddingsHandler {
if (encoding.length > 8192) {
description[0] = enc.decode(encoding.slice(0, 8000));
}

// if (inputIssues.length != 0) {
// const descriptions = inputIssues.map(issue => '# ' + issue.title + '\n\n' + issue.body);

// Check description and truncate if greater than 8192 tokens
// for (let i = 0; i < descriptions.length; i++) {
// const encoding = enc.encode(descriptions[i]);
// if (encoding.length > 8192) {
// descriptions[i] = enc.decode(encoding.slice(0, 8000));
// }
// }

let embeddingObject = null ;

@@ -56,14 +45,6 @@ class embeddingsHandler {

let embedding = embeddingObject.data[0].embedding;

// if (!issuesByRepo[inputIssue.repoRef.toString()]) {
// issuesByRepo[inputIssue.repoRef.toString()] = [];
// }
// issuesByRepo[inputIssue.repoRef.toString()].push({
// id: inputIssue._id.toString(),
// values: embedding,
// });

let payload = {
id: inputIssue._id.toString(),
values: embedding,
@@ -75,28 +56,6 @@ class embeddingsHandler {
await this.index.namespace(inputIssue.repoRef.toString()).upsert([payload]);
});

// Get list of issues grouped by repoRef with embeddings added
// for (let i = 0; i < inputIssues.length; i++) {
// let issue = inputIssues[i];
// let embedding = embeddings.data[i].embedding;
// if (!issuesByRepo[issue.repoRef.toString()]) {
// issuesByRepo[issue.repoRef.toString()] = [];
// }
// issuesByRepo[issue.repoRef.toString()].push({
// id: issue._id.toString(),
// values: embedding,
// });
// }

// Upsert embeddings into Pinecone
// for (const [repoRef, issues] of Object.entries(issuesByRepo)) {
// console.log("Upserting embeddings for issue number: " + issues[0].number);
// return await this.pineconeSemaphore.runExclusive(async () => {
// console.log("Semaphore acquired for issue number: " + issues[0].number);
// await this.index.namespace(repoRef).upsert(issues);
// });
// }

return true;
}