Skip to content

Commit

Permalink
♻️ make it pep8 compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
tkv29 committed Jan 10, 2024
1 parent d02608e commit 87e5e3c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions tracex/extraction/prototype/create_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
client = OpenAI(api_key=u.oaik)




NEW_PROMPTS_CONTEXT = """
You are an expert prompt engineer for gpt-3.5-turbo. You are tasked with creating the best possible prompts for given tasks.
Your prompts should consist of three parts, one for the system, one for user and one for assistant.
Expand All @@ -22,10 +20,12 @@
{"role": "user", "content": NEW_PROMPTS_PROMPT},
{"role": "assistant", "content": NEW_PROMPTS_ANSWER},
]
new_prompts = client.chat.completions.create(model=u.MODEL,
messages=messages,
max_tokens=u.MAX_TOKENS,
temperature=u.TEMPERATURE_CREATION)
new_prompts = client.chat.completions.create(
model=u.MODEL,
messages=messages,
max_tokens=u.MAX_TOKENS,
temperature=u.TEMPERATURE_CREATION,
)
output = new_prompts.choices[0].message.content
with open(
(u.output_path / "new_prompts.txt"),
Expand Down
1 change: 0 additions & 1 deletion tracex/extraction/prototype/input_inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from . import prompts as p



def greeting():
"""Prints a greeting message."""
print(
Expand Down
9 changes: 6 additions & 3 deletions tracex/extraction/prototype/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def get_decision(question):
# output = response.choices[0].message.content
# return output

def query_gpt(messages, tools=fc.TOOLS, tool_choice="none", temperature=TEMPERATURE_SUMMARIZING):

def query_gpt(
messages, tools=fc.TOOLS, tool_choice="none", temperature=TEMPERATURE_SUMMARIZING
):
"""Queries the GPT engine."""
response = client.chat.completions.create(
model=MODEL,
Expand All @@ -66,5 +69,5 @@ def query_gpt(messages, tools=fc.TOOLS, tool_choice="none", temperature=TEMPERAT
output = response.choices[0].message.content
else:
api_response = response.choices[0].message.tool_calls[0].function.arguments
output = json.loads(api_response)['output'][0]
return output
output = json.loads(api_response)["output"][0]
return output

0 comments on commit 87e5e3c

Please sign in to comment.