Skip to content

Commit

Permalink
Remove duplicated function
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Feb 18, 2025
1 parent 245daf6 commit ebeb663
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/yellowhammer/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,6 @@ def error_parser(output):
return output["parsed"]


def error_parser(output):
"""
Parse the API output to handle errors gracefully.
"""
if output["parsing_error"]:
raw_output = str(output["raw"].content)
error = output["parsing_error"]
out_string = f"Error parsing LLM output. Parse error: {error}. \n Raw output: {raw_output}"
return FinalResponse(final_output=ConversationalResponse(response=out_string))

elif not output["parsed"]:
raw_output = str(output["raw"].content)
out_string = f"Error in LLM response. \n Raw output: {raw_output}"
return FinalResponse(final_output=ConversationalResponse(response=out_string))

else:
# Return the parsed output (should be FinalResponse)
return output["parsed"]


def get_chain(
messages, # ChatPromptTemplate
api_provider,
Expand Down

0 comments on commit ebeb663

Please sign in to comment.