Cohere

Cohere

AgentOps는 Cohere를 위한 일급(first class) 지원을 제공해요. Cohere 모델을 AgentOps로 추적하는 방법을 함께 알아볼게요.

출처: 문서

본문

Cohere 모델을 이제 AgentOps로 추적할 수 있어요. 더 많은 정보는 Cohere API를 살펴보세요.

참고: Cohere의 LLM University는 hands-on 예제가 많아 LLM을 배우기에 아주 좋은 자료예요.

Cohere: Command-R-Plus를 위한 일급(first class) 지원 — Loom 비디오

Cohere와 AgentOps 통합 단계 (Steps to integrate Cohere with AgentOps)

1. AgentOps SDK 설치하기 (Install the AgentOps SDK)

pip install agentops
poetry add agentops

2. Cohere SDK 설치하기 (Install the Cohere SDK)

참고: cohere>=5.4.0이 현재 지원돼요.

pip install cohere
poetry add cohere

3. 코드 3줄 추가하기 (Add 3 lines of code)

참고: openai, cohere, crew 등 어떤 모델을 호출하기 전에 반드시 agentops.init을 먼저 호출해야 해요.

import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
co = cohere.Client()
...
# End of program (e.g. main.py)
agentops.end_session("Success") # Success|Fail|Indeterminate

⚠️ cohere>=5.4.0이 필요해요.

팁: API key를 .env 변수로 설정하면 쉽게 사용할 수 있어요.

AGENTOPS_API_KEY=<YOUR API KEY>

환경 변수에 대한 자세한 내용은 Advanced Configuration에서 확인할 수 있어요.

4. 에이전트 실행하기 (Run your Agent)

프로그램을 실행하고 app.agentops.ai/drilldown을 방문해서 여러분의 에이전트를 관찰해보세요! 🕵️

팁: 실행 후 AgentOps는 대시보드의 세션으로 바로 연결되는 클릭 가능한 URL을 콘솔에 출력해요.

전체 예제 (Full Examples)

import cohere
import agentops

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')
import cohere
import agentops

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')

더 알아보기 (Learn more)