Skip to content

Commit

Permalink
Fixed connection error with pinecone
Browse files Browse the repository at this point in the history
  • Loading branch information
craigloewen-msft committed Apr 10, 2024
1 parent d4c44bc commit 31fe41c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions backendsrc/embeddingsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ class embeddingsHandler {

constructor(inConfigObject) {
// Set up azureClient and Pinecone
this.azureClient = new OpenAIClient(inConfigObject.azureEndpointURL, new AzureKeyCredential(inConfigObject.azureOpenAIAPIKey), { apiVersion: "2023-05-15" });
this.pinecone = new Pinecone({
environment: "gcp-starter",
apiKey: inConfigObject.pineconeAPIKey,
});
this.index = this.pinecone.Index(embeddingsHandler.indexName);
this.maxConcurrentRequests = 3;
this.maxConcurrentRequests = 1;
this.pineconeSemaphore = new Semaphore(this.maxConcurrentRequests);
this.azureSemaphore = new Semaphore(this.maxConcurrentRequests);

this.debugDisableEmbeddings = inConfigObject.debugDisableEmbeddings;
if (!this.debugDisableEmbeddings) {
this.pinecone = new Pinecone({
environment: "gcp-starter",
apiKey: inConfigObject.pineconeAPIKey,
});
this.azureClient = new OpenAIClient(inConfigObject.azureEndpointURL, new AzureKeyCredential(inConfigObject.azureOpenAIAPIKey), { apiVersion: "2023-05-15" });
this.index = this.pinecone.Index(embeddingsHandler.indexName);
}
}

async addEmbedding(inputIssue) {
Expand Down

0 comments on commit 31fe41c

Please sign in to comment.