Setup Development Environment
Setting up LLM Keys#
If you are contributing to the AG2 project, you will need an LLM key depending on the submodule you are working on.
OAI_CONFIG_LIST
in JSON format to store the LLM keys. OAI_CONFIG_LIST
is a list of dictionaries where each dictionary contains the following keys: - model
(required): The name of the OpenAI/LLM model. - api_key
(optional): The API key for the OpenAI/LLM model. - api_type
(optional): The type of the API key. It is used for non-OpenAI LLMs. - api_version
(optional): The version of the API key. It is used for Azure API. - base_url
(optional): The base URL for the OpenAI/LLM model. - tags
(optional): A list of tags for the OpenAI/LLM model which can be used for filtering.
Following is an example of the `OAI_CONFIG_LIST` in JSON format which consists of two OpenAI models and a gemini model:
```bash
[
{
"model": "gpt-4o",
"api_key": "<your_api_key>",
"tags": ["gpt-4o", "tool", "vision"]
},
{
"model": "gpt-4o-mini",
"api_key": "<your_api_key>",
"tags": ["gpt-4o-mini", "tool", "vision"]
},
{
"api_type": "google",
"model": "gemini-pro",
"api_key": "<your_gemini_api_key>",
}
]
```
Further, this `OAI_CONFIG_LIST` can be set in two ways:
<Tabs>
<Tab title="As environment variable">
Simply set the `OAI_CONFIG_LIST` environment variable in your terminal:
```bash
export OAI_CONFIG_LIST='[{"api_type": "openai", "model": "gpt-4o","api_key": "<your_api_key>","tags": ["gpt-4o", "tool", "vision"]},{"api_type": "openai", "model": "gpt-4o-mini","api_key": "<your_api_key>","tags": ["gpt-4o-mini", "tool", "vision"]},{"api_type": "google", "model": "gemini-pro","api_key": "<your_gemini_api_key>",}]'
```
</Tab>
<Tab title="As file">
Or you can save the `OAI_CONFIG_LIST` in a file and set the path of the file as an environment variable.
For example, let's say you have saved the `OAI_CONFIG_LIST` in a file called `OAI_CONFIG_LIST.json` at the root of the project. You can set the `OAI_CONFIG_LIST` environment variable as follows:
```bash
export OAI_CONFIG_LIST="/path/to/OAI_CONFIG_LIST.json"
```
</Tab>
</Tabs>
<div class="tip">
!!! tip
Learn more about OAI_CONFIG_LIST
[here](/docs/user-guide/advanced-concepts/llm-configuration-deep-dive).
</div>
bash export GEMINI_API_KEY="<your_api_key>"
Setting up the Development Environment#
To contribute to the AG2 project, AG2 provides three different methods to set up the development environment:
Ctrl+Shift+P
and select Dev Containers: Reopen in Container
. 5. Select the desired python environment and wait for the container to build. 6. Once the container is built, you can start developing AG2. New repository secret
button. 4. Navigate back to the forked repository. 5. Click on the Code
button and select Open with Codespaces
. 6. Once the container is built, you can start developing AG2. Verifying the Development Environment#
To make sure that we have set up the development environment correctly, we can run the pre-commit hooks and tests.
To run the pre-commit hooks, run the following command:
To run the non-llm tests, run the following command: