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.

contributing.md 3.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Contributing
  2. ## How to get a notebook displayed on the website
  3. In the notebook metadata set the `tags` and `description` `front_matter` properties. For example:
  4. ```json
  5. {
  6. "...": "...",
  7. "metadata": {
  8. "...": "...",
  9. "front_matter": {
  10. "tags": ["code generation", "debugging"],
  11. "description": "Use conversable language learning model agents to solve tasks and provide automatic feedback through a comprehensive example of writing, executing, and debugging Python code to compare stock price changes."
  12. }
  13. }
  14. }
  15. ```
  16. **Note**: Notebook metadata can be edited by opening the notebook in a text editor (Or "Open With..." -> "Text Editor" in VSCode)
  17. The `tags` field is a list of tags that will be used to categorize the notebook. The `description` field is a brief description of the notebook.
  18. ## Best practices for authoring notebooks
  19. The following points are best practices for authoring notebooks to ensure consistency and ease of use for the website.
  20. - The Colab button will be automatically generated on the website for all notebooks where it is missing. Going forward, it is recommended to not include the Colab button in the notebook itself.
  21. - Ensure the header is a `h1` header, - `#`
  22. - Don't put anything between the yaml and the header
  23. ### Consistency for installation and LLM config
  24. You don't need to explain in depth how to install AutoGen. Unless there are specific instructions for the notebook just use the following markdown snippet:
  25. ``````
  26. ````{=mdx}
  27. :::info Requirements
  28. Install `pyautogen`:
  29. ```bash
  30. pip install pyautogen
  31. ```
  32. For more information, please refer to the [installation guide](/docs/installation/).
  33. :::
  34. ````
  35. ``````
  36. Or if extras are needed:
  37. ``````
  38. ````{=mdx}
  39. :::info Requirements
  40. Some extra dependencies are needed for this notebook, which can be installed via pip:
  41. ```bash
  42. pip install pyautogen[retrievechat] flaml[automl]
  43. ```
  44. For more information, please refer to the [installation guide](/docs/installation/).
  45. :::
  46. ````
  47. ``````
  48. When specifying the config list, to ensure consistency it is best to use approximately the following code:
  49. ```python
  50. import autogen
  51. config_list = autogen.config_list_from_json(
  52. env_or_file="OAI_CONFIG_LIST",
  53. )
  54. ```
  55. Then after the code cell where this is used, include the following markdown snippet:
  56. ``````
  57. ````{=mdx}
  58. :::tip
  59. Learn more about configuring LLMs for agents [here](/docs/topics/llm_configuration).
  60. :::
  61. ````
  62. ``````
  63. ## Testing
  64. Notebooks can be tested by running:
  65. ```sh
  66. python website/process_notebooks.py test
  67. ```
  68. This will automatically scan for all notebooks in the notebook/ and website/ dirs.
  69. To test a specific notebook pass its path:
  70. ```sh
  71. python website/process_notebooks.py test notebook/agentchat_logging.ipynb
  72. ```
  73. Options:
  74. - `--timeout` - timeout for a single notebook
  75. - `--exit-on-first-fail` - stop executing further notebooks after the first one fails
  76. ### Skip tests
  77. If a notebook needs to be skipped then add to the notebook metadata:
  78. ```json
  79. {
  80. "...": "...",
  81. "metadata": {
  82. "skip_test": "REASON"
  83. }
  84. }
  85. ```
  86. ## Metadata fields
  87. All possible metadata fields are as follows:
  88. ```json
  89. {
  90. "...": "...",
  91. "metadata": {
  92. "...": "...",
  93. "front_matter": {
  94. "tags": "List[str] - List of tags to categorize the notebook",
  95. "description": "str - Brief description of the notebook",
  96. },
  97. "skip_test": "str - Reason for skipping the test. If present, the notebook will be skipped during testing",
  98. "skip_render": "str - Reason for skipping rendering the notebook. If present, the notebook will be left out of the website.",
  99. "extra_files_to_copy": "List[str] - List of files to copy to the website. The paths are relative to the notebook directory",
  100. }
  101. }
  102. ```