> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.filter_config

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### filter\_config

```python theme={null}
filter_config(
    config_list: list[dict[str, Any]],
    filter_dict: dict[str, list[str | None] | set[str | None]] | None,
    exclude: bool = False
) -> list[dict[str, Any]]
```

This function filters `config_list` by checking each configuration dictionary against the criteria specified in
`filter_dict`. A configuration dictionary is retained if for every key in `filter_dict`, see example below.<br />

<b>Parameters:</b>

| Name          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config_list` | A list of configuration dictionaries to be filtered.<br /><br />**Type:** list\[dict\[str, typing.Any]]                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `filter_dict` | A dictionary representing the filter criteria, where each key is a field name to check within the configuration dictionaries, and the corresponding value is a list of acceptable values for that field.<br /><br />If the configuration's field's value is not a list, then a match occurs when it is found in the list of acceptable values.<br /><br />If the configuration's field's value is a list, then a match occurs if there is a non-empty intersection with the acceptable values.<br /><br />**Type:** dict\[str, list\[str \| None] \| set\[str \| None]] \| None |
| `exclude`     | If False (the default value), configs that match the filter will be included in the returned list.<br /><br />If True, configs that match the filter will be excluded in the returned list.<br /><br />**Type:** bool<br /><br />**Default:** False                                                                                                                                                                                                                                                                                                                             |

<b>Returns:</b>

| Type                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| list\[dict\[str, typing.Any]] | list of dict: A list of configuration dictionaries that meet all the criteria specified in `filter_dict`. Example: ``python # Example configuration list with various models and API types configs = [ \{"model": "gpt-3.5-turbo"}, \{"model": "gpt-4"}, \{"model": "gpt-3.5-turbo", "api_type": "azure"}, \{"model": "gpt-3.5-turbo", "tags": ["gpt35_turbo", "gpt-35-turbo"]}, ] # Define filter criteria to select configurations for the 'gpt-3.5-turbo' model # that are also using the 'azure' API type filter_criteria = \{ "model": ["gpt-3.5-turbo"], # Only accept configurations for 'gpt-3.5-turbo' "api_type": ["azure"], # Only accept configurations for 'azure' API type } # Apply the filter to the configuration list filtered_configs = filter_config(configs, filter_criteria) # The resulting `filtered_configs` will be: # [\{'model': 'gpt-3.5-turbo', 'api_type': 'azure', ...}] # Define a filter to select a given tag filter_criteria = \{ "tags": ["gpt35_turbo"], } # Apply the filter to the configuration list filtered_configs = filter_config(configs, filter_criteria) # The resulting `filtered_configs` will be: # [\{'model': 'gpt-3.5-turbo', 'tags': ['gpt35_turbo', 'gpt-35-turbo']}] `` |

<br />
