Model
Waldiez model model.
WaldiezModel
¶
Bases: WaldiezBase
Waldiez Model class.
Attributes:
Name | Type | Description |
---|---|---|
id | str | The ID of the model. |
name | str | The name of the model. |
description | str | The description of the model. |
tags | List[str] | The tags of the model. |
requirements | List[str] | The requirements of the model. |
created_at | str | The date and time when the model was created. |
updated_at | str | The date and time when the model was last updated. |
data | WaldiezModelData | The data of the model. See |
api_key: str
property
¶
Get the model's api key.
Either from the model's data or from the environment variables:
- openai: 'OPENAI_API_KEY',
- azure: 'AZURE_API_KEY',
- deepseek: 'DEEPSEEK_API_KEY',
- google: 'GOOGLE_GEMINI_API_KEY',
- anthropic: 'ANTHROPIC_API_KEY',
- mistral: 'MISTRAL_API_KEY',
- groq: 'GROQ_API_KEY',
- together: 'TOGETHER_API_KEY',
- nim: 'NIM_API_KEY',
- cohere: 'COHERE_API_KEY',
- other: 'OPENAI_API_KEY'
api_key_env_key: str
property
¶
Get the model's api key environment key to check.
- openai: 'OPENAI_API_KEY',
- azure: 'AZURE_API_KEY',
- deepseek: 'DEEPSEEK_API_KEY',
- google: 'GOOGLE_GEMINI_API_KEY',
- anthropic: 'ANTHROPIC_API_KEY',
- mistral: 'MISTRAL_API_KEY',
- groq: 'GROQ_API_KEY',
- together: 'TOGETHER_API_KEY',
- nim: 'NIM_API_KEY',
- cohere: 'COHERE_API_KEY',
- other: 'OPENAI_API_KEY'
get_llm_config(skip_price: bool = False) -> Dict[str, Any]
¶
Get the model's llm config.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
skip_price | bool | Whether to skip the price, by default False | False |
Returns:
Type | Description |
---|---|
Dict[str, Any] | The model's llm config dictionary. |
Source code in waldiez/models/model/model.py
price: Optional[List[float]]
property
¶
Get the model's price.
set_default_base_url(llm_config: Dict[str, Any], api_type: WaldiezModelAPIType) -> Dict[str, Any]
¶
Set the default base url if not provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
llm_config | Dict[str, Any] | The llm config dictionary. | required |
api_type | str | The api type. | required |
Returns:
Type | Description |
---|---|
Dict[str, Any] | The llm config dictionary with the default base url set. |
Source code in waldiez/models/model/model.py
Waldiez Model Data.
WaldiezModelAPIType = Literal['openai', 'azure', 'deepseek', 'google', 'anthropic', 'mistral', 'groq', 'together', 'nim', 'cohere', 'other']
module-attribute
¶
Possible API types for the model.
WaldiezModelData
¶
Bases: WaldiezBase
Waldiez Model Data.
Attributes:
Name | Type | Description |
---|---|---|
base_url | Optional[str] | The base url of the model, by default None. |
api_key | Optional[str] | The api key to use with the model, by default None. |
api_type | WaldiezModelAPIType | The api type of the model. |
api_version | Optional[str] | The api version of the model, by default None. |
temperature | Optional[float] | The temperature of the model, by default None. |
top_p | Optional[float] | The top p of the model, by default None. |
max_tokens | Optional[int] | The max tokens of the model, by default None. |
default_headers | Dict[str, str] | The default headers of the model. |
price | Optional[WaldiezModelPrice] | The price of the model, by default None. |
WaldiezModelPrice
¶
Bases: WaldiezBase
Model Price.
Attributes:
Name | Type | Description |
---|---|---|
prompt_price_per_1k | float | The prompt price per 1k tokens. |
completion_token_price_per_1k | float | The completion token price per 1k tokens. |