AashitaK commited on
Commit
cbd0cec
·
verified ·
1 Parent(s): 0262da9

Update openai_api.py

Browse files
Files changed (1) hide show
  1. openai_api.py +2 -5
openai_api.py CHANGED
@@ -21,14 +21,11 @@ def get_embedding(text: str, model: str=EMBEDDING_MODEL) -> list[float]:
21
  return result.data[0].embedding
22
 
23
 
24
- def get_response(prompt: str, model: str=COMPLETIONS_MODEL) -> str:
25
  """Chat completion using OpenAI's GPT models."""
26
  response = client.chat.completions.create(
27
  model=model,
28
- messages=[
29
- {"role": "system", "content": META_PROMPT},
30
- {"role": "user", "content": prompt}
31
- ],
32
  temperature=0,
33
  max_completion_tokens=800
34
  )
 
21
  return result.data[0].embedding
22
 
23
 
24
+ def get_response(messages: list[dict], model: str=COMPLETIONS_MODEL) -> str:
25
  """Chat completion using OpenAI's GPT models."""
26
  response = client.chat.completions.create(
27
  model=model,
28
+ messages=messages,
 
 
 
29
  temperature=0,
30
  max_completion_tokens=800
31
  )