Skip to content

Commit

Permalink
changed "data" of the http request
Browse files Browse the repository at this point in the history
  • Loading branch information
zibiax committed May 3, 2024
1 parent c98bc80 commit 0dfa321
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions test_draftgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ def draft_gpt(user_input, openai_api_key=os.environ["OPENAI_API_KEY"], gpt_model
"Authorization": f"Bearer {openai_api_key}",
}



data = {
"model": gpt_model,
"messages": [
{"role": "system", "content": "You are responsible for analyzing incident root causes at a software engineering company. Your tasks include extracting messages from users and systems and then determining the root cause of the incident in the incident report."},
{
"role": "user",
"content": user_input,
},
],
}
if gpt_model[:2] == "gpt":
url = "https://api.openai.com/v1/chat/completions"

Expand All @@ -74,17 +86,22 @@ def draft_gpt(user_input, openai_api_key=os.environ["OPENAI_API_KEY"], gpt_model
"Authorization": f"Bearer {openai_api_key}",
"OpenAI-Beta": "assistants=v2"
}
data = {

data = {
"model": gpt_model,
"messages": [
{"role": "system", "content": "You are responsible for analyzing incident root causes at a software engineering company. Your tasks include extracting messages from users and systems and then determining the root cause of the incident in the incident report."},
{
"role": "user",
"content": user_input,
},
],
"messages":[
{
"role": "user",
"content": user_input,
"attachments": [
{
"tools": [{"type": "code_interpreter"}]
}
]
}
]
}


response = requests.post(url, headers=headers, json=data)
# Check if the request was successful
Expand Down

0 comments on commit 0dfa321

Please sign in to comment.