Make sure to call agentops.init before calling any openai, cohere, crew, etc models.
import agentopsagentops.init(<INSERT YOUR API KEY HERE>)co = cohere.Client()...# End of program (e.g. main.py)agentops.end_session("Success") # Success|Fail|Indeterminate
Requires cohere>=5.4.0
Set your API key as an .env variable for easy access.
import cohereimport agentopsagentops.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')
import cohereimport agentopsagentops.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')