Managing your Connector

Once your connector is deployed and registered, there are a couple of features that will help you to manage it.

Listing your Connectors

You can see all the connectors registered under your organization through the Cohere dashboard. Alternatively, you can make a GET request like the one below:

1curl --request GET
2 --url 'https://api.cohere.ai/v1/connectors'
3 --header 'Authorization: Bearer {Cohere API key}'

Authorizing an OAuth 2.0 Connector

If your connector is set up using OAuth 2.0, a user in your organization can authorize the connector through the dashboard by clicking on “connect your account”. Alternatively, you can make a request to the /oauth/authorize endpoint in your application. This will provide a redirect URL that the user can follow to authorize the OAuth application.

1curl --request POST
2 --url 'https://api.cohere.ai/v1/connectors/{connector-id}/oauth/authorize'
3 --header 'Authorization: Bearer {Cohere API key for user wishing to authorize}'

Updating a Connector

You can enable and disable a connector through the dashboard. Additionally, you can update the connector name, URL, auth settings, and handle similar sorts of tasks through the API, as follows:

1curl --request PATCH
2 --url 'https://api.cohere.ai/v1/connectors/{id}'
3 --header 'Authorization: Bearer {Cohere API key}'
4 --header 'Content-Type: application/json'
5 --data '{
6 "name": "new connector name",
7 "url": "https://new-connector-example.com/search",
8 "auth_type": "oauth",
9 "oauth": {
10 "authorize_url": "https://new.com/authorize",
11 "token_url": "https://new.com/access",
12 "scope": "new_scope"
13 },
14 "active": true,
15 }'

Debugging a Connector

To debug issues with a registered connector, you can follow the steps in this section.

Step 1: Make a streaming request to the connector using the Chat API and check the search results for the error. Here’s an example request:

1import cohere
2
3co = cohere.Client("Your API key")
4response = co.chat(
5 message="What is the chemical formula for glucose?",
6 stream=True,
7 connectors=[
8 {"id": "example_connector_id"}
9 ], # this is from the create step
10)

The response in the search results array should contain the error message from the connector:

Example Response JSON
1 "search_results": [
2 {
3 "connector": {
4 "id": "connector_id"
5 },
6 "error_message":"connector error message"
7 }

Step 2: In Cohere’s dashboard you can view and filter the logs from calling your connector. Change the response filter to “error” to see the error messages returned from your connector.