models¶
Model utilities for Copilot client.
fetch_models(force_refresh=False)
¶
Fetch available models from the Copilot client.
This function queries the Copilot SDK to get the current list of supported models. Results are cached for subsequent calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_refresh
|
bool
|
If True, bypass cache and fetch fresh model list |
False
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of model information dictionaries. Each dict contains model metadata from the Copilot API. |
Examples:
>>> from featcopilot.utils import fetch_models
>>> models = fetch_models()
>>> for m in models:
... print(m.get('id') or m.get('name'))
Source code in featcopilot/utils/models.py
get_default_model()
¶
get_model_info(model_name, force_refresh=False)
¶
Get information about a specific model from Copilot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
The model identifier |
required |
force_refresh
|
bool
|
If True, bypass cache and fetch fresh model list |
False
|
Returns:
| Type | Description |
|---|---|
dict or None
|
Model information if found, None otherwise |
Examples:
>>> from featcopilot.utils import get_model_info
>>> info = get_model_info('gpt-5.2')
>>> if info:
... print(info)
Source code in featcopilot/utils/models.py
get_model_names(force_refresh=False)
¶
Get list of available model names/identifiers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_refresh
|
bool
|
If True, bypass cache and fetch fresh model list |
False
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of model identifiers |
Examples:
Source code in featcopilot/utils/models.py
is_valid_model(model_name, force_refresh=False)
¶
Check if a model name is valid/supported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
The model identifier to check |
required |
force_refresh
|
bool
|
If True, bypass cache and fetch fresh model list |
False
|
Returns:
| Type | Description |
|---|---|
bool
|
True if model is supported, False otherwise |
Examples:
Source code in featcopilot/utils/models.py
list_models(provider=None, verbose=False, force_refresh=False)
¶
List all supported models from the Copilot client.
Retrieves the current list of available models directly from the Copilot SDK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Filter by provider (e.g., 'OpenAI', 'Anthropic', 'Google') |
None
|
verbose
|
bool
|
If True, print model information to logger |
False
|
force_refresh
|
bool
|
If True, bypass cache and fetch fresh model list |
False
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of model information dictionaries from Copilot API |
Examples:
>>> from featcopilot.utils import list_models
>>> models = list_models()
>>> for m in models:
... print(m)
>>> # Filter by provider (if supported by returned data)
>>> openai_models = list_models(provider='OpenAI')