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.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. Create a new file named `model_config.yaml` in the the same directory as the script
  15. to configure the model you want to use.
  16. For example, to use `gpt-4o` model from OpenAI, you can use the following configuration:
  17. ```yaml
  18. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  19. config:
  20. model: gpt-4o
  21. api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set
  22. ```
  23. To use `o3-mini-2025-01-31` model from OpenAI, you can use the following configuration:
  24. ```yaml
  25. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  26. config:
  27. model: o3-mini-2025-01-31
  28. api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set
  29. ```
  30. To use a locally hosted DeepSeek-R1:8b model using Ollama throught its compatibility endpoint,
  31. you can use the following configuration:
  32. ```yaml
  33. provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  34. config:
  35. model: deepseek-r1:8b
  36. base_url: http://localhost:11434/v1
  37. api_key: ollama
  38. model_info:
  39. function_calling: false
  40. json_output: false
  41. vision: false
  42. family: r1
  43. ```
  44. For more information on how to configure the model and use other providers,
  45. please refer to the [Models documentation](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/models.html).
  46. ## Run
  47. Run the following command to start the game:
  48. ```bash
  49. python main.py
  50. ```
  51. By default, the game will use a random agent to play against the AI agent.
  52. You can enable human vs AI mode by setting the `--human` flag:
  53. ```bash
  54. python main.py --human
  55. ```