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.

README.md 1.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Samples
  2. This directory contains sample apps that use AutoGen Core API.
  3. See [core user guide](../docs/src/user-guide/core-user-guide/) for notebook examples.
  4. See [Running the examples](#running-the-examples) for instructions on how to run the examples.
  5. - [`chess_game.py`](chess_game.py): an example with two chess player agents that executes its own tools to demonstrate tool use and reflection on tool use.
  6. - [`slow_human_in_loop.py`](slow_human_in_loop.py): an example showing human-in-the-loop which waits for human input before making the tool call.
  7. ## Running the examples
  8. ### Prerequisites
  9. First, you need a shell with AutoGen core and required dependencies installed.
  10. ### Using Azure OpenAI API
  11. For Azure OpenAI API, you need to set the following environment variables:
  12. ```bash
  13. export OPENAI_API_TYPE=azure
  14. export AZURE_OPENAI_API_ENDPOINT=your_azure_openai_endpoint
  15. export AZURE_OPENAI_API_VERSION=your_azure_openai_api_version
  16. ```
  17. By default, we use Azure Active Directory (AAD) for authentication.
  18. You need to run `az login` first to authenticate with Azure.
  19. You can also
  20. use API key authentication by setting the following environment variables:
  21. ```bash
  22. export AZURE_OPENAI_API_KEY=your_azure_openai_api_key
  23. ```
  24. This requires azure-identity installation:
  25. ```bash
  26. pip install azure-identity
  27. ```
  28. ### Using OpenAI API
  29. For OpenAI API, you need to set the following environment variables.
  30. ```bash
  31. export OPENAI_API_TYPE=openai
  32. export OPENAI_API_KEY=your_openai_api_key
  33. ```