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 2.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # AgentChat Chess Game
  2. This is a simple chess game that you can play with an AI agent.
  3. ## Setup
  4. Install the `chess` package with the following command:
  5. ```bash
  6. pip install "chess"
  7. ```
  8. To use OpenAI models or models hosted on OpenAI-compatible API endpoints,
  9. you need to install the `autogen-ext[openai]` package. You can install it with the following command:
  10. ```bash
  11. pip install "autogen-ext[openai]"
  12. # pip install "autogen-ext[openai,azure]" for Azure OpenAI models
  13. ```
  14. To run this sample, you will need to install the following packages:
  15. ```shell
  16. pip install -U autogen-agentchat pyyaml
  17. ```
  18. Create a new file named `model_config.yaml` in the the same directory as the script
  19. to configure the model you want to use.
  20. For example, to use `gpt-4o` model from OpenAI, you can use the following configuration:
  21. ```yaml
  22. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  23. config:
  24. model: gpt-4o
  25. api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set
  26. ```
  27. To use `o3-mini-2025-01-31` model from OpenAI, you can use the following configuration:
  28. ```yaml
  29. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  30. config:
  31. model: o3-mini-2025-01-31
  32. api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set
  33. ```
  34. To use a locally hosted DeepSeek-R1:8b model using Ollama throught its compatibility endpoint,
  35. you can use the following configuration:
  36. ```yaml
  37. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  38. config:
  39. model: deepseek-r1:8b
  40. base_url: http://localhost:11434/v1
  41. api_key: ollama
  42. model_info:
  43. function_calling: false
  44. json_output: false
  45. vision: false
  46. family: r1
  47. ```
  48. For more information on how to configure the model and use other providers,
  49. please refer to the [Models documentation](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/models.html).
  50. ## Run
  51. Run the following command to start the game:
  52. ```bash
  53. python main.py
  54. ```
  55. By default, the game will use a random agent to play against the AI agent.
  56. You can enable human vs AI mode by setting the `--human` flag:
  57. ```bash
  58. python main.py --human
  59. ```