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

Disable strong cache in integration tests #96

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4673b7b
bump version
whimo Jul 22, 2024
51b678b
add images in docs
whimo Jul 22, 2024
d4663c5
Support crewai tools (#63)
BespalovSergey Jul 25, 2024
769cf79
bump version
whimo Jul 25, 2024
b766d89
temp disable indeterministic test
whimo Jul 25, 2024
a5542c5
Generalize common graph store tests (#68)
whimo Jul 31, 2024
77b55be
Update README.md
whimo Aug 14, 2024
8646784
Replicate image api (#69)
ZmeiGorynych Aug 23, 2024
ad47d3d
Add langchain-openai dependency
whimo Aug 25, 2024
080faad
Supply prompt prefix as a list of messages (#70)
whimo Aug 25, 2024
176c0a0
bump version
whimo Aug 25, 2024
d8b731e
minor tweaks (#67)
ZmeiGorynych Aug 26, 2024
b781cc1
Relax Python version upper constraint
whimo Aug 28, 2024
a0b4065
Remove optional dependencies from Poetry resolver (#72)
whimo Aug 29, 2024
423ef8e
Support custom callbacks in Langchain agents + streaming demo (#73)
whimo Aug 30, 2024
bb43aad
bump version
whimo Aug 30, 2024
169c6e1
Fix typo in example
whimo Aug 30, 2024
09d1b0d
Add compatibility checks for `config` parameter in MotleyTool's Llama…
whimo Sep 2, 2024
e59f830
Support various LLM providers (Ollama, Groq, Together...) + docs (#75)
whimo Sep 6, 2024
a758348
bump version
whimo Sep 6, 2024
8b85a9a
Unify output handlers and regular tools, improve exception management…
whimo Sep 11, 2024
78ee38a
Fix link in README
whimo Sep 16, 2024
babf140
Support format strings in prompt_prefix (#77)
ViStefan Sep 17, 2024
ec699d3
populate __version__ (#78)
ViStefan Sep 17, 2024
c332e0e
Fix CrewAI delegation (#79)
whimo Sep 19, 2024
713ca46
Remove explicit setuptools dependency (#80)
whimo Sep 20, 2024
191771b
bump version
whimo Sep 20, 2024
e51e1fc
Fixes for asynchronous crew execution (#81)
whimo Sep 23, 2024
679de70
disable strong cache in tests
ViStefan Sep 26, 2024
8bd6a99
secrets for integration tests
ViStefan Sep 26, 2024
daaafa0
Event-driven orchestration demo with Faust (#85)
whimo Sep 27, 2024
bac5843
Update Event-driven orchestration for AI systems.ipynb
ZmeiGorynych Sep 27, 2024
246c683
Update Event-driven orchestration for AI systems.ipynb
ZmeiGorynych Sep 27, 2024
260ff53
Support custom LLMs in research agent (#86)
whimo Sep 27, 2024
068e396
Upgrade Langchain to v0.3 (#82)
whimo Sep 30, 2024
010a05e
Retry mechanism in MotleyTool (#88)
whimo Sep 30, 2024
3fc4970
Merge branch 'main' into no_strong_cache
whimo Sep 30, 2024
20a25f6
Fix Autogen example
whimo Sep 30, 2024
db2c11d
disable results writing in integration tests
whimo Sep 30, 2024
439c3e1
minor fix
whimo Sep 30, 2024
22a5fc1
bump version
whimo Oct 1, 2024
1fc9bfd
use cache in tests
ViStefan Oct 2, 2024
13482eb
disallow parallel test execution
ViStefan Oct 2, 2024
1e14d6d
bump version
whimo Oct 1, 2024
0de4899
disable strong cache in tests
ViStefan Sep 26, 2024
e0bcb0a
use cache in tests
ViStefan Oct 2, 2024
f5888c6
install external dependencies in examples, retry duckduckgo ratelimits
ViStefan Oct 10, 2024
a4d8e8b
install external dependencies in examples, retry duckduckgo ratelimits
ViStefan Oct 10, 2024
7f99f9b
integration tests workflow concurrency
ViStefan Oct 10, 2024
716e601
remove unneded concurrency mapping
ViStefan Oct 10, 2024
aaff71a
RetryConfig import for AutoGen example
ViStefan Oct 10, 2024
6ede710
wip: skip using autogen test
ViStefan Oct 10, 2024
eb42d67
increase number of retries for duckduckgo
ViStefan Oct 14, 2024
78117f5
Support agent app & async tools (#89)
whimo Oct 14, 2024
8576f40
restore keys for test cache
ViStefan Oct 14, 2024
8a61ed1
bump duckduckgo-search version
ViStefan Oct 15, 2024
e54d301
wip: disable blog_with_images_test
ViStefan Oct 15, 2024
acb5843
Update README.md
whimo Oct 16, 2024
252f0e8
Customer support app & event driven workflows docs (#92)
whimo Oct 16, 2024
4b4f046
bump version
whimo Oct 17, 2024
0f49c45
Fixes for async tools & doc updates (#93)
whimo Oct 17, 2024
66fd10c
Update README.md
whimo Oct 17, 2024
a21ebd9
Update Multi-step research agent.ipynb with local embeddings example …
iSevenDays Oct 21, 2024
2696464
Fix research agent notebook
whimo Oct 21, 2024
080d861
Support AzureOpenAI LLMs & fix research agent defaulting to OpenAI (#94)
whimo Oct 25, 2024
1a29759
bump version
whimo Oct 25, 2024
5234da5
Mention Azure OpenAI in docs
whimo Oct 25, 2024
1942847
skip blog with images test on windows workers
ViStefan Oct 29, 2024
a9ca9b8
Merge remote-tracking branch 'origin/main' into no_strong_cache
ViStefan Oct 30, 2024
3b8c776
Merge branch 'main' into no_strong_cache
ViStefan Oct 30, 2024
dc6b5a2
disable blog with images test
ViStefan Oct 30, 2024
ccd16d5
raise duckduckgo version
ViStefan Oct 30, 2024
8657206
Remove version constraint for duckduckgo_search in examples
whimo Nov 3, 2024
3578e75
Reusable workflow for integration tests
ViStefan Nov 26, 2024
8981e98
Job dependencies in integration tests
ViStefan Nov 26, 2024
f964cec
Sane naming for test groups
ViStefan Nov 26, 2024
11fac3a
Github action booleans magic
ViStefan Nov 26, 2024
8e845d2
Naming test and boolean magic
ViStefan Nov 26, 2024
3cfef05
File renaming was a bad idea
ViStefan Nov 26, 2024
456178f
Test against upper version of python
ViStefan Nov 26, 2024
9ffc867
Pass secrets to separate workflow
ViStefan Dec 2, 2024
a781915
Enable test cache on windows runners
ViStefan Dec 2, 2024
583b675
Bump ddg-search version
ViStefan Dec 2, 2024
ff091ad
Output log in tests
ViStefan Dec 13, 2024
f05da2c
Merge remote-tracking branch 'refs/remotes/origin/main' into no_stron…
ViStefan Dec 13, 2024
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
58 changes: 14 additions & 44 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,26 @@ on:
branches:
- main

# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
# a limited number of job runners to be active at the same time, so it's better to cancel
# pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
pre-test:
# default smoke test against python-3.10 on ubuntu-latest
uses: ./.github/workflows/integration_test_workflow.yml
secrets:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}

integration-test:
needs: pre-test
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pip install -U poetry

- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config installer.parallel true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install extra dependencies
run: poetry run pip install -r requirements-extra.txt

- name: Install dependencies
run: poetry install --no-interaction --all-extras

- name: Run integration tests
env:
OPENAI_API_KEY: fake_key_1337
TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache
run: poetry run python tests/run_integration_tests.py
uses: ./.github/workflows/integration_test_workflow.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
secrets:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
52 changes: 8 additions & 44 deletions .github/workflows/integration_test_minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,20 @@ on:
branches:
- main

# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
# a limited number of job runners to be active at the same time, so it's better to cancel
# pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
minimal-test:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pip install -U poetry

- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config installer.parallel true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install extra dependencies
run: poetry run pip install -r requirements-extra.txt

- name: Install dependencies
run: poetry install --no-interaction

- name: Run integration tests
env:
OPENAI_API_KEY: fake_key_1337
TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache
run: poetry run python tests/run_integration_tests.py --minimal-only
uses: ./.github/workflows/integration_test_workflow.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
minimal-only: true
secrets:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
81 changes: 81 additions & 0 deletions .github/workflows/integration_test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Integration test workflow

on:
workflow_call:
inputs:
os:
default: ubuntu-latest
type: string
python-version:
default: "3.12"
type: string
minimal-only:
default: false
type: boolean
secrets:
openai-api-key:
required: true


jobs:
test:
environment: integration_test
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ inputs.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install poetry
run: pip install -U poetry

- name: Configure poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config installer.parallel true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Load test cache
uses: actions/cache@v4
with:
path: tests/itest_cache
enableCrossOsArchive: true
key: integration-tests-cache
restore-keys: |
integration-tests-cache

- name: Install extra dependencies
run: poetry run pip install -r requirements-extra.txt

- name: Install minimal dependencies
if: ${{ inputs.minimal-only }}
run: poetry install --no-interaction

- name: Install dependencies
if: ${{ !inputs.minimal-only }}
run: poetry install --no-interaction --all-extras

- name: Run minimal integration tests
env:
OPENAI_API_KEY: ${{ secrets.openai-api-key }}
TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache
if: ${{ inputs.minimal-only }}
run: poetry run python tests/run_integration_tests.py --minimal-only --os ${{ runner.os }}

- name: Run integration tests
env:
OPENAI_API_KEY: ${{ secrets.openai-api-key }}
TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache
if: ${{ !inputs.minimal-only }}
run: poetry run python tests/run_integration_tests.py --os ${{ runner.os }}
24 changes: 19 additions & 5 deletions examples/Advanced output handling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,25 @@
"This should give a good understanding of output handler semantics and prepare you to build your own ones."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install lunary package if you need logging."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install lunary==1.1.5"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -860,8 +876,6 @@
"\n",
"Let's proceed to return the final result.\n",
"\n",
"\n",
"\n",
"\u001b[0mCritic response: OK\n",
"\u001b[32;1m\u001b[1;3m('def bubble_sort(array):\\n \"\"\"\\n Sorts an array using the bubble sort algorithm.\\n\\n The bubble sort algorithm works by repeatedly stepping through the list to be sorted,\\n comparing each pair of adjacent items and swapping them if they are in the wrong order.\\n This process is repeated until the list is sorted. The algorithm gets its name because\\n smaller elements \\'bubble\\' to the top of the list.\\n\\n Parameters:\\n array (list): The list of elements to be sorted.\\n\\n Returns:\\n list: The sorted list.\\n\\n Time Complexity:\\n - Worst and Average Case: O(n^2)\\n - Best Case: O(n) when the list is already sorted\\n\\n Space Complexity:\\n - O(1) as it is an in-place sorting algorithm\\n \"\"\"\\n length = len(array)\\n for i in range(length):\\n swapped = False\\n for j in range(0, length - i - 1):\\n if array[j] > array[j + 1]:\\n # Swap if the element found is greater than the next element\\n array[j], array[j + 1] = array[j + 1], array[j]\\n swapped = True\\n # If no elements were swapped, the array is already sorted\\n if not swapped:\\n break\\n return array\\n\\n# Test the bubble sort function with various cases\\ntest_cases = [\\n [64, 34, 25, 12, 22, 11, 90],\\n [],\\n [1],\\n [2, 1],\\n [3, 3, 3],\\n [5, 1, 4, 2, 8],\\n [-1, -3, -2, -5, -4],\\n [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],\\n [7, 7, 7, 7, 7]\\n]\\n\\nfor i, sample_list in enumerate(test_cases):\\n sorted_list = bubble_sort(sample_list.copy())\\n print(f\"Test case {i + 1}: Original: {sample_list}, Sorted: {sorted_list}\")', \"The bubble sort algorithm works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. This process is repeated until the list is sorted. The algorithm gets its name because smaller elements 'bubble' to the top of the list. The outer loop runs n times, and the inner loop runs n-i-1 times, where n is the length of the list and i is the current iteration of the outer loop. An optimization is added with a flag to detect if any swapping happened in the inner loop. If no swapping happened, the list is already sorted, and the loop can be terminated early. The time complexity of bubble sort is O(n^2) in the worst and average cases, and O(n) in the best case when the list is already sorted. The space complexity is O(1) as it is an in-place sorting algorithm.\")\u001b[0m\n",
"\n",
Expand Down Expand Up @@ -1183,9 +1197,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
31 changes: 27 additions & 4 deletions examples/Blog with Images.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"cell_type": "markdown",
"id": "16b8ccc4-b34b-47c3-94ee-cbd82ef4c8f2",
"id": "bf3534fb-ed51-4a82-ad66-71259b2e282f",
"metadata": {},
"source": [
"We use this example of creating a web search-based blog with illustrations to show how to \n",
Expand All @@ -20,9 +20,32 @@
"* create tasks and link them using the >> operator"
]
},
{
"cell_type": "markdown",
"id": "6ab41b51-2064-4623-866b-f4310d062425",
"metadata": {},
"source": [
"Let's install external dependencies for the example."
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "e8d44edb-4841-4f3c-822c-136276606e09",
"metadata": {},
"outputs": [],
"source": [
"%pip install duckduckgo-search\n",
"%pip install llama-index\n",
"%pip install crewai==0.51.1 --no-deps\n",
"\n",
"# install lunary if you need logging\n",
"%pip install lunary==1.1.5"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2596164c",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -84,7 +107,7 @@
"source": [
"search_tool = MotleyTool.from_supported_tool(\n",
" DuckDuckGoSearchRun(),\n",
" retry_config=RetryConfig(max_retries=5) # for retrying rate limit errors\n",
" retry_config=RetryConfig(max_retries=7) # for retrying rate limit errors\n",
")\n",
"\n",
"researcher = CrewAIMotleyAgent(\n",
Expand Down Expand Up @@ -518,7 +541,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.6"
}
},
"nbformat": 4,
Expand Down
28 changes: 24 additions & 4 deletions examples/Math via python code with a single agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,30 @@
"The point of this example is to illustrate that for agents that have an AgentExecutor (which most frameworks have apart from Autogen), the approach from [MathChat](https://microsoft.github.io/autogen/blog/2023/06/28/MathChat/) can be done with a single agent, as the second conversation partner there just plays the role of an AgentExecutor."
]
},
{
"cell_type": "markdown",
"id": "92b1d63b-b288-46f5-8eb7-19ee56853e94",
"metadata": {},
"source": [
"Let's install external dependencies for the example."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e5fc0be9-1d35-4902-9a1e-bd19bb119f4a",
"metadata": {},
"outputs": [],
"source": [
"%pip install crewai==0.51.1 --no-deps\n",
"\n",
"# install lunary if you need logging\n",
"%pip install lunary==1.1.5"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "51527a55-d470-4509-9930-01466e3f78f3",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -772,8 +793,7 @@
],
"source": [
"from IPython.display import display, Math, Latex\n",
"for line in task.output.split(\"\\n\"):\n",
" display(Latex(line))"
"display(Latex(task.output))"
]
},
{
Expand Down Expand Up @@ -803,7 +823,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.12.6"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/Multi-step research agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"Question: Why did Arjuna kill Karna, his half-brother?\n",
"Answer: Arjuna killed Karna, his half-brother, during their duel on the battlefield of Kurukshetra. The pivotal moment came when Karna's chariot got stuck in the mud, and he requested Arjuna and Krishna to honorably allow him to free his chariot. Krishna responded by reminding Karna of his past dishonorable actions, such as humiliating Draupadi and killing Abhimanyu, thereby justifying Arjuna's actions against Karna. Additionally, when Karna attempted to use the Brahmastra, he suddenly forgot the mantra, which can be seen as divine intervention. Krishna's words and the subsequent events reinforced Arjuna's resolve to kill Karna, aligning with his duty and dharma as a warrior.\n",
"To explore the graph:\n",
"docker run -p 8000:8000 -v /var/folders/fv/tyhll76x0fn6l7j_q2nhvyg00000gn/T/tmp4obi9n3p/kuzu_db:/database --rm kuzudb/explorer:latest\n",
"docker run -p 8000:8000 -v /tmp/tmp5gpyhq4x/kuzu_db:/database --rm kuzudb/explorer:0.4.2\n",
"And in the kuzu explorer at http://localhost:8000 enter\n",
"MATCH (A)-[r]->(B) RETURN *;\n"
]
Expand All @@ -266,7 +266,7 @@
"print(\"Question: \", final_answer.question)\n",
"print(\"Answer: \", final_answer.answer)\n",
"print(\"To explore the graph:\")\n",
"print(f\"docker run -p 8000:8000 -v {crew.graph_store.database_path}:/database --rm kuzudb/explorer:latest\")\n",
"print(f\"docker run -p 8000:8000 -v {crew.graph_store.database_path}:/database --rm kuzudb/explorer:0.4.2\")\n",
"print(\"And in the kuzu explorer at http://localhost:8000 enter\")\n",
"print(\"MATCH (A)-[r]->(B) RETURN *;\")\n",
"final_result = \"{}\\n\\n{}\".format(final_answer.question, final_answer.answer)"
Expand Down
Loading
Loading