Skip to content

Commit

Permalink
Merge pull request #270 from VesnaT/gpt_temperature
Browse files Browse the repository at this point in the history
Chat GPT: Set temperature to 0, fix cache
  • Loading branch information
VesnaT authored Dec 20, 2023
2 parents 28b71bb + 90a39f7 commit aca2709
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion orangecontrib/prototypes/widgets/owchatgptbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def run_gpt(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": content},
]
],
temperature=0
)
return response.choices[0].message.content

Expand Down
6 changes: 3 additions & 3 deletions orangecontrib/prototypes/widgets/owchatgptconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def ask_gpt(self, state) -> List:
if state.is_interruption_requested():
raise Exception

args = (text.strip(),
args = (MODELS[self.model_index],
text.strip(),
self.prompt_start.strip(),
self.prompt_end.strip())
if args in self.cache:
answer = self.cache[args]
else:
try:
answer = run_gpt(self.access_key, MODELS[self.model_index],
*args)
answer = run_gpt(self.access_key, *args)
self.cache[args] = answer
except Exception as ex:
answer = ex
Expand Down

0 comments on commit aca2709

Please sign in to comment.