You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates an instance of AIMLAPIChatGenerator. Unless specified otherwise,
74
+
Creates an instance of AIMLAPIChatGenerator.
73
75
74
-
the default model is `openai/gpt-5-chat-latest`.
76
+
Unless specified otherwise, the default model is `openai/gpt-5-chat-latest`.
75
77
76
-
**Arguments**:
78
+
**Parameters:**
77
79
78
-
-`api_key`: The AIMLAPI API key.
79
-
-`model`: The name of the AIMLAPI chat completion model to use.
80
-
-`streaming_callback`: A callback function that is called when a new token is received from the stream.
81
-
The callback function accepts StreamingChunk as an argument.
82
-
-`api_base_url`: The AIMLAPI API Base url.
83
-
For more details, see AIMLAPI documentation.
84
-
-`generation_kwargs`: Other parameters to use for the model. These parameters are all sent directly to
85
-
the AIMLAPI endpoint. See AIMLAPI API docs for more details.
86
-
Some of the supported parameters:
80
+
-**api_key** (<code>Secret</code>) – The AIMLAPI API key.
81
+
-**model** (<code>str</code>) – The name of the AIMLAPI chat completion model to use.
82
+
-**streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
83
+
The callback function accepts StreamingChunk as an argument.
84
+
-**api_base_url** (<code>str | None</code>) – The AIMLAPI API Base url.
85
+
For more details, see AIMLAPI documentation.
86
+
-**generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Other parameters to use for the model. These parameters are all sent directly to
87
+
the AIMLAPI endpoint. See AIMLAPI API docs for more details.
88
+
Some of the supported parameters:
87
89
-`max_tokens`: The maximum number of tokens the output text can have.
88
90
-`temperature`: What sampling temperature to use. Higher values mean the model will take more risks.
89
-
Try 0.9 for more creative applications and 0 (argmax sampling) for ones with a well-defined answer.
91
+
Try 0.9 for more creative applications and 0 (argmax sampling) for ones with a well-defined answer.
90
92
-`top_p`: An alternative to sampling with temperature, called nucleus sampling, where the model
91
-
considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens
92
-
comprising the top 10% probability mass are considered.
93
+
considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens
94
+
comprising the top 10% probability mass are considered.
93
95
-`stream`: Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent
94
-
events as they become available, with the stream terminated by a data: [DONE] message.
96
+
events as they become available, with the stream terminated by a data: [DONE] message.
95
97
-`safe_prompt`: Whether to inject a safety prompt before all conversations.
96
98
-`random_seed`: The seed to use for random sampling.
97
-
-`tools`: A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
98
-
list of `Tool` objects or a `Toolset` instance.
99
-
-`timeout`: The timeout for the AIMLAPI API call.
100
-
-`extra_headers`: Additional HTTP headers to include in requests to the AIMLAPI API.
101
-
-`max_retries`: Maximum number of retries to contact AIMLAPI after an internal error.
102
-
If not set, it defaults to either the `AIMLAPI_MAX_RETRIES` environment variable, or set to 5.
103
-
-`http_client_kwargs`: A dictionary of keyword arguments to configure a custom `httpx.Client`or `httpx.AsyncClient`.
104
-
For more information, see the [HTTPX documentation](https://www.python-httpx.org/api/`client`).
99
+
-**tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
100
+
list of `Tool` objects or a `Toolset` instance.
101
+
-**timeout** (<code>float | None</code>) – The timeout for the AIMLAPI API call.
102
+
-**extra_headers** (<code>dict\[str, Any\] | None</code>) – Additional HTTP headers to include in requests to the AIMLAPI API.
103
+
-**max_retries** (<code>int | None</code>) – Maximum number of retries to contact AIMLAPI after an internal error.
104
+
If not set, it defaults to either the `AIMLAPI_MAX_RETRIES` environment variable, or set to 5.
105
+
-**http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – A dictionary of keyword arguments to configure a custom `httpx.Client`or `httpx.AsyncClient`.
106
+
For more information, see the [HTTPX documentation](https://www.python-httpx.org/api/#client).
-**tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
100
+
list of `Tool` objects or a `Toolset` instance.
101
+
-**timeout** (<code>float | None</code>) – The timeout for the AIMLAPI API call.
102
+
-**extra_headers** (<code>dict\[str, Any\] | None</code>) – Additional HTTP headers to include in requests to the AIMLAPI API.
103
+
-**max_retries** (<code>int | None</code>) – Maximum number of retries to contact AIMLAPI after an internal error.
104
+
If not set, it defaults to either the `AIMLAPI_MAX_RETRIES` environment variable, or set to 5.
105
+
-**http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – A dictionary of keyword arguments to configure a custom `httpx.Client`or `httpx.AsyncClient`.
106
+
For more information, see the [HTTPX documentation](https://www.python-httpx.org/api/#client).
107
107
108
-
#### AIMLAPIChatGenerator.to\_dict
108
+
#### to_dict
109
109
110
110
```python
111
-
defto_dict() -> dict[str, Any]
111
+
to_dict() -> dict[str, Any]
112
112
```
113
113
114
114
Serialize this component to a dictionary.
115
115
116
-
**Returns**:
116
+
**Returns:**
117
117
118
-
The serialized component as a dictionary.
118
+
- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
0 commit comments