Skip to content

Commit

Permalink
hot fix on energy wizard ref print
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Nov 2, 2023
1 parent 32b6b13 commit c7026b1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions elm/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ def chat(self, query,
Question being asked of EnergyWizard
debug : bool
Flag to return extra diagnostics on the engineered question.
stream : bool
Flag to print subsequent chunks of the response in a streaming
fashion
temperature : float
GPT model temperature, a measure of response entropy from 0 to 1. 0
is more reliable and nearly deterministic; 1 will give the model
Expand Down Expand Up @@ -286,14 +289,17 @@ def chat(self, query,
else:
response_message = response["choices"][0]["message"]["content"]

if stream and print_references and any(references):
print('\n\nThe model was provided with the following documents to '
'support its answer:')
print(' - ' + '\n - '.join(references))

self.messages.append({'role': 'assistant',
'content': response_message})

if any(references) and print_references:
ref_msg = ('\n\nThe model was provided with the '
'following documents to support its answer:')
ref_msg += '\n - ' + '\n - '.join(references)
response_message += ref_msg
if stream:
print(ref_msg)

if debug:
return response_message, query, references
else:
Expand Down

0 comments on commit c7026b1

Please sign in to comment.