Skip to content

Commit

Permalink
fix: handle claude 3 haiku output
Browse files Browse the repository at this point in the history
  • Loading branch information
elisalimli committed Apr 24, 2024
1 parent a7c60b4 commit fcd791d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/superagent/app/agents/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ def _cleanup_output(self, output):
xml_output = "<root>" + output + "</root>"
output = xml_parse(xml_output)
output = output["root"]
if "result" in output:
output = output.get("result")

if isinstance(output, str):
return output
else:
output = output.get("#text")
if "result" in output:
output = output.get("result")
else:
output = output.get("#text")
return output

def _transform_completion_to_streaming(self, res, **kwargs):
Expand Down

0 comments on commit fcd791d

Please sign in to comment.