I am trying to create a simple conversational AI using autogen.
where user should able to continuesly interact with the agent
Below is the code
~~~
def get_location_suggestion() -> str:
planner = AssistantAgent(
name="Planner",
system_message="""
You are a travel assistant. Provide helps in providing detaila about the location they asked.
Do NOT execute SQL.
""",
llm_config=llm_config
)
user = UserProxyAgent(
name = "User",
human_input_mode="NEVER",
max_consecutive_auto_reply=1,
is_termination_msg=lambda msg: True,
code_execution_config=False
)
while True:
user_input = input("You: ")
if user_input.lower() in {"exit", "quit"}:
print("Session End")
break
user.send(
message=user_input,
recipient=planner,
silent=True,
request_reply=True
)
chat_result = user.initiate_chat(
planner,
message=user_input,
silent=True,
clear_history=False
)
print("chat_result is")
answer = chat_result.chat_history
return f"Planner: {answer}\n"
if __name__ == "__main__":
response = get_location_suggestion()
print(response)
~~~
what i can see when i am running this application
~~~
You: can you give some details about Goa ?
\>>>>>>>> TERMINATING RUN (ed46c20c-4cc3-48dc-8333-9e0aa4b0db69): Termination message condition on agent 'User' met
You: hello
~~~
it seems planner not able to respond back to the user query even
print("chat_result is") is blank