Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing job_posting and calling end_session in notebook automation #390

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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
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
Loading