You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

simple_chat.py 929 B

12345678910111213141516171819202122
  1. from autogen import ConversableAgent, UserProxyAgent, config_list_from_json
  2. def main():
  3. # Load LLM inference endpoints from an env variable or a file
  4. # See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints
  5. # and OAI_CONFIG_LIST_sample.
  6. # For example, if you have created a OAI_CONFIG_LIST file in the current working directory, that file will be used.
  7. config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
  8. # Create the agent that uses the LLM.
  9. assistant = ConversableAgent("agent", llm_config={"config_list": config_list})
  10. # Create the agent that represents the user in the conversation.
  11. user_proxy = UserProxyAgent("user", code_execution_config=False)
  12. # Let the assistant start the conversation. It will end when the user types exit.
  13. assistant.initiate_chat(user_proxy, message="How can I help you today?")
  14. if __name__ == "__main__":
  15. main()