double response flow fix

pull/162/head
Kye 1 year ago
parent be62f09bb5
commit 0929e9c68d

@ -19,10 +19,12 @@ openai_api_key = os.getenv("OPENAI_API_KEY")
# Base llms # Base llms
llm1 = OpenAIChat( llm1 = OpenAIChat(
openai_api_key=openai_api_key, openai_api_key=openai_api_key,
max_tokens=5000,
) )
llm2 = Anthropic( llm2 = Anthropic(
anthropic_api_key=anthropic_api_key, anthropic_api_key=anthropic_api_key,
max_tokens=5000,
) )
@ -59,16 +61,16 @@ print(pdf_text)
fraud_detection_agent_output = doc_analyzer_agent.run( fraud_detection_agent_output = doc_analyzer_agent.run(
f"{fraud_detection_instructions}: {pdf_text}" f"{fraud_detection_instructions}: {pdf_text}"
) )
print(fraud_detection_agent_output) # print(fraud_detection_agent_output)
# Generate an actionable summary of the document # Generate an actionable summary of the document
summary_agent_output = summary_generator_agent.run( summary_agent_output = summary_generator_agent.run(
f"{summary_agent_instructions}: {fraud_detection_agent_output}" f"{summary_agent_instructions}: {fraud_detection_agent_output}"
) )
print(summary_agent_output) # print(summary_agent_output)
# Provide decision making support to the accountant # Provide decision making support to the accountant
decision_making_support_agent_output = decision_making_support_agent.run( decision_making_support_agent_output = decision_making_support_agent.run(
f"{decision_making_support_agent_instructions}: {summary_agent_output}" f"{decision_making_support_agent_instructions}: {summary_agent_output}"
) )
print(decision_making_support_agent_output) # print(decision_making_support_agent_output)

@ -457,7 +457,7 @@ class Flow:
else: else:
print(f"AI: {response}") print(f"AI: {response}")
history.append(f"AI: {response}") history.append(f"AI: {response}")
print(response) # print(response)
break break
except Exception as e: except Exception as e:
logging.error(f"Error generating response: {e}") logging.error(f"Error generating response: {e}")

Loading…
Cancel
Save