Groq
Groq
AgentOps는 Groq를 위한 일급(first class) 지원을 제공해요. 초고속 Language Processing Unit(LPU)으로 Groq Cloud를 구동하는 Groq의 LLM inference를 활용하는 방법을 알아볼게요.
출처: 문서
본문
Groq은 초고속 Language Processing Unit (LPU)으로 LLM inference를 가속화하며, 이를 통해 Groq Cloud를 구동해요. 개발자 콘솔을 시작하려면 Groq docs를 살펴보세요.
Groq를 AgentOps와 통합하는 단계 (Steps to Integrate Groq with AgentOps)
1. AgentOps SDK 설치하기 (Install the AgentOps SDK)
pip install agentops
poetry add agentops
2. Groq SDK 설치하기 (Install the Groq SDK)
pip install groq
poetry add groq
3. AgentOps 초기화하고 Groq로 개발하기 (Initialize AgentOps and develop with Groq)
참고:
openai,cohere,crew등 어떤 모델을 호출하기 전에 반드시agentops.init을 먼저 호출해야 해요.
from groq import Groq
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
client = Groq(api_key="your_api_key")
# Your code here...
agentops.end_session('Success')
팁: API key를
.env변수로 설정하면 쉽게 사용할 수 있어요.
AGENTOPS_API_KEY=<YOUR API KEY>
GROQ_API_KEY=<YOUR OPENAI API KEY>
환경 변수에 대한 자세한 내용은 Advanced Configuration에서 확인할 수 있어요.
4. 에이전트 실행하기 (Run your Agent)
프로그램을 실행하고 app.agentops.ai/drilldown을 방문해서 여러분의 에이전트를 관찰해보세요! 🕵️
팁: 실행 후 AgentOps는 대시보드의 세션으로 바로 연결되는 클릭 가능한 URL을 콘솔에 출력해요.
전체 예제 (Full Examples)
from groq import Groq
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
client = Groq(api_key="your_api_key")
response = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
}
],
model="llama3-8b-8192",
)
print(response.choices[0].message.content)
agentops.end_session('Success')
from groq import AsyncGroq
import agentops
import asyncio
async def main() -> None:
agentops.init(<INSERT YOUR API KEY HERE>)
client = AsyncGroq(api_key="your_api_key")
response = await client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Explain the importance of low latency LLMs",
}
],
model="llama3-8b-8192",
)
print(response.choices[0].message.content)
agentops.end_session('Success')
asyncio.run(main())
Multi Agent Example: 이 노트북은 Groq를 사용하는 multi-agent 시스템과 함께 AgentOps를 사용하는 방법을 보여줘요. (GitHub)