Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Y1ran authored Sep 25, 2023
1 parent 272e3a3 commit d7e8dff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ def ChatGPT_request(prompts: object) -> object:

try:
# openai call
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompts}]
completion = openai.ChatCompletion.create(
engine="text-davinci-003",
prompt=prompt
)
reply = response["choices"][0]["message"]["content"]

# llama2 call
# response = completion(model="meta-llama/Llama-2-7b-hf",
Expand Down Expand Up @@ -82,10 +81,11 @@ def ChatGPT_turbo_request(prompt: str, gpt_parameter={}) -> object:
openai.api_key = random.choice(openai_api_key)

try:
completion = openai.ChatCompletion.create(
engine="text-davinci-003",
prompt=prompt
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompts}]
)

return completion["choices"][0]["message"]["content"]

except Exception as e:
Expand Down

0 comments on commit d7e8dff

Please sign in to comment.