diff --git a/docs-website/reference/integrations-api/cometapi.md b/docs-website/reference/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference/integrations-api/cometapi.md +++ b/docs-website/reference/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.18/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.18/integrations-api/cometapi.md index 4c61892c51..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.18/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.18/integrations-api/cometapi.md @@ -5,32 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** + +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.19/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.19/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.19/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.19/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.20/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.20/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.20/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.20/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.21/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.21/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.21/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.21/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.22/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.22/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.22/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.22/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.23/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.23/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.23/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.23/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.24/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.24/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.24/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.24/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.25/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.25/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.25/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.25/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.26/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.26/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.26/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.26/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.27/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.27/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.27/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.27/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.28/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.28/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.28/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.28/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.29/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.29/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.29/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.29/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.30/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.30/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.30/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.30/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary. diff --git a/docs-website/reference_versioned_docs/version-2.31/integrations-api/cometapi.md b/docs-website/reference_versioned_docs/version-2.31/integrations-api/cometapi.md index 4b061911f8..a1e242728e 100644 --- a/docs-website/reference_versioned_docs/version-2.31/integrations-api/cometapi.md +++ b/docs-website/reference_versioned_docs/version-2.31/integrations-api/cometapi.md @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack" slug: "/integrations-cometapi" --- - -## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator - - +## haystack_integrations.components.generators.cometapi.chat.chat_generator ### CometAPIChatGenerator +Bases: OpenAIChatGenerator + A chat generator that uses the CometAPI for generating chat responses. This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI. It sets the `api_base_url` to the CometAPI endpoint and allows for all the standard configurations available in the OpenAIChatGenerator. -**Arguments**: - -- `api_key`: The API key for authenticating with the CometAPI. Defaults to -loading from the "COMET_API_KEY" environment variable. -- `model`: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini"). -Defaults to "gpt-5-mini". -- `streaming_callback`: An optional callable that will be called with each chunk of -a streaming response. -- `generation_kwargs`: Optional keyword arguments to pass to the underlying generation -API call. -- `timeout`: The maximum time in seconds to wait for a response from the API. -- `max_retries`: The maximum number of times to retry a failed API request. -- `tools`: An optional list of tool definitions that the model can use. -- `tools_strict`: If True, the model is forced to use one of the provided tools if a tool call is made. -- `http_client_kwargs`: Optional keyword arguments to pass to the HTTP client. +#### __init__ + +```python +__init__( + *, + api_key: Secret = Secret.from_env_var("COMET_API_KEY"), + model: str = "gpt-5-mini", + streaming_callback: StreamingCallbackT | None = None, + generation_kwargs: dict[str, Any] | None = None, + timeout: int | None = None, + max_retries: int | None = None, + tools: list[Tool | Toolset] | Toolset | None = None, + tools_strict: bool = False, + http_client_kwargs: dict[str, Any] | None = None +) -> None +``` + +Creates a `CometAPIChatGenerator` instance. + +**Parameters:** + +- **api_key** (Secret) – The API key for authenticating with the CometAPI. +- **model** (str) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`). +- **streaming_callback** (StreamingCallbackT | None) – An optional callable invoked with each chunk of a streaming response. +- **generation_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the underlying generation API call. +- **timeout** (int | None) – The maximum time in seconds to wait for a response from the API. +- **max_retries** (int | None) – The maximum number of times to retry a failed API request. +- **tools** (list\[Tool | Toolset\] | Toolset | None) – An optional list of tools the model can use. +- **tools_strict** (bool) – If `True`, the model is forced to use one of the provided tools. +- **http_client_kwargs** (dict\[str, Any\] | None) – Optional keyword arguments passed to the HTTP client. + +#### to_dict + +```python +to_dict() -> dict[str, Any] +``` + +Serialize this component to a dictionary. + +**Returns:** +- dict\[str, Any\] – The serialized component as a dictionary.