May 23, 2023

Cohere

We’ve just added support for Cohere to Humanloop!

This update adds Cohere models to the playground and your projects - just add your Cohere API key in your organization’s settings. As with other providers, each user in your organization can also set a personal override API key, stored locally in the browser, for use in Cohere requests from the Playground.

Enabling Cohere for your organization

Add your Cohere API key to your organization settings to start using Cohere models with Humanloop.

Working with Cohere models

Once you’ve successfully enabled Cohere for your organization, you’ll be able to access it through the playground and in your projects, in exactly the same way as your existing OpenAI and/or Anthropic models.

REST API and Python / TypeScript support

As with other model providers, once you’ve set up a Cohere-backed model config, you can call it with the Humanloop REST API or our SDKs.

1import { Humanloop } from "humanloop";
2
3const humanloop = new Humanloop({
4 apiKey: "API_KEY",
5});
6
7const chatResponse = await humanloop.chat({
8 project: "project_example",
9 messages: [
10 {
11 role: "user",
12 content: "Write me a song",
13 },
14 ],
15 provider_api_keys: {
16 cohere: COHERE_API_KEY,
17 },
18 model_config: {
19 model: "command",
20 temperature: 1,
21 },
22});
23
24console.log(chatResponse);

If you don’t provide a Cohere API key under the provider_api_keys field, the request will fall back on the stored organization level key you configured above.