Skip to content

Commit ec8d2da

Browse files
authored
Merge branch 'main' into llmtracker_fix
2 parents 955cae3 + 7072e20 commit ec8d2da

14 files changed

Lines changed: 714 additions & 12 deletions
42.8 KB
Loading
19.4 KB
Loading
46 KB
Loading
20.9 KB
Loading

docs/mint.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@
8787
{
8888
"group": "Integrations",
8989
"pages": [
90-
"v1/integrations/crewai",
90+
"v1/integrations/anthropic",
9191
"v1/integrations/autogen",
92-
"v1/integrations/langchain",
9392
"v1/integrations/cohere",
94-
"v1/integrations/anthropic",
95-
"v1/integrations/ollama",
93+
"v1/integrations/crewai",
94+
"v1/integrations/langchain",
9695
"v1/integrations/litellm",
9796
"v1/integrations/multion",
97+
"v1/integrations/ollama",
98+
"v1/integrations/openai",
9899
"v1/integrations/rest"
99100
]
100101
},

docs/v1/integrations/anthropic.mdx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@ This is a living integration. Should you need any added functionality, message u
1818
<Step title="Install the AgentOps SDK">
1919
<CodeGroup>
2020
```bash pip
21-
pip install agentops anthropic
21+
pip install agentops
2222
```
2323
```bash poetry
24-
poetry add agentops anthropic
24+
poetry add agentops
25+
```
26+
</CodeGroup>
27+
</Step>
28+
<Step title="Install the Anthropic SDK">
29+
<Note>
30+
`anthropic>=0.32.0` is currently supported with additional support for the Computer Use tool.
31+
</Note>
32+
<CodeGroup>
33+
```bash pip
34+
pip install anthropic
35+
```
36+
```bash poetry
37+
poetry add anthropic
2538
```
2639
</CodeGroup>
2740
</Step>

docs/v1/integrations/cohere.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ This is a living integration. Should you need any added functionality, message u
2525
poetry add agentops
2626
```
2727
</CodeGroup>
28+
</Step>
29+
<Step title="Install the Cohere SDK">
30+
<Note>
31+
`cohere>=5.4.0` is currently supported.
32+
</Note>
33+
<CodeGroup>
34+
```bash pip
35+
pip install cohere
36+
```
37+
```bash poetry
38+
poetry add cohere
39+
```
40+
</CodeGroup>
2841
</Step>
2942
<Step title="Add 3 lines of code">
3043
<CodeTooltip/>

docs/v1/integrations/ollama.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ This is a living integration. Should you need any added functionality, message u
2525
```
2626
</CodeGroup>
2727
</Step>
28+
<Step title="Install the Ollama SDK">
29+
<CodeGroup>
30+
```bash pip
31+
pip install ollama
32+
```
33+
```bash poetry
34+
poetry add ollama
35+
```
36+
</CodeGroup>
37+
</Step>
2838
<Step title="Add 3 lines of code">
2939
<CodeTooltip/>
3040
<CodeGroup>

docs/v1/integrations/openai.mdx

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
---
2+
title: OpenAI
3+
description: "AgentOps provides first class support for OpenAI's GPT family of models"
4+
---
5+
6+
import CodeTooltip from '/snippets/add-code-tooltip.mdx'
7+
import EnvTooltip from '/snippets/add-env-tooltip.mdx'
8+
9+
<Note>
10+
This is a living integration. Should you need any added functionality, message us on [Discord](https://discord.gg/UgJyyxx7uc)!
11+
</Note>
12+
13+
<Card title="OpenAI" icon="robot" href="https://www.openai.com">
14+
First class support for GPT family of models
15+
</Card>
16+
17+
<Steps>
18+
<Step title="Install the AgentOps SDK">
19+
<CodeGroup>
20+
```bash pip
21+
pip install agentops
22+
```
23+
```bash poetry
24+
poetry add agentops
25+
```
26+
</CodeGroup>
27+
</Step>
28+
<Step title="Install the OpenAI SDK">
29+
<Note>
30+
`openai<1.0.0` has limited support while `openai>=1.0.0` is continuously supported.
31+
</Note>
32+
<CodeGroup>
33+
```bash pip
34+
pip install openai
35+
```
36+
```bash poetry
37+
poetry add openai
38+
```
39+
</CodeGroup>
40+
41+
To install `openai<1.0.0`, use the following:
42+
<CodeGroup>
43+
```bash pip
44+
pip install "openai<1.0.0"
45+
```
46+
```bash poetry
47+
poetry add "openai<1.0.0"
48+
```
49+
</CodeGroup>
50+
</Step>
51+
<Step title="Add 3 lines of code">
52+
<CodeTooltip/>
53+
<span className="api-key-container">
54+
<CodeGroup>
55+
```python python
56+
import agentops
57+
from openai import OpenAI
58+
59+
agentops.init(<INSERT YOUR API KEY HERE>)
60+
client = OpenAI()
61+
...
62+
# End of program (e.g. main.py)
63+
agentops.end_session("Success") # Success|Fail|Indeterminate
64+
```
65+
</CodeGroup>
66+
</span>
67+
<EnvTooltip />
68+
<span className="api-key-container">
69+
<CodeGroup>
70+
```python .env
71+
AGENTOPS_API_KEY=<YOUR API KEY>
72+
OPENAI_API_KEY=<YOUR OPENAI API KEY>
73+
```
74+
</CodeGroup>
75+
Read more about environment variables in [Advanced Configuration](/v1/usage/advanced-configuration)
76+
</span>
77+
</Step>
78+
<Step title="Run your Agent">
79+
Execute your program and visit [app.agentops.ai/drilldown](https://app.agentops.ai/drilldown) to observe your Agent! 🕵️
80+
<Tip>
81+
After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard
82+
</Tip>
83+
<div/>
84+
<Frame type="glass" caption="Clickable link to session">
85+
<img height="200" src="https://raw.githubusercontent.com/AgentOps-AI/agentops/refs/heads/main/docs/images/external/app_screenshots/session-replay.png?raw=true" />
86+
</Frame>
87+
</Step>
88+
</Steps>
89+
90+
## Full Examples
91+
92+
<CodeGroup>
93+
```python sync
94+
from openai import OpenAI
95+
import agentops
96+
97+
agentops.init(<INSERT YOUR API KEY HERE>)
98+
client = OpenAI()
99+
100+
response = client.chat.completions.create((
101+
model="gpt-4o-mini",
102+
messages=[{
103+
"role": "user",
104+
"content": "Write a haiku about AI and humans working together"
105+
}]
106+
)
107+
108+
print(response.choices[0].message.content)
109+
agentops.end_session('Success')
110+
```
111+
112+
```python async
113+
from openai import AsyncOpenAI
114+
import agentops
115+
import asyncio
116+
117+
async def main():
118+
agentops.init(<INSERT YOUR API KEY HERE>)
119+
client = AsyncOpenAI()
120+
121+
response = await client.chat.completions.create(
122+
model="gpt-4o-mini",
123+
messages=[{
124+
"role": "user",
125+
"content": "Write a haiku about AI and humans working together"
126+
}]
127+
)
128+
129+
print(response.choices[0].message.content)
130+
agentops.end_session('Success')
131+
132+
asyncio.run(main())
133+
```
134+
135+
</CodeGroup>
136+
137+
### Streaming examples
138+
139+
<CodeGroup>
140+
```python sync
141+
from openai import OpenAI
142+
import agentops
143+
144+
agentops.init(<INSERT YOUR API KEY HERE>)
145+
client = OpenAI()
146+
147+
stream = client.chat.completions.create(
148+
model="gpt-4o-mini",
149+
stream=True,
150+
messages=[{
151+
"role": "user",
152+
"content": "Write a haiku about AI and humans working together"
153+
}],
154+
)
155+
156+
for chunk in stream:
157+
print(chunk.choices[0].delta.content or "", end="")
158+
159+
agentops.end_session('Success')
160+
```
161+
162+
```python async
163+
from openai import AsyncOpenAI
164+
import agentops
165+
import asyncio
166+
167+
async def main():
168+
agentops.init(<INSERT YOUR API KEY HERE>)
169+
client = AsyncOpenAI()
170+
171+
stream = await client.chat.completions.create(
172+
model="gpt-4o-mini",
173+
stream=True,
174+
messages=[{
175+
"role": "user",
176+
"content": "Write a haiku about AI and humans working together"
177+
}],
178+
)
179+
180+
async for chunk in stream:
181+
print(chunk.choices[0].delta.content or "", end="")
182+
183+
agentops.end_session('Success')
184+
185+
asyncio.run(main())
186+
```
187+
188+
</CodeGroup>
189+
190+
<script type="module" src="/scripts/github_stars.js"></script>
191+
<script type="module" src="/scripts/link_to_api_button.js"></script>
192+
<script type="module" src="/scripts/scroll-img-fadein-animation.js"></script>
193+
<script type="module" src="/scripts/button_heartbeat_animation.js"></script>
194+
<script type="css" src="/styles/styles.css"></script>
195+
<script type="module" src="/scripts/adjust_api_dynamically.js"></script>

examples/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ At a high level, AgentOps gives you the ability to monitor LLM calls, costs, lat
2121
- [Multi-Agent](./multi_agent_example.ipynb)
2222

2323
## Integrations
24-
- [Using Langchain](./langchain_examples.ipynb)
25-
- [Crew.ai](https://github.com/joaomdmoura/crewAI-examples/tree/main/markdown_validator)
26-
- Crew is a framework for developing agents, a number of their example projects use AgentOps
27-
- [Cohere](./cohere_example.ipynb)
28-
- [Anthropic](./anthropic_example.ipynb)
24+
- [AI21](./ai21_examples/ai21_examples.ipynb)
25+
- [Anthropic](./anthropic_examples/)-
26+
- [Autogen](./autogen_examples/)
27+
- [Cohere](./cohere_examples/cohere_example.ipynb)
28+
- [Crew.ai](./crew_examples/)
29+
- [Groq](./multi_agent_groq_example.ipynb)
30+
- [Langchain](./langchain_examples/langchain_examples.ipynb)
31+
- [LiteLLM](./litlelm_examples/litlelm_example.ipynb)
32+
- [Mistral](./mistral_examples/mistral_example.ipynb)
33+
- [MultiOn](./multion_examples/)
34+
- [Ollama](./ollama_examples/ollama_examples.ipynb)
35+
- [OpenAI](./openai_examples/)

0 commit comments

Comments
 (0)