Skip to content

Commit

Permalink
Fixing job_posting and calling end_session in notebook automation (#390)
Browse files Browse the repository at this point in the history
* adding clarity

* Renamed folders for consistency and clarity

* addded back line i mistakenly deleted when refactoring examples

* triggering automation only on merges to main from pull request now

* updated test-notebooks.yml to not run job_posting at new crewai_examples location

* Making sure agentops installed from main not pypi for automation

* black formatting
  • Loading branch information
HowieG authored Sep 17, 2024
1 parent 871b9fb commit 8161133
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 13 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions examples/demos/agentchat_agentops.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
File renamed without changes.

0 comments on commit 8161133

Please sign in to comment.