Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
Automating addition of examples to docs (#396)
Howard Gilc3b400f27c2f
diff --git a/.github/workflows/add-markdown-examples-to-docs.yml b/.github/workflows/add-markdown-examples-to-docs.ymlnew file mode 100644index 00000000..03e62824--- /dev/null+++ b/.github/workflows/add-markdown-examples-to-docs.yml@@ -0,0 +1,76 @@+name: Update Docs++on:+ push:+ branches:+ - main+ paths:+ - 'examples/**'+ - 'docs/v1/examples/**'++jobs:+ add-markdown-examples-to-docs:+ runs-on: ubuntu-latest+ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Set up Python+ uses: actions/setup-python@v4+ with:+ python-version: '3.x'++ - name: Install dependencies+ run: |+ pip install jupyter nbconvert++ - name: Convert notebooks to markdown and add to docs+ run: |+ set -x # Enable debug mode+ for file in docs/v1/examples/*.mdx; do+ echo "Processing file: $file"+ source_file=$(grep -oP '(?<=\{/\* SOURCE_FILE: ).*(?= \*/\})' "$file" || true)+ if [[ -z "$source_file" ]]; then+ echo "No source file found in $file, skipping..."+ continue+ fi+ echo "Source file: $source_file"+ if [[ -f "$source_file" ]]; then+ echo "Converting notebook to markdown"+ jupyter nbconvert --to markdown "$source_file" || { echo "Failed to convert $source_file"; continue; }+ markdown_file="${source_file%.ipynb}.md"+ echo "Appending markdown to $file"+ echo -e "\n\n" >> "$file"+ cat "$markdown_file" >> "$file" || { echo "Failed to append markdown to $file"; continue; }+ echo "Contents of $file after appending markdown:"+ cat "$file"+ echo "Removing temporary markdown file"+ rm "$markdown_file" || { echo "Failed to remove $markdown_file"; continue; }+ else+ echo "Source file not found: $source_file"+ fi+ done++ - name: Commit changes+ run: |+ git config --local user.email "[email protected]"+ git config --local user.name "GitHub Action"+ git add docs/v1/examples/*.mdx+ git diff --quiet && git diff --staged --quiet || git commit -m "GitHub Action: Update examples in docs from notebooks"++ - name: Create Pull Request+ uses: peter-evans/create-pull-request@v5+ with:+ token: ${{ secrets.GITHUB_TOKEN }}+ commit-message: Update examples in docs from notebooks+ title: 'Update examples in docs from notebooks'+ body: |+ This PR updates the examples in the docs from the corresponding notebooks.+ Please review the changes before merging.+ branch: update-docs-examples+ base: main+# - name: Push changes+# uses: ad-m/github-push-action@master+# with:+# github_token: ${{ secrets.GITHUB_TOKEN }}+# branch: main\ No newline at end of filediff --git a/docs/v1/examples/langchain.mdx b/docs/v1/examples/langchain.mdxindex dd59d4bd..5e6c73a4 100644--- a/docs/v1/examples/langchain.mdx+++ b/docs/v1/examples/langchain.mdx@@ -5,5 +5,4 @@ mode: "wide"---_View Notebook on <a href={'https://github.com/AgentOps-AI/agentops/blob/48ae12d4e4e085eed57346f1c40a054097431937/examples/langchain_examples.ipynb'} target={'_blank'}>Github</a>_-<div id="notebook" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/langchain_examples.html"></div>-<script src="/scripts/use_notebook.js"></script>\ No newline at end of file+{/* SOURCE_FILE: examples/langchain_examples.ipynb */}\ No newline at end of filediff --git a/docs/v1/examples/multi_agent.mdx b/docs/v1/examples/multi_agent.mdxindex 6ceb1deb..40133490 100644--- a/docs/v1/examples/multi_agent.mdx+++ b/docs/v1/examples/multi_agent.mdx@@ -5,5 +5,4 @@ mode: "wide"---_View Notebook on <a href={'https://github.com/AgentOps-AI/agentops/blob/main/examples/multi_agent_example.ipynb'} target={'_blank'}>Github</a>_-<div id="notebook1" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multi_agent_example.html"></div>-<script src="/scripts/use_notebook.js"></script>+{/* SOURCE_FILE: examples/multi_agent_example.ipynb */}\ No newline at end of filediff --git a/docs/v1/examples/multi_session.mdx b/docs/v1/examples/multi_session.mdxindex 976727eb..794a7865 100644--- a/docs/v1/examples/multi_session.mdx+++ b/docs/v1/examples/multi_session.mdx@@ -5,5 +5,4 @@ mode: "wide"---_View Notebook on <a href={'https://github.com/AgentOps-AI/agentops/blob/main/examples/multi_session_llm.ipynb'} target={'_blank'}>Github</a>_-<div id="notebook" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multi_session_llm.html"></div>-<script src="/scripts/use_notebook.js"></script>\ No newline at end of file+{ /* SOURCE_FILE: examples/multi_session_llm.ipynb */}\ No newline at end of filediff --git a/docs/v1/examples/multion.mdx b/docs/v1/examples/multion.mdxindex f7a90a82..6b1cbefe 100644--- a/docs/v1/examples/multion.mdx+++ b/docs/v1/examples/multion.mdx@@ -4,11 +4,6 @@ description: 'Tracking Multion usage with AgentOps'mode: "wide"----<div id="notebook1" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multion/Autonomous_web_browsing.html"></div>-<hr/>-<div id="notebook2" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multion/Sample_browsing_agent.html"></div>-<hr/>-<div id="notebook3" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multion/Step_by_step_web_browsing.html"></div>-<hr/>-<div id="notebook4" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/multion/Webpage_data_retrieval.html"></div>-<script src="/scripts/use_notebook.js"></script>\ No newline at end of file+_View All Notebooks on <a href={'https://github.com/AgentOps-AI/agentops/blob/main/examples/multion_examples/'} target={'_blank'}>Github</a>_++{/* SOURCE_FILE: examples/multion_examples/Autonomous_web_browsing.ipynb */}diff --git a/docs/v1/examples/recording_events.mdx b/docs/v1/examples/recording_events.mdxindex 23773521..7d08f7f7 100644--- a/docs/v1/examples/recording_events.mdx+++ b/docs/v1/examples/recording_events.mdx@@ -5,5 +5,4 @@ mode: "wide"---_View Notebook on <a href={'https://github.com/AgentOps-AI/agentops/blob/main/examples/recording-events.ipynb'} target={'_blank'}>Github</a>_-<div id="notebook" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/recording-events.html"></div>-<script src="/scripts/use_notebook.js"></script>\ No newline at end of file+{/* SOURCE_FILE: examples/recording-events.ipynb */}\ No newline at end of filediff --git a/docs/v1/examples/simple_agent.mdx b/docs/v1/examples/simple_agent.mdxindex c5f599cf..07a41318 100644--- a/docs/v1/examples/simple_agent.mdx+++ b/docs/v1/examples/simple_agent.mdx@@ -5,5 +5,4 @@ mode: "wide"---_View Notebook on <a href={'https://github.com/AgentOps-AI/agentops/blob/main/examples/openai-gpt.ipynb'} target={'_blank'}>Github</a>_-<div id="notebook" data-content-file="https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/v1/examples/notebooks/openai-gpt.html"></div>-<script src="/scripts/use_notebook.js"></script>+{/* SOURCE_FILE: examples/openai-gpt.ipynb */}