Install the SDK

bash
pip install agentops

Get an API key

Retrieve an API Key from your settings page.

API keys are tied to individual projects.
A Default Project has been created for you, so just click Copy API Key

Using AgentOps with Cohere

Requires cohere>=5.4.0

Session replays in 3 lines of code

Initialize the AgentOps client and automatically get analytics on every LLM call.

python
import cohere
import agentops

# Beginning of program's code (i.e. main.py, __init__.py)
agentops.init(<INSERT YOUR API KEY HERE>)

co = cohere.Client()

chat = co.chat(
    message="Is it pronounced ceaux-hear or co-hehray?"
)

print(chat)

agentops.end_session('Success')
python
import cohere
import agentops

# Beginning of program's code (i.e. main.py, __init__.py)
agentops.init(<INSERT YOUR API KEY HERE>)

co = cohere.Client()

stream = co.chat_stream(
    message="Write me a haiku about the synergies between Cohere and AgentOps"
)

for event in stream:
    if event.event_type == "text-generation":
        print(event.text, end='')

agentops.end_session('Success')

Explanation

When openai has been imported, instantiating the AgentOps client will automatically instrument chat completions. You will be able to see all of your sessions on the AgentOps dashboard along with the full LLM chat histories, cost, token counts, etc.

For more features see our Details section.