Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions docs-website/reference/integrations-api/cometapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack"
slug: "/integrations-cometapi"
---

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator"></a>

## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"></a>
## haystack_integrations.components.generators.cometapi.chat.chat_generator

### CometAPIChatGenerator

Bases: <code>OpenAIChatGenerator</code>

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** (<code>Secret</code>) – The API key for authenticating with the CometAPI.
- **model** (<code>str</code>) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – An optional callable invoked with each chunk of a streaming response.
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the underlying generation API call.
- **timeout** (<code>int | None</code>) – The maximum time in seconds to wait for a response from the API.
- **max_retries** (<code>int | None</code>) – The maximum number of times to retry a failed API request.
- **tools** (<code>list\[Tool | Toolset\] | Toolset | None</code>) – An optional list of tools the model can use.
- **tools_strict** (<code>bool</code>) – If `True`, the model is forced to use one of the provided tools.
- **http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the HTTP client.

#### to_dict

```python
to_dict() -> dict[str, Any]
```

Serialize this component to a dictionary.

**Returns:**

- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,58 @@ description: "Comet API integration for Haystack"
slug: "/integrations-cometapi"
---

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator"></a>

## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"></a>
## haystack_integrations.components.generators.cometapi.chat.chat_generator

### CometAPIChatGenerator

Bases: <code>OpenAIChatGenerator</code>

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** (<code>Secret</code>) – The API key for authenticating with the CometAPI.
- **model** (<code>str</code>) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – An optional callable invoked with each chunk of a streaming response.
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the underlying generation API call.
- **timeout** (<code>int | None</code>) – The maximum time in seconds to wait for a response from the API.
- **max_retries** (<code>int | None</code>) – The maximum number of times to retry a failed API request.
- **tools** (<code>list\[Tool | Toolset\] | Toolset | None</code>) – An optional list of tools the model can use.
- **tools_strict** (<code>bool</code>) – If `True`, the model is forced to use one of the provided tools.
- **http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the HTTP client.

#### to_dict

```python
to_dict() -> dict[str, Any]
```

Serialize this component to a dictionary.

**Returns:**

- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack"
slug: "/integrations-cometapi"
---

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator"></a>

## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"></a>
## haystack_integrations.components.generators.cometapi.chat.chat_generator

### CometAPIChatGenerator

Bases: <code>OpenAIChatGenerator</code>

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** (<code>Secret</code>) – The API key for authenticating with the CometAPI.
- **model** (<code>str</code>) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – An optional callable invoked with each chunk of a streaming response.
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the underlying generation API call.
- **timeout** (<code>int | None</code>) – The maximum time in seconds to wait for a response from the API.
- **max_retries** (<code>int | None</code>) – The maximum number of times to retry a failed API request.
- **tools** (<code>list\[Tool | Toolset\] | Toolset | None</code>) – An optional list of tools the model can use.
- **tools_strict** (<code>bool</code>) – If `True`, the model is forced to use one of the provided tools.
- **http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the HTTP client.

#### to_dict

```python
to_dict() -> dict[str, Any]
```

Serialize this component to a dictionary.

**Returns:**

- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack"
slug: "/integrations-cometapi"
---

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator"></a>

## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"></a>
## haystack_integrations.components.generators.cometapi.chat.chat_generator

### CometAPIChatGenerator

Bases: <code>OpenAIChatGenerator</code>

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** (<code>Secret</code>) – The API key for authenticating with the CometAPI.
- **model** (<code>str</code>) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – An optional callable invoked with each chunk of a streaming response.
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the underlying generation API call.
- **timeout** (<code>int | None</code>) – The maximum time in seconds to wait for a response from the API.
- **max_retries** (<code>int | None</code>) – The maximum number of times to retry a failed API request.
- **tools** (<code>list\[Tool | Toolset\] | Toolset | None</code>) – An optional list of tools the model can use.
- **tools_strict** (<code>bool</code>) – If `True`, the model is forced to use one of the provided tools.
- **http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the HTTP client.

#### to_dict

```python
to_dict() -> dict[str, Any]
```

Serialize this component to a dictionary.

**Returns:**

- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,58 @@ description: "Comet API integration for Haystack"
slug: "/integrations-cometapi"
---

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator"></a>

## Module haystack\_integrations.components.generators.cometapi.chat.chat\_generator

<a id="haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"></a>
## haystack_integrations.components.generators.cometapi.chat.chat_generator

### CometAPIChatGenerator

Bases: <code>OpenAIChatGenerator</code>

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** (<code>Secret</code>) – The API key for authenticating with the CometAPI.
- **model** (<code>str</code>) – The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – An optional callable invoked with each chunk of a streaming response.
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the underlying generation API call.
- **timeout** (<code>int | None</code>) – The maximum time in seconds to wait for a response from the API.
- **max_retries** (<code>int | None</code>) – The maximum number of times to retry a failed API request.
- **tools** (<code>list\[Tool | Toolset\] | Toolset | None</code>) – An optional list of tools the model can use.
- **tools_strict** (<code>bool</code>) – If `True`, the model is forced to use one of the provided tools.
- **http_client_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional keyword arguments passed to the HTTP client.

#### to_dict

```python
to_dict() -> dict[str, Any]
```

Serialize this component to a dictionary.

**Returns:**

- <code>dict\[str, Any\]</code> – The serialized component as a dictionary.
Loading
Loading