diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.yml index 406a73517..303437e03 100644 --- a/.github/workflows/test-notebooks.yml +++ b/.github/workflows/test-notebooks.yml @@ -1,14 +1,7 @@ name: Test Notebooks on: - push: - branches: - - main - paths: - - "agentops/**" - - "examples/**" - - "tests/**" - - ".github/workflows/test-notebooks.yml" - pull_request_target: + pull_request: + types: [closed] branches: - main paths: @@ -43,13 +36,17 @@ jobs: echo "GROQ_API_KEY=${{ secrets.GROQ_API_KEY }}" >> .env echo "MULTION_API_KEY=${{ secrets.MULTION_API_KEY }}" >> .env echo "SERPER_API_KEY=${{ secrets.SERPER_API_KEY }}" >> .env + - name: Install AgentOps from main branch and remove agentops install from notebooks + run: | + pip install git+https://github.com/AgentOps-AI/agentops.git@main + find . -name '*.ipynb' -exec sed -i '/^%pip install.*agentops/d' {} + - name: Run notebooks and check for errors run: | mkdir -p logs exit_code=0 exclude_notebooks=( - "./examples/crew/job_posting.ipynb", + "./examples/crewai_examples/job_posting.ipynb", "./examples/demos/agentchat_agentops.ipynb" ) diff --git a/examples/anthropic-sdk/anthropic_example.ipynb b/examples/anthropic_examples/anthropic_example.ipynb similarity index 100% rename from examples/anthropic-sdk/anthropic_example.ipynb rename to examples/anthropic_examples/anthropic_example.ipynb diff --git a/examples/autogen/AgentChat.ipynb b/examples/autogen_examples/AgentChat.ipynb similarity index 99% rename from examples/autogen/AgentChat.ipynb rename to examples/autogen_examples/AgentChat.ipynb index 4de700ab3..85fd49910 100644 --- a/examples/autogen/AgentChat.ipynb +++ b/examples/autogen_examples/AgentChat.ipynb @@ -146,6 +146,7 @@ "except StdinNotImplementedError:\n", " # This is only necessary for AgentOps testing automation which is headless and will not have user input\n", " print(\"Stdin not implemented. Skipping initiate_chat\")\n", + " agentops.end_session(\"Indeterminate\")\n", "\n", "# Close your AgentOps session to indicate that it completed.\n", "agentops.end_session(\"Success\")\n", diff --git a/examples/autogen/MathAgent.ipynb b/examples/autogen_examples/MathAgent.ipynb similarity index 99% rename from examples/autogen/MathAgent.ipynb rename to examples/autogen_examples/MathAgent.ipynb index bf542594f..13bf58a81 100644 --- a/examples/autogen/MathAgent.ipynb +++ b/examples/autogen_examples/MathAgent.ipynb @@ -195,6 +195,7 @@ "except StdinNotImplementedError:\n", " # This is only necessary for AgentOps testing automation which is headless and will not have user input\n", " print(\"Stdin not implemented. Skipping initiate_chat\")\n", + " agentops.end_session(\"Indeterminate\")\n", "\n", "agentops.end_session(\"Success\")" ] diff --git a/examples/cohere-sdk/cohere_example.ipynb b/examples/cohere_examples/cohere_example.ipynb similarity index 100% rename from examples/cohere-sdk/cohere_example.ipynb rename to examples/cohere_examples/cohere_example.ipynb diff --git a/examples/crew/README.md b/examples/crewai_examples/README.md similarity index 100% rename from examples/crew/README.md rename to examples/crewai_examples/README.md diff --git a/examples/crew/job_posting.ipynb b/examples/crewai_examples/job_posting.ipynb similarity index 95% rename from examples/crew/job_posting.ipynb rename to examples/crewai_examples/job_posting.ipynb index eb3faaaac..4c118ac48 100644 --- a/examples/crew/job_posting.ipynb +++ b/examples/crewai_examples/job_posting.ipynb @@ -41,7 +41,10 @@ "from crewai_tools.tools import WebsiteSearchTool, SerperDevTool, FileReadTool\n", "import agentops\n", "import os\n", - "from dotenv import load_dotenv" + "from dotenv import load_dotenv\n", + "from IPython.core.error import (\n", + " StdinNotImplementedError,\n", + ") # only needed by AgentOps testing automation" ] }, { @@ -244,8 +247,13 @@ " ],\n", ")\n", "\n", - "# Kick off the process\n", - "result = crew.kickoff()\n", + "try:\n", + " # Kick off the process\n", + " result = crew.kickoff()\n", + "except StdinNotImplementedError:\n", + " # This is only necessary for AgentOps testing automation which is headless and will not have user input\n", + " print(\"Stdin not implemented. Skipping kickoff()\")\n", + " agentops.end_session(\"Indeterminate\")\n", "\n", "print(\"Job Posting Creation Process Completed.\")\n", "print(\"Final Job Posting:\")\n", diff --git a/examples/crew/markdown_validator.ipynb b/examples/crewai_examples/markdown_validator.ipynb similarity index 100% rename from examples/crew/markdown_validator.ipynb rename to examples/crewai_examples/markdown_validator.ipynb diff --git a/examples/demos/agentchat_agentops.ipynb b/examples/demos/agentchat_agentops.ipynb index 7b0d7b18e..2aa7a84e7 100644 --- a/examples/demos/agentchat_agentops.ipynb +++ b/examples/demos/agentchat_agentops.ipynb @@ -196,6 +196,7 @@ "except StdinNotImplementedError:\n", " # This is only necessary for AgentOps testing automation which is headless and will not have user input\n", " print(\"Stdin not implemented. Skipping initiate_chat\")\n", + " agentops.end_session(\"Indeterminate\")\n", "\n", "# Close your AgentOps session to indicate that it completed.\n", "agentops.end_session(\"Success\")" diff --git a/examples/langchain/langchain_examples.ipynb b/examples/langchain_examples/langchain_examples.ipynb similarity index 99% rename from examples/langchain/langchain_examples.ipynb rename to examples/langchain_examples/langchain_examples.ipynb index 361064c61..b087de3b7 100644 --- a/examples/langchain/langchain_examples.ipynb +++ b/examples/langchain_examples/langchain_examples.ipynb @@ -148,6 +148,10 @@ }, "outputs": [], "source": [ + "agentops_handler = AgentOpsLangchainCallbackHandler(\n", + " api_key=AGENTOPS_API_KEY, default_tags=[\"Langchain Example\"]\n", + ")\n", + "\n", "llm = ChatOpenAI(\n", " openai_api_key=OPENAI_API_KEY, callbacks=[agentops_handler], model=\"gpt-3.5-turbo\"\n", ")\n", diff --git a/examples/litellm-sdk/litellm_example.ipynb b/examples/litellm_examples/litellm_example.ipynb similarity index 100% rename from examples/litellm-sdk/litellm_example.ipynb rename to examples/litellm_examples/litellm_example.ipynb diff --git a/examples/multion/Autonomous_web_browsing.ipynb b/examples/multion_examples/Autonomous_web_browsing.ipynb similarity index 100% rename from examples/multion/Autonomous_web_browsing.ipynb rename to examples/multion_examples/Autonomous_web_browsing.ipynb diff --git a/examples/multion/Sample_browsing_agent.ipynb b/examples/multion_examples/Sample_browsing_agent.ipynb similarity index 100% rename from examples/multion/Sample_browsing_agent.ipynb rename to examples/multion_examples/Sample_browsing_agent.ipynb diff --git a/examples/multion/Step_by_step_web_browsing.ipynb b/examples/multion_examples/Step_by_step_web_browsing.ipynb similarity index 100% rename from examples/multion/Step_by_step_web_browsing.ipynb rename to examples/multion_examples/Step_by_step_web_browsing.ipynb diff --git a/examples/multion/Webpage_data_retrieval.ipynb b/examples/multion_examples/Webpage_data_retrieval.ipynb similarity index 100% rename from examples/multion/Webpage_data_retrieval.ipynb rename to examples/multion_examples/Webpage_data_retrieval.ipynb