Skip to content

Commit

Permalink
Update model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Amruth-Vamshi authored Nov 7, 2023
1 parent 155f6b0 commit 19150c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/embeddings/openai/remote/model.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from request import ModelRequest
from openai import OpenAI

import os

class Model:
embedding_model = "text-embedding-ada-002"

def __new__(cls, context):
cls.context = context
if not hasattr(cls, 'instance'):
cls.instance = client = OpenAI(
cls.client = OpenAI(
api_key=os.getenv("OPENAI_API_KEY"),
)
cls.instance = super(Model, cls).__new__(cls)
Expand All @@ -19,7 +19,7 @@ async def inference(self, request: ModelRequest):
query = request.query

if(query != None):
embedding = client.embeddings.create(
embedding = self.client.embeddings.create(
input=query,
model=self.embedding_model,
).data[0].embedding
Expand Down

0 comments on commit 19150c7

Please sign in to comment.