Implementation:Cohere ai Cohere python Connector Model
| Knowledge Sources | |
|---|---|
| Domains | SDK, Connectors, RAG |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
Connector is a Pydantic model representing a data source connector entity that integrates external data sources with the Cohere chat endpoint for retrieval-augmented generation.
Description
The Connector model represents a registered data source connector in the Cohere platform. Connectors allow you to integrate external data sources with the /chat endpoint to create grounded generations with citations to the data source. Each connector has:
- A unique id that is automatically created from the connector name upon registration.
- An organization_id automatically set to the organization of the user who created it.
- A human-readable name and optional description.
- A url pointing to the search endpoint that will be queried for documents.
- Timestamp fields created_at and updated_at tracking lifecycle.
- An excludes list of fields to exclude from the prompt while keeping them in the document.
- Authentication configuration via auth_type (oauth or service_auth), oauth (
ConnectorOAuth), and auth_status (ConnectorAuthStatus). - An active flag indicating whether the connector is enabled.
- A continue_on_failure flag controlling whether chat requests proceed if this connector fails.
Usage
Use Connector when working with the Cohere connectors API to create, list, update, or delete data source connectors. This model is returned by connector management endpoints and referenced when configuring connectors for RAG-enabled chat requests.
Code Reference
Source Location
- Repository: Cohere Python SDK
- File:
src/cohere/types/connector.py
Signature
class Connector(UncheckedBaseModel):
id: str = pydantic.Field()
organization_id: typing.Optional[str] = pydantic.Field(default=None)
name: str = pydantic.Field()
description: typing.Optional[str] = pydantic.Field(default=None)
url: typing.Optional[str] = pydantic.Field(default=None)
created_at: dt.datetime = pydantic.Field()
updated_at: dt.datetime = pydantic.Field()
excludes: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
auth_type: typing.Optional[str] = pydantic.Field(default=None)
oauth: typing.Optional[ConnectorOAuth] = pydantic.Field(default=None)
auth_status: typing.Optional[ConnectorAuthStatus] = pydantic.Field(default=None)
active: typing.Optional[bool] = pydantic.Field(default=None)
continue_on_failure: typing.Optional[bool] = pydantic.Field(default=None)
Import
from cohere.types import Connector
I/O Contract
Fields
| Field | Type | Required | Description |
|---|---|---|---|
id |
str |
Yes | The unique identifier of the connector, auto-created from its name. |
organization_id |
Optional[str] |
No | The organization to which this connector belongs. |
name |
str |
Yes | A human-readable name for the connector. |
description |
Optional[str] |
No | A description of the connector. |
url |
Optional[str] |
No | The URL of the connector used to search for documents. |
created_at |
datetime |
Yes | The UTC time at which the connector was created. |
updated_at |
datetime |
Yes | The UTC time at which the connector was last updated. |
excludes |
Optional[List[str]] |
No | A list of fields to exclude from the prompt (fields remain in the document). |
auth_type |
Optional[str] |
No | The authentication type used by the connector. Possible values: "oauth", "service_auth".
|
oauth |
Optional[ConnectorOAuth] |
No | The OAuth 2.0 configuration for the connector. |
auth_status |
Optional[ConnectorAuthStatus] |
No | The OAuth status for the requesting user. One of "valid", "expired", or empty.
|
active |
Optional[bool] |
No | Whether the connector is active or not. |
continue_on_failure |
Optional[bool] |
No | Whether a chat request should continue if the request to this connector fails. |
Usage Examples
from cohere.types import Connector
# List all connectors
connectors = client.connectors.list()
for connector in connectors.connectors:
print(f"ID: {connector.id}")
print(f"Name: {connector.name}")
print(f"URL: {connector.url}")
print(f"Active: {connector.active}")
print(f"Auth type: {connector.auth_type}")
print(f"Created: {connector.created_at}")
# Get a specific connector by ID
connector = client.connectors.get(id="my-connector-id")
print(f"Connector: {connector.name}")
print(f"Description: {connector.description}")
print(f"Continue on failure: {connector.continue_on_failure}")
# Use a connector in a chat request for RAG
response = client.chat(
message="What are the latest updates?",
connectors=[{"id": connector.id}],
)