rasmus1610 commited on
Commit
3e22b88
1 Parent(s): 627653b

did openai really change their api?

Browse files
Files changed (1) hide show
  1. llm.py +4 -2
llm.py CHANGED
@@ -1,8 +1,10 @@
1
- import openai
2
  import os
3
 
4
  openai.api_key = os.environ["OPENAI_API_KEY"]
5
 
 
 
6
  class BaseLLM:
7
  def __init__(self, model):
8
  self.model = model
@@ -16,7 +18,7 @@ class OpenAILLM(BaseLLM):
16
  self.model = model
17
 
18
  def get_response(self, system_prompt, query, **kwargs):
19
- response = openai.ChatCompletion.create(
20
  model=self.model,
21
  messages=[
22
  {"role": "system", "content": system_prompt},
 
1
+ from openai import OpenAI
2
  import os
3
 
4
  openai.api_key = os.environ["OPENAI_API_KEY"]
5
 
6
+ client = OpenAI()
7
+
8
  class BaseLLM:
9
  def __init__(self, model):
10
  self.model = model
 
18
  self.model = model
19
 
20
  def get_response(self, system_prompt, query, **kwargs):
21
+ response = client.chat.completions.create(
22
  model=self.model,
23
  messages=[
24
  {"role": "system", "content": system_prompt},