Skip to content

Commit

Permalink
➕ Upgrade to gtp-4o
Browse files Browse the repository at this point in the history
  • Loading branch information
beverage committed Aug 12, 2024
1 parent c328526 commit fd2592e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/dbtest/ai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class AsyncChatGPTClient:

def __init__(self, model: str="gpt-3.5-turbo", role: str="user", api_key: str=None):
def __init__(self, model: str="gpt-4o", role: str="user", api_key: str=None):
self.api_key = environ.get("OPENAI_API_KEY") if api_key is None else api_key
self.client = openai.AsyncOpenAI(api_key=api_key)
self.model = model
Expand Down
8 changes: 4 additions & 4 deletions src/dbtest/sentences/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ async def create_sentence(verb_infinitive: str,
sentence.is_correct = is_correct

# Sentence features:
sentence.direct_object = DirectObject[direct_object]
sentence.indirect_pronoun = IndirectPronoun[indirect_pronoun]
sentence.negation = Negation[negation]
sentence.direct_object = direct_object
sentence.indirect_pronoun = indirect_pronoun
sentence.negation = negation

generator: SentencePromptGenerator = SentencePromptGenerator()
prompt: str = generator.generate_sentence_prompt(sentence)

logging.debug(prompt)
response: str = await openai_client.handle_request(prompt=prompt)
logging.debug(response)
logging.debug("response: " + response)
response_json = json.loads(response)
logging.debug(response_json)

Expand Down
2 changes: 1 addition & 1 deletion src/dbtest/sentences/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __transform_nouns_to_pronouns(self):
return "Transform any COD and COI nouns in the sentence into their respective pronouns."

def __json_format(self):
return """The response should be returned as json in the format:
return """The response should be returned as raw json in the format. All five fields must be present. Do not wrap the json codes in JSON markers.
{
"sentence": "",
"translation": "",
Expand Down

0 comments on commit fd2592e

Please sign in to comment.