Skip to content

Rewrite and consolidate configuration docs #1581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e256ad4
Rewrite and consolidate configuration docs
jackgerrits Feb 7, 2024
1f39d9a
Merge branch 'main' into redo_config_docs
jackgerrits Feb 7, 2024
ba92851
add link to filtering
jackgerrits Feb 7, 2024
53efec2
updates based on comments
jackgerrits Feb 7, 2024
f225e52
update lockfile
jackgerrits Feb 7, 2024
ccd4aaf
update redirect
jackgerrits Feb 7, 2024
dd450a9
spelling mistake
jackgerrits Feb 7, 2024
cd68903
update the noqa
jackgerrits Feb 7, 2024
03eb790
update links
jackgerrits Feb 7, 2024
381e8f1
fix broken links
jackgerrits Feb 7, 2024
d570216
lint fixes
jackgerrits Feb 7, 2024
85debf8
address comments
jackgerrits Feb 7, 2024
9a2c637
update wording about model selection
jackgerrits Feb 7, 2024
4a74b5a
update cache_seed and json pattern
jackgerrits Feb 7, 2024
c79f349
add periods
jackgerrits Feb 7, 2024
3a3835a
Update the config json func and other small changes
jackgerrits Feb 7, 2024
436696f
update wording of json string
jackgerrits Feb 8, 2024
ecdb827
update intro
jackgerrits Feb 8, 2024
ce7f076
update description of caching
jackgerrits Feb 8, 2024
ac36171
Merge branch 'main' into redo_config_docs
jackgerrits Feb 8, 2024
e065ded
fix link
jackgerrits Feb 8, 2024
3dece4f
spelling mistake
jackgerrits Feb 8, 2024
3134023
Merge branch 'main' into redo_config_docs
jackgerrits Feb 8, 2024
766cd66
fix llm config
jackgerrits Feb 8, 2024
52334e7
Update website/docs/llm_configuration.ipynb
jackgerrits Feb 8, 2024
d54f4f9
Merge branch 'main' into redo_config_docs
jackgerrits Feb 8, 2024
fd159e2
Add examples back as notebook
jackgerrits Feb 9, 2024
7d363e4
Merge branch 'main' into redo_config_docs
AaronWard Feb 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebook/agentchat_RetrieveChat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"source": [
"\\:\\:\\:tip\n",
"\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_endpoint_configuration).\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_configuration).\n",
"\n",
"\\:\\:\\:"
]
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_auto_feedback_from_code_execution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source": [
"\\:\\:\\:tip\n",
"\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_endpoint_configuration).\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_configuration).\n",
"\n",
"\\:\\:\\:"
]
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_cost_token_tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_function_call.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_function_call_async.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source": [
"\\:\\:\\:tip\n",
"\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_endpoint_configuration).\n",
"Learn more about the various ways to configure LLM endpoints [here](/docs/llm_configuration).\n",
"\n",
"\\:\\:\\:"
]
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_function_call_currency_calculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_groupchat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_groupchat_RAG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_groupchat_research.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_groupchat_vis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_human_feedback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_langchain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_oai_assistant_groupchat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"]\n",
"```\n",
"\n",
"Currently Azure OpenAI does not support assistant api. You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"Currently Azure OpenAI does not support assistant api. You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_stream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/agentchat_two_users.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"]\n",
"```\n",
"\n",
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_endpoint_configuration.ipynb) for full code examples of the different methods."
"You can set the value of config_list in any way you prefer. Please refer to this [notebook](https://github.com/microsoft/autogen/blob/main/website/docs/llm_configuration.ipynb) for full code examples of the different methods."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebook/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Then after the code cell where this is used, include the following markdown snip
```
\:\:\:tip

Learn more about the various ways to configure LLM endpoints [here](/docs/llm_endpoint_configuration).
Learn more about the various ways to configure LLM endpoints [here](/docs/llm_configuration).

\:\:\:
```
2 changes: 1 addition & 1 deletion website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package-lock.json
docs/reference
/docs/notebooks

docs/llm_endpoint_configuration.mdx
docs/llm_configuration.mdx

# Misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion website/docs/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Links to notebook examples:
## Enhanced Inferences
### Utilities
- API Unification - [View Documentation with Code Example](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference/#api-unification)
- Utility Functions to Help Managing API configurations effectively - [View Notebook](/docs/llm_endpoint_configuration)
- Utility Functions to Help Managing API configurations effectively - [View Notebook](/docs/llm_configuration)
- Cost Calculation - [View Notebook](https://github.com/microsoft/autogen/blob/main/notebook/oai_client_cost.ipynb)

### Inference Hyperparameters Tuning
Expand Down
58 changes: 3 additions & 55 deletions website/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,15 @@

## Set your API endpoints

Autogen relies on 3rd party API endpoints for LLM inference. It works great with OpenAI and Azure OpenAI models, and can work with any model (self-hosted or local) that is accessible through an inference server compatible with OpenAI Chat Completions API.

An agent requires a list of configuration dictionaries for setting up model endpoints. Each configuration dictionary can contain the following keys:
- `model` (str): Required. The identifier of the model to be used, such as 'gpt-4', 'gpt-3.5-turbo', or 'llama-7B'.
- `api_key` (str): Optional. The API key required for authenticating requests to the model's API endpoint.
- `api_type` (str): Optional. The type of API service being used. This could be 'azure' for Azure Cognitive Services, 'openai' for OpenAI, or other custom types.
- `base_url` (str): Optional. The base URL of the API endpoint. This is the root address where API calls are directed.
- `api_version` (str): Optional. The version of the Azure API you wish to use

For example:
```python
config_list = [
{
"model": "gpt-4",
"api_key": os.environ.get("AZURE_OPENAI_API_KEY"),
"api_type": "azure",
"base_url": os.environ.get("AZURE_OPENAI_API_BASE"),
"api_version": "2023-12-01-preview",
},
{
"model": "llama-7B",
"base_url": "http://127.0.0.1:8080",
"api_type": "openai",
}
]
```

In `autogen` module there are [multiple helper functions](/docs/reference/oai/openai_utils) allowing to construct configurations using different sources:

- `get_config_list`: Generates configurations for API calls, primarily from provided API keys.
- `config_list_openai_aoai`: Constructs a list of configurations using both Azure OpenAI and OpenAI endpoints, sourcing API keys from environment variables or local files.
- `config_list_from_json`: Loads configurations from a JSON structure, either from an environment variable or a local JSON file, with the flexibility of filtering configurations based on given criteria.
- `config_list_from_models`: Creates configurations based on a provided list of models, useful when targeting specific models without manually specifying each configuration.
- `config_list_from_dotenv`: Constructs a configuration list from a `.env` file, offering a consolidated way to manage multiple API configurations and keys from a single file.

We suggest that you take a look at this [notebook](/docs/llm_endpoint_configuration) for full code examples of the different methods to configure your model endpoints.
This documentation has been moved [here](/docs/llm_configuration).

### Use the constructed configuration list in agents

Make sure the "config_list" is included in the `llm_config` in the constructor of the LLM-based agent. For example,
```python
assistant = autogen.AssistantAgent(
name="assistant",
llm_config={"config_list": config_list}
)
```

The `llm_config` is used in the [`create`](/docs/reference/oai/client#create) function for LLM inference.
When `llm_config` is not provided, the agent will rely on other openai settings such as `openai.api_key` or the environment variable `OPENAI_API_KEY`, which can also work when you'd like to use a single endpoint.
You can also explicitly specify that by:
```python
assistant = autogen.AssistantAgent(name="assistant", llm_config={"api_key": ...})
```
This documentation has been moved [here](/docs/llm_configuration).

### How does an agent decide which model to pick out of the list?

An agent uses the very first model available in the "config_list" and makes LLM calls against this model. If the model fail (e.g. API throttling) the agent will retry the request against the 2nd model and so on until prompt completion is received (or throws an error if none of the models successfully completes the request). There's no implicit/hidden logic inside agents that is used to pick "the best model for the task". It is developers responsibility to pick the right models and use them with agents.

Besides throttling/rotating models the 'config_list' can be useful for:
- Having a single global list of models and [filtering it](/docs/reference/oai/openai_utils/#filter_config) based on certain keys (e.g. name, tag) in order to pass select models into a certain agent (e.g. use cheaper GPT 3.5 for agents solving easier tasks)
- Using more advanced features for special purposes related to inference, such as `filter_func` with [`OpenAIWrapper`](/docs/reference/oai/client#create) or [inference optimization](/docs/Examples#enhanced-inferences)
This documentation has been moved [here](/docs/llm_configuration#how-does-an-agent-decide-which-model-to-pick-out-of-the-list).

### Unexpected keyword argument 'base_url'

Expand Down
2 changes: 1 addition & 1 deletion website/docs/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AutoGen is powered by collaborative [research studies](/docs/Research) from Micr

### Quickstart

Install from pip: `pip install pyautogen`. Find more options in [Installation](/docs/Installation).
Install from pip: `pip install pyautogen`. Find more options in [Installation](/docs/installation/).
For [code execution](/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.

#### Multi-Agent Conversation Framework
Expand Down
2 changes: 1 addition & 1 deletion website/docs/Use-Cases/enhanced_inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ For convenience, we provide a number of utility functions to load config lists.
- `config_list_from_models`: Creates configurations based on a provided list of models, useful when targeting specific models without manually specifying each configuration.
- `config_list_from_dotenv`: Constructs a configuration list from a `.env` file, offering a consolidated way to manage multiple API configurations and keys from a single file.

We suggest that you take a look at this [notebook](/docs/llm_endpoint_configuration) for full code examples of the different methods to configure your model endpoints.
We suggest that you take a look at this [notebook](/docs/llm_configuration) for full code examples of the different methods to configure your model endpoints.

### Logic error

Expand Down
Loading