Skip to content

Commit 92c621e

Browse files
authored
fix: Updated examples and relevant integrations & examples in the documentation pages (#1029)
* dawn of the new `openai-agents` * the first purge * the purge * the purge anarchy * the purge election year * anthropic good * openai-agents good * smolagent @Dwij1704 fix me no touch git no conflict * watsonx @Dwij1704 make good * microsoft pyautogen good; dis real autogen? * grok is this true? * crewai good @areibman happy * i so sorry i leave you behind * gemini good @AtomSilverman happy * langchain good devs unhappy * litellm good @areibman happy too * the purge forever * openai good me happy * ag2 good; dis real autogen? * docs tell how to set api keys * The Notebook(s) * Gavin: "Behold—our fresh logo. It signifies innovation, synergy, and exponential growth." * dem docs be sexy again * quick lang fix * quickstart vroooom * the last one * GH copilot happy :) * oh that damn ``` * oh my `\n` * now i know why i failed in spelling bee * the last one * script kiddie * README.md examples * new action new problems * me forget v2 * add source file comment * make action better * better reorder * redundant content * make action more efficient using `awk` * script overhaul * rename google adk example * correct README.md * push PR only on merge * remove redundant code from script * use github context in action * make branch name easier * ag2 comes first in alphabetical order * purge `mode: wide` * its `agents_sdk` now * too big tool notebook * google looking nice and dandy * latest and clean integrations docs * wrong line in place * python scripts with README files with ❤️ for @tcdent * ruff y u so rough * fix for notebook json
1 parent 79c38c5 commit 92c621e

File tree

214 files changed

+12151
-16129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+12151
-16129
lines changed

.github/workflows/add-notebook-examples-to-docs.yml

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
push:
55
branches:
66
- main
7+
# TODO: Remove this branch once the workflow is stable
8+
- fix/examples-cleanup
79
paths:
810
- 'examples/**'
9-
- 'docs/v1/examples/**'
10-
- '.github/workflows/add-notebook-examples-to-docs.yml'
11-
11+
- 'docs/v2/examples/**'
1212
workflow_dispatch:
1313

1414
permissions:
@@ -21,49 +21,118 @@ jobs:
2121
steps:
2222
- name: Checkout repository
2323
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
2426

2527
- name: Set up Python
2628
uses: actions/setup-python@v4
2729
with:
2830
python-version: '3.x'
2931

3032
- name: Install dependencies
31-
run: |
32-
pip install jupyter nbconvert
33+
run: pip install jupyter nbconvert
3334

34-
- name: Convert notebooks to markdown and add to docs
35+
- name: Detect and process notebooks
36+
id: process
3537
run: |
36-
set -x # Enable debug mode
37-
for file in docs/v1/examples/*.mdx; do
38-
echo "Processing file: $file"
39-
source_file=$(grep -oP '(?<=\{/\* SOURCE_FILE: ).*(?= \*/\})' "$file" || true)
40-
if [[ -z "$source_file" ]]; then
41-
continue
38+
# Determine comparison range
39+
case "${{ github.event_name }}" in
40+
"push")
41+
BASE_SHA="${{ github.event.before }}"
42+
[[ "$BASE_SHA" == "0000000000000000000000000000000000000000" ]] && BASE_SHA="$(git hash-object -t tree /dev/null)"
43+
HEAD_SHA="${{ github.event.after }}"
44+
;;
45+
"pull_request")
46+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
47+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
48+
;;
49+
"workflow_dispatch")
50+
git fetch origin "${{ github.event.repository.default_branch }}" --depth=50
51+
BASE_SHA="origin/${{ github.event.repository.default_branch }}"
52+
HEAD_SHA="HEAD"
53+
;;
54+
*)
55+
exit 1
56+
;;
57+
esac
58+
59+
# Get changed files and filter in one pass
60+
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
61+
62+
# Use arrays for better performance
63+
declare -A notebooks_set
64+
65+
# Process notebooks directly from changed files
66+
while IFS= read -r file; do
67+
if [[ "$file" =~ ^examples/.*\.ipynb$ ]]; then
68+
notebooks_set["$file"]=1
69+
elif [[ "$file" =~ ^docs/v2/examples/.*\.mdx$ ]] && [[ -f "$file" ]]; then
70+
# Extract source notebook from MDX file
71+
source_notebook=$(grep -oP '(?<=SOURCE_FILE: )[^ ]+' "$file" 2>/dev/null || true)
72+
if [[ -n "$source_notebook" && -f "$source_notebook" ]]; then
73+
notebooks_set["$source_notebook"]=1
74+
fi
4275
fi
43-
echo "Source file: $source_file"
44-
if [[ -f "$source_file" ]]; then
45-
echo "Converting notebook to markdown"
46-
jupyter nbconvert --to markdown "$source_file" || { echo "Error: Failed to convert $source_file" >&2; continue; }
47-
markdown_file="${source_file%.ipynb}.md"
48-
echo "Removing existing content after {/* SOURCE_FILE: ... */}"
49-
sed -i '\#{/\* SOURCE_FILE:#,$d' "$file"
50-
echo "Appending markdown to $file"
51-
echo -e "{/* SOURCE_FILE: $source_file */}\n" >> "$file"
52-
cat "$markdown_file" >> "$file" || { echo "Error: Failed to append markdown to $file" >&2; continue; }
53-
rm "$markdown_file" || { echo "Error: Failed to remove $markdown_file" >&2; continue; }
76+
done <<< "$CHANGED_FILES"
77+
78+
# Exit if no notebooks found
79+
[[ ${#notebooks_set[@]} -eq 0 ]] && exit 0
80+
81+
# Process each notebook and track results
82+
failed_count=0
83+
processed_notebooks=""
84+
for notebook in "${!notebooks_set[@]}"; do
85+
if python examples/generate_documentation.py "$notebook"; then
86+
processed_notebooks="$processed_notebooks$notebook"$'\n'
5487
else
55-
echo "Error: Source file not found: $source_file" >&2
88+
((failed_count++))
5689
fi
5790
done
91+
92+
[[ $failed_count -gt 0 ]] && exit 1
93+
94+
# Get modified files for PR description
95+
modified_files=$(git status --porcelain | grep -E '^\s*[AM]' | awk '{print $2}' | sort)
96+
97+
# Save outputs for PR
98+
echo "processed_notebooks<<EOF" >> $GITHUB_OUTPUT
99+
echo "$processed_notebooks" >> $GITHUB_OUTPUT
100+
echo "EOF" >> $GITHUB_OUTPUT
101+
102+
echo "modified_files<<EOF" >> $GITHUB_OUTPUT
103+
echo "$modified_files" >> $GITHUB_OUTPUT
104+
echo "EOF" >> $GITHUB_OUTPUT
58105
59106
- name: Create Pull Request
60107
uses: peter-evans/create-pull-request@v7
61108
with:
62-
committer: Howard Gil <howardbgil@gmail.com>
63-
commit-message: GitHub Action - Update examples in docs from notebooks
64-
title: GitHub Action - Update examples in docs from notebooks
65-
body: Changes detected in examples/** or docs/v1/examples/** triggered an update of the docs/v1/examples/**.mdx files to incorporate markdown from the corresponding notebook in examples/**.
66-
branch: update-examples-in-docs-from-notebooks
109+
token: ${{ secrets.GITHUB_TOKEN }}
110+
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
111+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
112+
commit-message: "docs: update examples from notebooks"
113+
title: "docs: update examples from notebooks"
114+
body: |
115+
Updates documentation examples from their source notebooks.
116+
117+
**Triggered by:** @${{ github.actor }}
118+
**Event:** ${{ github.event_name }}
119+
${{ steps.process.outputs.processed_notebooks && format('
120+
121+
## Processed Notebooks
122+
```
123+
{0}
124+
```', steps.process.outputs.processed_notebooks) || '' }}
125+
${{ steps.process.outputs.modified_files && format('
126+
127+
## Modified Files
128+
```
129+
{0}
130+
```', steps.process.outputs.modified_files) || '' }}
131+
branch: update-examples-docs
67132
delete-branch: true
68-
assignees: HowieG,siyangqiu,bboynton97,areibman
69-
reviewers: HowieG,siyangqiu,bboynton97,areibman
133+
# TODO: Uncomment for production use
134+
# assignees: the-praxs,bboynton97,areibman
135+
# reviewers: the-praxs,bboynton97,areibman
136+
# TODO: Remove this once the workflow is stable
137+
assignees: the-praxs
138+
reviewers: the-praxs

.github/workflows/test-notebooks.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Build multi-agent systems with tools, handoffs, and guardrails. AgentOps nativel
222222
pip install openai-agents
223223
```
224224

225-
- [AgentOps integration example](https://docs.agentops.ai/v1/integrations/agentssdk)
225+
- [AgentOps integration example](https://docs.agentops.ai/v1/integrations/agents_sdk)
226226
- [Official OpenAI Agents SDK documentation](https://openai.github.io/openai-agents-python/)
227227

228228
### CrewAI 🛶

docs/images/external/autogen/autogen-logo.svg

Lines changed: 1 addition & 0 deletions
Loading
File renamed without changes.

docs/mint.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{
9696
"group": "Integrations",
9797
"pages": [
98-
"v1/integrations/agentssdk",
98+
"v1/integrations/agents_sdk",
9999
"v1/integrations/ai21",
100100
"v1/integrations/anthropic",
101101
"v1/integrations/autogen",
@@ -168,16 +168,17 @@
168168
"group": "Integrations",
169169
"pages": [
170170
"v2/integrations/ag2",
171-
"v2/integrations/autogen",
172171
"v2/integrations/anthropic",
172+
"v2/integrations/autogen",
173173
"v2/integrations/crewai",
174174
"v2/integrations/google_adk",
175-
"v2/integrations/gemini",
175+
"v2/integrations/google_generative_ai",
176176
"v2/integrations/langchain",
177177
"v2/integrations/litellm",
178178
"v2/integrations/openai",
179-
"v2/integrations/agentssdk",
180-
"v2/integrations/ibm_watsonx_ai"
179+
"v2/integrations/agents_sdk",
180+
"v2/integrations/ibm_watsonx_ai",
181+
"v2/integrations/xai"
181182
],
182183
"version": "v2"
183184
},

docs/v1/introduction.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mode: "wide"
77
## Integrate with developer favorite agent frameworks
88

99
<CardGroup cols={2}>
10-
<Card title="OpenAI Agents SDK" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/openai/openai-logomark.png?raw=true" alt="OpenAI Agents SDK" />} iconType="image" href="/v1/integrations/agentssdk" />
10+
<Card title="OpenAI Agents SDK" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/openai/openai-logomark.png?raw=true" alt="OpenAI Agents SDK" />} iconType="image" href="/v1/integrations/agents_sdk" />
1111
<Card title="CrewAI" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/v1/img/docs-icons/crew.png?raw=true" alt="CrewAI"/>} iconType="image" href="/v1/integrations/crewai" />
1212
<Card title="AG2" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/autogen/ag2.svg?raw=true" alt="AG2"/>} iconType="image" href="/v1/integrations/autogen" />
1313
<Card title="AutoGen" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/microsoft/microsoft_logo.svg?raw=true" alt="AutoGen" />} iconType="image" href="/v1/integrations/autogen" />

0 commit comments

Comments
 (0)