Skip to content

Commit

Permalink
See why it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Oct 5, 2023
1 parent 25f16c1 commit ddccb91
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/neurolibre_celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,12 @@ def generate():
gpt_headers = {'Content-Type': 'application/json','Authorization': f"Bearer {token}"}
gpt_payload = {'model':'gpt-3.5-turbo',
"messages": [{"role": "user", "content": gpt_msg}]}
print("Trying openai API")
logging.info("Trying openai API")
gpt_response = requests.post('https://api.openai.com/v1/chat/completions',headers=gpt_headers,json=gpt_payload)
completion = json.loads(gpt_response.text)
print(f"{completion}")
print(f"{completion['choices'][0]['message']['content']}")
issue_comment = f":confetti_ball::confetti_ball::confetti_ball: \n {completion['choices'][0]['message']['content']} \n :hibiscus: Take a loot at the [latest version of your NRP]({book_status[0]['book_url']})!"
except:
except Exception as e:
logging.info(f"{str(e)}")
issue_comment = f":confetti_ball::confetti_ball::confetti_ball: Good news! \n :hibiscus: Take a loot at the [latest version of your NRP]({book_status[0]['book_url']})"
gh_create_comment(github_client, payload['review_repository'],payload['issue_id'],issue_comment)

Expand Down

0 comments on commit ddccb91

Please sign in to comment.