> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cohere

> Learn how to integrate Cohere with HoneyHive

export const integrationType_1 = "Cohere"

export const integrationType_0 = "Cohere"

Cohere is an Enterprise AI Platform optimized for enterprise generative AI, search and discovery, and advanced retrieval.

With HoneyHive, you can trace all your {integrationType_0} operations using a single line of code. Find a list of all supported integrations [here](/introduction/troubleshooting#latest-package-versions-tested).

## HoneyHive Setup

Follow the [HoneyHive Installation Guide](/integrations/integration-prereqs) to get your API key and initialize the tracer.

## Cohere Setup

Go to the [Cohere Dashboard](https://dashboard.cohere.com/api-keys) to get the Cohere API key.

## Example

Here is an example of how to trace your {integrationType_1} code in HoneyHive.

```python Python theme={null}
import cohere
from honeyhive import HoneyHiveTracer, trace

HoneyHiveTracer.init(
    api_key="MY_HONEYHIVE_API_KEY",
    project="MY_HONEYHIVE_PROJECT_NAME",
)

co = cohere.Client("MY_COHERE_API_KEY")


def joke_workflow():
    return co.chat(model="command", message="Tell me a joke, pirate style")


def rerank():
    query = "What is the capital of the United States?"
    documents = [
        "Carson City is the capital city of the American state of Nevada."
        + " At the  2010 United States Census, Carson City had a population of 55,274.",
        "The Commonwealth of the Northern Mariana Islands is a group of islands"
        + " in the Pacific Ocean that are a political division controlled by the "
        + "United States. Its capital is Saipan.",
        "Charlotte Amalie is the capital and largest city of the United States "
        + "Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas.",
        "Washington, D.C. (also known as simply Washington or D.C., and officially "
        + "as the District of Columbia) is the capital of the United States. It is a federal district. ",
        "Capital punishment (the death penalty) has existed in the United States "
        + "since before the United States was a country. As of 2017, capital "
        + "punishment is legal in 30 of the 50 states.",
        "North Dakota is a state in the United States. 672,591 people lived"
        + " in North Dakota in the year 2010. The capital and seat of government is Bismarck.",
    ]

    results = co.rerank(
        query=query,
        documents=documents,
        top_n=3,
        model="rerank-multilingual-v2.0",
    )
    print(results)


res = joke_workflow()
print(res)
rerank()
```

## View your Traces

Once you run your code, you can view your execution trace in the HoneyHive UI by clicking the `Log Store` tab on the left sidebar.
