Cohere
Overview
The Cohere platform builds natural language processing and generation into your product with a few lines of code. Use Cohere to solve a broad spectrum of natural language use cases, including classification, semantic search, paraphrasing, summarization, and content generation.
Setting up Cohere
Create an access token
To get started with Cohere, you'll need a API key. Cohere offers two kinds of API keys: trial keys (with a variety of attendant limitations), and production keys (which have no such limitations). To get a trial key register through the Cohere dashboard.
To create a production key:
- Log in to Cohere
- Got to the API Keys
- Click Create Production key
- Copy the API key to configure your integration's connection
Learn more about Cohere API Authentication.
Add integration
Once you have an access token, you're ready to set up your Superblocks integration.
- In the web app, navigate to the Integrations page
- Click on the Cohere tile
- Name the integration
- Paste your credentials into the relevant fields
- Optionally, add more configurations to set credentials for different environments
- Click Create
Cohere connected Now you can use Cohere in any Application, Workflow, or Scheduled Job.
Use Cohere in APIs
Once your Cohere integration is created, you can start calling Cohere actions in Superblocks APIs.
Cohere actions are REST requests. To learn more about REST requests in Superblocks, see the Building REST requests guide.
Certain Cohere actions support streaming. Learn more about building APIs in Superblocks that
stream data from REST APIs
.
Supported actions
Chat
Generates a text response to a user message. To learn how to use the Chat API with Streaming and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).Generate
> 🚧 Warning > > This API is marked as "Legacy" and is no longer maintained. Follow the [migration guide](/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API. Generates realistic text conditioned on a given input.Embed
This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents. Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page. If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search).List Embed Jobs
The list embed job endpoint allows users to view all embed jobs history for that specific user.Create an Embed Job
This API launches an async Embed job for a [Dataset](https://docs.cohere.com/docs/datasets) of type `embed-input`. The result of a completed embed job is new Dataset of type `embed-output`, which contains the original text entries and the corresponding embeddings.Fetch an Embed Job
This API retrieves the details about an embed job started by the same user.Cancel an Embed Job
This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation.Rerank
This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.Classify
This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference. Note: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.List Datasets
List datasets that have been created.Create a Dataset
Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.Get Dataset Usage
View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.Get a Dataset
Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.Delete a Dataset
Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.Tokenize
This endpoint splits input text into smaller units called tokens using byte-pair encoding (BPE). To learn more about tokenization and byte pair encoding, see the tokens page.Generic HTTP Request
Every SaaS integration in Superblocks comes with a built in Generic HTTP Request Action. This is a powerful action you can use to call Cohere API endpoints not in the Superblocks supported actions.
To use this action simply add the method, path, required query parameters, and body for the desired endpoint.
Learn more about REST requests in Superblocks in our Building REST requests guide.
Generic HTTP Requests use the authentication set up and base URL you've configured for your integration, making it an easy for your team to extend Superblocks Integrations to meet their needs.