Skip to content

Commit

Permalink
generate notebooks in folders and style all iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
bboynton97 committed Jul 27, 2024
2 parents eee46c6 + d618a79 commit 73d357d
Show file tree
Hide file tree
Showing 26 changed files with 1,847 additions and 62 deletions.
File renamed without changes
3 changes: 2 additions & 1 deletion docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"v1/integrations/autogen",
"v1/integrations/langchain",
"v1/integrations/cohere",
"v1/integrations/litellm"
"v1/integrations/litellm",
"v1/integrations/multion"
]
},
{
Expand Down
9 changes: 6 additions & 3 deletions docs/v1/examples/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mode: "wide"
## Explore our example code to see AgentOps in action!

<CardGroup cols={2}>
<Card title="Simple Agent" icon="person-carry-box" iconType="solid" href="/v1/examples/simple_agent">
<Card title="Simple Agent" icon="microchip-ai" iconType="solid" href="https://github.com/AgentOps-AI/agentops-py/blob/main/examples/openai-gpt.ipynb">
Jupyter Notebook with sample code that you can run! Start here!
</Card>
<Card title="Crew.ai Example" icon="ship" href="/v1/integrations/crewai">
Expand All @@ -19,15 +19,18 @@ mode: "wide"
<Card title="Multi-Agent Code Example" icon="people-arrows" iconType="duotone" href="/v1/examples/multi_agent">
Jupyter Notebook with a simple multi-agent design
</Card>
<Card title="LangChain Example" icon="link" href="/v1/examples/langchain">
<Card title="LangChain Example" icon="crow" href="/v1/examples/langchain">
Jupyter Notebook with a sample LangChain integration
</Card>
<Card title="FastAPI Example" icon="computer" href="/v1/examples/fastapi">
<Card title="FastAPI Example" icon="bolt-lightning" href="/v1/examples/fastapi">
Create a REST server that performs and observes agent tasks
</Card>
<Card title="Multi Session Example" icon="computer" href="/v1/examples/multi_session">
Manage multiple sessions at the same time
</Card>
<Card title="MultiOn Example" icon="atom" href="/v1/examples/multion">
Create an autonomous browser agent capable of navigating the web and extracting information
</Card>
</CardGroup>

## Video Guides
Expand Down
3 changes: 0 additions & 3 deletions docs/v1/examples/fastapi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ mode: "wide"
poetry add agentops
```
</CodeGroup>
<Check>
[Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 2,000th 😊)
</Check>
</Step>
<Step title="Install Crew from the AgentOps fork">
<Warning>
Expand Down
12 changes: 12 additions & 0 deletions docs/v1/examples/multion.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: 'Multion Examples'
description: 'Tracking Multion usage with AgentOps'
mode: "wide"
---

<iframe id="iframe" src={'notebooks/multion/Autonomous_web_browsing.html'}></iframe>
<iframe id="iframe" src={'notebooks/multion/Sample_browsing_agent.html'}></iframe>
<iframe id="iframe" src={'notebooks/multion/Step_by_step_web_browsing.html'}></iframe>
<iframe id="iframe" src={'notebooks/multion/Webpage_data_retrieval.html'}></iframe>

<script type="module" src="/scripts/full_iframe.js"></script>
230 changes: 230 additions & 0 deletions docs/v1/examples/notebooks/autogen/AgentChat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<!-- This file was generated by Pandoc -->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>AgentChat</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="https://app.agentops.ai/notebook_styles.css" />
</head>
<body>
<div id="bb6538d8-2a5d-4a99-b2c1-7130963e4f7b" class="cell markdown">
<h1 id="adding-agentops-to-an-existing-autogen-service">Adding AgentOps
to an existing Autogen service</h1>
<p><img src="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/images/external/autogen/autogen_integration.png?raw=true"/></p>
<p>To get started, you'll need to install the AgentOps package and <a
href="app.agentops.ai">set an API key</a>.</p>
<p>AgentOps automatically configures itself when it's initialized
meaning your agent run data will be tracked and logged to your AgentOps
account right away.</p>
</div>
<div id="d93f2339-7b99-4cf1-9232-c24faba49c7b" class="cell code"
data-execution_count="1">
<div class="sourceCode" id="cb1"><pre
class="sourceCode python"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> agentops</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> autogen <span class="im">import</span> ConversableAgent, UserProxyAgent</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co"># When initializing AgentOps, you can pass in optional tags to help filter sessions</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>agentops.init(api_key<span class="op">=</span><span class="st">&quot;...&quot;</span>, tags<span class="op">=</span>[<span class="st">&quot;simple-autogen-example&quot;</span>])</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">&quot;AgentOps is now running. You can view your session in the link above&quot;</span>)</span></code></pre></div>
<div class="output stream stderr">
<pre><code>🖇 AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=24c5d9f6-fb82-41e6-a468-2dc74a5318a3
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>AgentOps is now running. You can view your session in the link above
</code></pre>
</div>
</div>
<div id="7858f0f6-9aca-4cdb-a514-9fbf7e353d50" class="cell markdown">
<p>AutoGen will now start automatically tracking</p>
<ul>
<li>LLM prompts and completions</li>
<li>Token usage and costs</li>
<li>Agent names and actions</li>
<li>Correspondence between agents</li>
<li>Tool usage</li>
<li>Errors</li>
</ul>
</div>
<div id="2962d990-f7ef-43d8-ba09-d29bd8356d9f" class="cell code"
data-execution_count="2">
<div class="sourceCode" id="cb4"><pre
class="sourceCode python"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Define an openai api key for the agent configurations</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>openai_api_key <span class="op">=</span> <span class="st">&quot;...&quot;</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>config_list <span class="op">=</span> [</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> {<span class="st">&quot;model&quot;</span>: <span class="st">&quot;gpt-4-turbo&quot;</span>, <span class="st">&quot;api_key&quot;</span>: openai_api_key, <span class="st">&quot;tags&quot;</span>: [<span class="st">&quot;gpt-4&quot;</span>, <span class="st">&quot;tool&quot;</span>]}</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>]</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Create the agent that uses the LLM.</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a>assistant <span class="op">=</span> ConversableAgent(<span class="st">&quot;agent&quot;</span>, llm_config<span class="op">=</span>{<span class="st">&quot;config_list&quot;</span>: config_list})</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Create the agent that represents the user in the conversation.</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a>user_proxy <span class="op">=</span> UserProxyAgent(<span class="st">&quot;user&quot;</span>, code_execution_config<span class="op">=</span><span class="va">False</span>)</span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Let the assistant start the conversation. It will end when the user types &quot;exit&quot;.</span></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a>assistant.initiate_chat(user_proxy, message<span class="op">=</span><span class="st">&quot;How can I help you today?&quot;</span>)</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a><span class="co"># Close your AgentOps session to indicate that it completed.</span></span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a>agentops.end_session(<span class="st">&quot;Success&quot;</span>)</span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="st">&quot;Success! Visit your AgentOps dashboard to see the replay&quot;</span>)</span></code></pre></div>
<div class="output stream stdout">
<pre><code>agent (to user):

How can I help you today?

--------------------------------------------------------------------------------
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>Provide feedback to agent. Press enter to skip and use auto-reply, or type &#39;exit&#39; to end the conversation: Tell me a joke about AgentOps
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>user (to agent):

Tell me a joke about AgentOps

--------------------------------------------------------------------------------

&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; USING AUTO REPLY...
agent (to user):

Why don&#39;t AgentOps teams ever play hide and seek?

Because good luck hiding when they always know where everyone is supposed to be!

--------------------------------------------------------------------------------
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>Provide feedback to agent. Press enter to skip and use auto-reply, or type &#39;exit&#39; to end the conversation: Another
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>user (to agent):

Another

--------------------------------------------------------------------------------

&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; USING AUTO REPLY...
agent (to user):

Why did the AgentOps team bring a ladder to work?

Because they’re always reaching for high-level optimizations!

--------------------------------------------------------------------------------
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>Provide feedback to agent. Press enter to skip and use auto-reply, or type &#39;exit&#39; to end the conversation: exit
</code></pre>
</div>
<div class="output stream stderr">
<pre><code>🖇 AgentOps: This run&#39;s cost $0.001080
🖇 AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=24c5d9f6-fb82-41e6-a468-2dc74a5318a3
</code></pre>
</div>
<div class="output stream stdout">
<pre><code>Success! Visit your AgentOps dashboard to see the replay
</code></pre>
</div>
</div>
<div id="7b422137-903a-41ef-a4ca-95b50aea4138" class="cell markdown">
<p>You can view data on this run at <a
href="app.agentops.ai">app.agentops.ai</a>.</p>
<p>The dashboard will display LLM events for each message sent by each
agent, including those made by the human user.</p>
</div>
<div id="72993a75-1031-4874-aa26-0ef816a3256c" class="cell code">
<div class="sourceCode" id="cb13"><pre
class="sourceCode python"><code class="sourceCode python"></code></pre></div>
</div>
</body>
</html>
Loading

0 comments on commit 73d357d

Please sign in to comment.