Skip to content

Commit

Permalink
Updates on the extracted info
Browse files Browse the repository at this point in the history
  • Loading branch information
OgnjenFrancuski committed Oct 19, 2023
1 parent faf2d0a commit 839724a
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions rasa/dialogue_understanding/generator/llm_command_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,14 @@ def _generate_action_list_using_llm(self, prompt: str) -> Optional[str]:
if cb.total_tokens != 0:
costs = {
'total_tokens': cb.total_tokens,
'total_cost': cb.total_cost,

'prompt_tokens': cb.prompt_tokens,
'prompt_cost': cb.prompt_tokens / cb.total_tokens * cb.total_cost,

'completion_tokens': cb.total_tokens - cb.prompt_tokens,
'completion_cost': (cb.total_tokens - cb.prompt_tokens) / cb.total_tokens * cb.total_cost,

'successful_requests': cb.successful_requests
'completion_tokens': cb.completion_tokens,
}
else:
costs = {
'total_tokens': 0,
'total_cost': 0,
'prompt_tokens': 0,
'completion_tokens': 0,
'prompt_cost': 0,
'completion_cost': 0,
'successful_requests': 0
}
structlogger.info("llm_command_generator.llm.prompt", **costs)
return result, costs
Expand Down Expand Up @@ -204,7 +193,10 @@ def predict_commands(
meta.update(template_details)

# FINDING: Maybe here just open the file and store everything?
file_name = f"{message.data['metadata']['test_case']['name']}.jsonl"
# For test cases
# file_name = f"{message.data['metadata']['test_case']['name']}.jsonl"
# For long synthetic conversation
file_name = f"long_conversation.jsonl"

with open(os.path.join(BENCHMARKS_DIR_PATH, file_name), 'a') as outfile:
outfile.write(f"{json.dumps(meta)}\n")
Expand Down

0 comments on commit 839724a

Please sign in to comment.