Skip to content

Commit 9dd6b4d

Browse files
sjrlanakin87bogdankostic
authored
feat: Add mem0 integration (#3326)
Co-authored-by: anakin87 <stefanofiorucci@gmail.com> Co-authored-by: bogdankostic <bogdankostic@web.de>
1 parent 0ee5b5d commit 9dd6b4d

33 files changed

Lines changed: 3067 additions & 4 deletions

.github/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ integration:mcp:
188188
- any-glob-to-any-file: "integrations/mcp/**/*"
189189
- any-glob-to-any-file: ".github/workflows/mcp.yml"
190190

191+
integration:mem0:
192+
- changed-files:
193+
- any-glob-to-any-file: "integrations/mem0/**/*"
194+
- any-glob-to-any-file: ".github/workflows/mem0.yml"
195+
191196
integration:meta-llama:
192197
- changed-files:
193198
- any-glob-to-any-file: "integrations/meta_llama/**/*"

.github/workflows/CI_coverage_comment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ on:
3737
- "Test / llama_stack"
3838
- "Test / markitdown"
3939
- "Test / mcp"
40+
- "Test / mem0"
4041
- "Test / meta_llama"
4142
- "Test / mistral"
4243
- "Test / mongodb_atlas"

.github/workflows/mem0.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# This workflow comes from https://github.com/ofek/hatch-mypyc
2+
# https://github.com/ofek/hatch-mypyc/blob/5a198c0ba8660494d02716cfc9d79ce4adfb1442/.github/workflows/test.yml
3+
name: Test / mem0
4+
5+
on:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
pull_request:
9+
paths:
10+
- "integrations/mem0/**"
11+
- "!integrations/mem0/*.md"
12+
- ".github/workflows/mem0.yml"
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- "integrations/mem0/**"
18+
- "!integrations/mem0/*.md"
19+
- ".github/workflows/mem0.yml"
20+
21+
defaults:
22+
run:
23+
working-directory: integrations/mem0
24+
25+
concurrency:
26+
group: mem0-${{ github.head_ref || github.sha }}
27+
cancel-in-progress: true
28+
29+
env:
30+
PYTHONUNBUFFERED: "1"
31+
FORCE_COLOR: "1"
32+
TEST_MATRIX_OS: '["ubuntu-latest", "windows-latest", "macos-latest"]'
33+
TEST_MATRIX_PYTHON: '["3.10", "3.14"]'
34+
35+
jobs:
36+
compute-test-matrix:
37+
runs-on: ubuntu-slim
38+
defaults:
39+
run:
40+
working-directory: .
41+
outputs:
42+
os: ${{ steps.set.outputs.os }}
43+
python-version: ${{ steps.set.outputs.python-version }}
44+
steps:
45+
- id: set
46+
run: |
47+
echo 'os=${{ github.event_name == 'push' && '["ubuntu-latest"]' || env.TEST_MATRIX_OS }}' >> "$GITHUB_OUTPUT"
48+
echo 'python-version=${{ github.event_name == 'push' && '["3.10"]' || env.TEST_MATRIX_PYTHON }}' >> "$GITHUB_OUTPUT"
49+
50+
run:
51+
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
52+
needs: compute-test-matrix
53+
permissions:
54+
contents: write
55+
pull-requests: write
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os: ${{ fromJSON(needs.compute-test-matrix.outputs.os) }}
61+
python-version: ${{ fromJSON(needs.compute-test-matrix.outputs.python-version) }}
62+
63+
steps:
64+
- name: Support longpaths
65+
if: matrix.os == 'windows-latest'
66+
working-directory: .
67+
run: git config --system core.longpaths true
68+
69+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
70+
71+
- name: Set up Python ${{ matrix.python-version }}
72+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
76+
- name: Install Hatch
77+
run: pip install --upgrade hatch
78+
- name: Lint
79+
if: matrix.python-version == '3.10' && runner.os == 'Linux'
80+
run: hatch run fmt-check && hatch run test:types
81+
82+
- name: Run unit tests
83+
run: hatch run test:unit-cov-retry
84+
85+
# On PR: posts coverage comment (directly on same-repo PRs; via artifact for fork PRs). On push to main: stores coverage baseline on data branch.
86+
- name: Store unit tests coverage
87+
id: coverage_comment
88+
if: matrix.python-version == '3.10' && runner.os == 'Linux' && github.event_name != 'schedule'
89+
uses: py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
90+
with:
91+
GITHUB_TOKEN: ${{ github.token }}
92+
COVERAGE_PATH: integrations/mem0
93+
SUBPROJECT_ID: mem0
94+
MINIMUM_GREEN: 90
95+
MINIMUM_ORANGE: 60
96+
97+
- name: Upload coverage comment to be posted
98+
if: matrix.python-version == '3.10' && runner.os == 'Linux' && github.event_name == 'pull_request' && steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
99+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
100+
with:
101+
name: coverage-comment-mem0
102+
path: python-coverage-comment-action-mem0.txt
103+
104+
- name: Run integration tests
105+
run: hatch run test:integration-cov-append-retry
106+
107+
- name: Store combined coverage
108+
if: github.event_name == 'push'
109+
uses: py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
110+
with:
111+
GITHUB_TOKEN: ${{ github.token }}
112+
COVERAGE_PATH: integrations/mem0
113+
SUBPROJECT_ID: mem0-combined
114+
MINIMUM_GREEN: 90
115+
MINIMUM_ORANGE: 60
116+
117+
- name: Run unit tests with lowest direct dependencies
118+
if: github.event_name != 'push'
119+
run: |
120+
hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt
121+
hatch -e test env run -- uv pip install -r requirements_lowest_direct.txt
122+
hatch run test:unit
123+
124+
- name: Nightly - run unit tests with Haystack main branch
125+
if: github.event_name == 'schedule'
126+
run: |
127+
hatch env prune
128+
hatch -e test env run -- uv pip install git+https://github.com/deepset-ai/haystack.git@main
129+
hatch run test:unit
130+
131+
132+
notify-slack-on-failure:
133+
needs: run
134+
if: failure() && github.event_name == 'schedule'
135+
runs-on: ubuntu-slim
136+
steps:
137+
- uses: deepset-ai/notify-slack-action@3cda73b77a148f16f703274198e7771340cf862b # v1
138+
with:
139+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }}

0 commit comments

Comments
 (0)