Skip to content

Commit fed6434

Browse files
committed
Merge branch 'main' into INTPYTHON-715-Add-langgraph-store-mongodb-to-ai-ml-testing
2 parents 28a44e1 + d50090a commit fed6434

File tree

11 files changed

+235
-31
lines changed

11 files changed

+235
-31
lines changed

.evergreen/config.yml

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,24 @@ tasks:
289289
params:
290290
file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml
291291

292+
- name: test-mem0-python-local
293+
tags: [ local ]
294+
commands:
295+
- func: "fetch repo"
296+
- func: "setup local atlas"
297+
- func: "execute tests"
298+
299+
- name: test-mem0-python-remote
300+
tags: [ remote ]
301+
commands:
302+
- func: "fetch repo"
303+
- func: "setup remote atlas"
304+
- func: "execute tests"
305+
292306
buildvariants:
293307
- name: test-semantic-kernel-python-rhel
294308
display_name: Semantic-Kernel RHEL Python
309+
tags: [python]
295310
expansions:
296311
DIR: semantic-kernel-python
297312
run_on:
@@ -304,6 +319,7 @@ buildvariants:
304319

305320
- name: test-semantic-kernel-csharp-rhel
306321
display_name: Semantic-Kernel RHEL CSharp
322+
tags: [csharp]
307323
expansions:
308324
DIR: semantic-kernel-csharp
309325
run_on:
@@ -314,6 +330,7 @@ buildvariants:
314330

315331
- name: test-langchain-python-rhel
316332
display_name: Langchain RHEL Python
333+
tags: [python]
317334
expansions:
318335
DIR: langchain-python
319336
run_on:
@@ -325,6 +342,7 @@ buildvariants:
325342

326343
- name: test-langgraph-python-rhel
327344
display_name: Langgraph RHEL Python
345+
tags: [python]
328346
expansions:
329347
DIR: langgraph-python
330348
run_on:
@@ -346,8 +364,9 @@ buildvariants:
346364
batchtime: 10080 # 1 week
347365

348366
# TODO: INTPYTHON-668
349-
# - name: test-chatgpt-retrieval-plugin-rhel
367+
# - name: test-chatgpt-retrieval-plugin-python-rhel
350368
# display_name: ChatGPT Retrieval Plugin
369+
# tags: [python]
351370
# expansions:
352371
# DIR: chatgpt-retrieval-plugin
353372
# run_on:
@@ -358,8 +377,9 @@ buildvariants:
358377
# batchtime: 10080 # 1 week
359378

360379
# TODO: INTPYTHON-669
361-
# - name: test-llama-index-vectorstore-rhel
380+
# - name: test-llama-index-vectorstore-python-rhel
362381
# display_name: LlamaIndex RHEL Vector Store
382+
# tags: [python]
363383
# expansions:
364384
# DIR: llama-index-python-vectorstore
365385
# run_on:
@@ -370,8 +390,9 @@ buildvariants:
370390
# # - name: test-llama-index-remote
371391
# # batchtime: 10080 # 1 week
372392

373-
- name: test-docarray-rhel
393+
- name: test-docarray-python-rhel
374394
display_name: DocArray RHEL
395+
tags: [python]
375396
expansions:
376397
DIR: docarray
377398
run_on:
@@ -380,8 +401,9 @@ buildvariants:
380401
- name: test-docarray-local
381402
- name: test-docarray-remote
382403

383-
- name: test-pymongo-voyageai-rhel
404+
- name: test-pymongo-voyageai-python-rhel
384405
display_name: PyMongo-VoyageAI RHEL
406+
tags: [python]
385407
expansions:
386408
DIR: pymongo-voyageai
387409
run_on:
@@ -390,8 +412,9 @@ buildvariants:
390412
- name: test-pymongo-voyageai-local
391413
- name: test-pymongo-voyageai-remote
392414

393-
- name: test-crewai-tools-rhel
415+
- name: test-crewai-tools-python-rhel
394416
display_name: CrewAI-Tools Ubuntu
417+
tags: [python]
395418
expansions:
396419
DIR: crewai-tools
397420
run_on:
@@ -400,8 +423,9 @@ buildvariants:
400423
- name: test-crewai-tools-local
401424
- name: test-crewai-tools-remote
402425

403-
- name: test-haystack-embeddings-rhel
426+
- name: test-haystack-embeddings-python-rhel
404427
display_name: Haystack Embeddings RHEL
428+
tags: [python]
405429
expansions:
406430
DIR: haystack-embeddings
407431
run_on:
@@ -411,8 +435,9 @@ buildvariants:
411435
# TODO: INTPYTHON-465
412436
# - name: test-haystack-embeddings-remote
413437

414-
- name: test-haystack-fulltext-rhel
438+
- name: test-haystack-fulltext-python-rhel
415439
display_name: Haystack FullText RHEL
440+
tags: [python]
416441
expansions:
417442
DIR: haystack-fulltext
418443
run_on:
@@ -422,22 +447,35 @@ buildvariants:
422447
# TODO: INTPYTHON-465
423448
# - name: test-haystack-fulltext-remote
424449

425-
- name: test-langchaingo-ubuntu
450+
- name: test-langchaingo-golang-ubuntu
426451
display_name: LangchainGo Ubuntu2204
452+
tags: [golang]
427453
expansions:
428454
DIR: langchaingo-golang
429455
run_on:
430456
- ubuntu2204-small
431457
tasks:
432458
- name: test-langchaingo-local
433459

434-
# TODO: INTPYTHON-667
435-
# - name: test-langchain-js-ubuntu
436-
# display_name: LangchainJS Ubuntu2204
437-
# expansions:
438-
# DIR: langchain-js
439-
# run_on:
440-
# - ubuntu2204-small
441-
# tasks:
442-
# - name: test-langchain-js-local
443-
# - name: test-langchain-js-remote
460+
- name: test-langchain-javascript-ubuntu
461+
display_name: LangchainJS Ubuntu2204
462+
tags: [javascript]
463+
expansions:
464+
DIR: langchain-js
465+
run_on:
466+
- ubuntu2204-small
467+
tasks:
468+
- name: test-langchain-js-local
469+
- name: test-langchain-js-remote
470+
471+
- name: test-mem0-python-rhel
472+
display_name: mem0 RHEL Python
473+
tags: [python]
474+
expansions:
475+
DIR: mem0-python
476+
run_on:
477+
- rhel87-small
478+
tasks:
479+
- name: test-mem0-python-local
480+
- name: test-mem0-python-remote
481+
batchtime: 10080 # 1 week

.evergreen/lint_config.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Pre-commit hook to check if buildvariant tasks contain required language tags.
4+
"""
5+
6+
import logging
7+
import sys
8+
import yaml
9+
from pathlib import Path
10+
from typing import List, Dict, Any
11+
12+
logging.basicConfig()
13+
logger = logging.getLogger(__file__)
14+
logger.setLevel(logging.DEBUG)
15+
16+
17+
CURRENT_DIR = Path(__file__).parent.resolve()
18+
CONFIG_YML = CURRENT_DIR / "config.yml"
19+
VALID_LANGUAGES = {"python", "golang", "javascript", "csharp"}
20+
21+
22+
def load_yaml_file(file_path: str) -> Dict[Any, Any]:
23+
"""Load and parse a YAML file."""
24+
with open(file_path, "r", encoding="utf-8") as file:
25+
return yaml.safe_load(file) or {}
26+
27+
28+
def check_buildvariants(data: Dict[Any, Any]) -> List[str]:
29+
"""
30+
Check if buildvariant tasks contain at least one required language tag
31+
as well as the language within the buildvariant name.
32+
33+
Example Buildvariant structure in YAML:
34+
buildvariants:
35+
- name: test-semantic-kernel-python-rhel
36+
display_name: Semantic-Kernel RHEL Python
37+
tags: [python]
38+
expansions:
39+
DIR: semantic-kernel-python
40+
run_on:
41+
- rhel87-small
42+
tasks:
43+
- name: test-semantic-kernel-python-local
44+
- name: test-semantic-kernel-python-remote
45+
batchtime: 10080 # 1 week
46+
47+
Args:
48+
data: Parsed YAML data
49+
50+
Returns:
51+
List of error messages for tasks missing required tags
52+
"""
53+
errors = []
54+
55+
buildvariants = data.get("buildvariants", [])
56+
if not isinstance(buildvariants, list):
57+
return ["'buildvariants' should be a list"]
58+
59+
for i, buildvariant in enumerate(buildvariants):
60+
if not isinstance(buildvariant, dict):
61+
errors.append(f"buildvariants[{i}] should contain sub-fields")
62+
continue
63+
64+
buildvariant_name = buildvariant.get("name", "")
65+
if not buildvariant_name:
66+
errors.append(f"buildvariants[{i}] is missing 'name'")
67+
continue
68+
else:
69+
if all([f"-{lang}-" not in buildvariant_name for lang in VALID_LANGUAGES]):
70+
errors.append(
71+
f"buildvariant '{buildvariant_name}' should contain one"
72+
f" '-[{', '.join(VALID_LANGUAGES)}]-' in its name"
73+
f"got: {buildvariant_name}",
74+
)
75+
76+
buildvariant_display_name = buildvariant.get("display_name", buildvariant_name)
77+
78+
tags = buildvariant.get("tags", [])
79+
80+
if not isinstance(tags, list) or len(tags) != 1:
81+
errors.append(
82+
f"'tags' in buildvariant '{buildvariant_display_name}' should be a list of size 1"
83+
)
84+
continue
85+
86+
if tags[0] not in VALID_LANGUAGES:
87+
errors.append(
88+
f"buildvariant '{buildvariant_display_name}' has invalid tag '{tags[0]}'. "
89+
f"Valid tags are: {', '.join(VALID_LANGUAGES)}"
90+
)
91+
return errors
92+
93+
94+
def main():
95+
"""Main function for the pre-commit hook."""
96+
total_errors = 0
97+
98+
data = load_yaml_file(CONFIG_YML)
99+
if not data:
100+
raise FileNotFoundError(f"Failed to load or parse {CONFIG_YML}")
101+
102+
errors = check_buildvariants(data)
103+
104+
if errors:
105+
logger.error("❌ Errors found in %s:", CONFIG_YML)
106+
for error in errors:
107+
logger.error(" - %s", error)
108+
total_errors += len(errors)
109+
110+
if total_errors > 0:
111+
logger.error("❌ Total errors found: %s", total_errors)
112+
return 1
113+
else:
114+
logger.info("✅ %s passed AI/ML testing pipeline validation", CONFIG_YML)
115+
116+
117+
if __name__ == "__main__":
118+
sys.exit(main())

.evergreen/setup-remote.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ case $DIR in
4747
langchain-js)
4848
MONGODB_URI=$LANGCHAIN_MONGODB_URI
4949
;;
50+
mem0-python)
51+
MONGODB_URI=$MEM0_URI
52+
;;
5053
*)
5154
echo "Missing config in setup-remote.sh for DIR: $DIR"
5255
exit 1

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
python-version: '3.10'
2424
- name: Install Python dependencies
2525
run: |
26-
python -m pip install -U pip pre-commit
26+
python -m pip install -U pip pre-commit pyyaml
2727
- name: Run linters
2828
run: |
2929
pre-commit run --hook-stage=manual --all-files

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@ repos:
5353
rev: "v2.2.6"
5454
hooks:
5555
- id: codespell
56+
57+
- repo: local
58+
hooks:
59+
- id: check-buildvariant-tags
60+
name: Check buildvariant language tags
61+
entry: python3 .evergreen/lint_config.py
62+
language: system
63+
files: .evergreen/config.yml
64+
args: ['--languages=python,golang,javascript,csharp']

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Test execution flow is defined in `.evergreen/config.yml`. The test pipeline's c
110110
- `run_on` -- Specified platform to run on. `rhel87-small` or `ubuntu2204-small` should be used by default. Any other distro may fail Atlas CLI setup.
111111
- `tasks` -- Tasks to run. See below for more details
112112
- `cron` -- The tests are run via a cron job on a nightly cadence. This can be modified by setting a different cadence. Cron jobs can be scheduled using [cron syntax](https://crontab.guru/#0_0_*_*_*)
113+
- `tags` -- This should include the language where the AI/ML is run. i.e. `[python, csharp, golang, javascript]` Any tagged language will populate the
114+
appropriate language-specific slack channel.
113115

114116
**[Tasks](https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Project-Configuration-Files#tasks)** -- These are the "building blocks" of our runs. Here is where we consolidate the specific set of functions. The basic parameters to add are shown below
115117

@@ -185,8 +187,10 @@ evergreen patch -p ai-ml-pipeline-testing --param REPO_ORG=caseyclements --param
185187

186188
### Handling Failing Tests
187189

188-
If tests are found to be failing, and cannot be addressed quickly, the responsible team MUST create a JIRA ticket, and disable the relevant tests
190+
Tests are run periodically (nightly) and any failures will propagate into both the `dbx-ai-ml-testing-pipline-notifications` and `dbx-ai-ml-testing-pipeline-notifications-{language}` channel. Repo owners of this `ai-ml-testing-pipeline` library are required to join the `dbx-ai-ml-testing-pipeline-notifications`. Pipeline specific implementers must **at least** join `dbx-ai-ml-testing-pipline-notifications-{language}` (e.g. whomever implemented `langchain-js` must at least be a member of `dbx-ai-ml-testing-pipeline-notifications-js`).
191+
192+
If tests are found to be failing, and cannot be addressed quickly, the responsible team MUST create a JIRA ticket within their team's project (e.g. a python failure should generate an `INTPYTHON` ticket), and disable the relevant tests
189193
in the `config.yml` file, with a comment about the JIRA ticket that will address it.
190194

191-
This policy will help ensure that a single failing integration does not cause noise in the `dbx-ai-ml-testing-pipeline-notifications` that would mask other
195+
This policy will help ensure that a single failing integration does not cause noise in the `dbx-ai-ml-testing-pipeline-notifications` or `dbx-ai-ml-testing-pipeline-notifications-{language}` that would mask other
192196
failures.

crewai-tools/test_mongodb_vector_search_tool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from crewai import Agent
33
from crewai import Task
44
from crewai import Crew, Process, LLM
5-
from crewai.cli.constants import DEFAULT_LLM_MODEL
65
from crewai_tools import MongoDBVectorSearchTool, MongoDBVectorSearchConfig
76
from langchain_community.document_loaders import PyPDFLoader
87
import time
@@ -55,9 +54,9 @@
5554
role="AI Accuracy Researcher",
5655
goal="Find and extract key information from a technical document",
5756
backstory="You're specialized in analyzing technical content to extract insights and answers",
58-
verbose=False,
57+
verbose=True,
5958
tools=[tool],
60-
llm=LLM(model=f"azure/{DEFAULT_LLM_MODEL}"),
59+
llm=LLM(model="azure/gpt-4o", seed=12345),
6160
)
6261
research_task = Task(
6362
description="Research information in a technical document",
@@ -68,12 +67,12 @@
6867
agents=[researcher],
6968
tasks=[research_task],
7069
process=Process.sequential,
71-
verbose=False,
70+
verbose=True,
7271
)
7372

7473
# Get the result and assert something about the results
7574
print("Running the crew...")
7675
result = crew.kickoff()
7776
text = result.raw.lower()
78-
assert "advancements" in text or "improvements" in text, text
77+
assert "limitations" in text, text
7978
assert "GPT-4" in result.raw

langchain-js/run.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ setup_langchain_integration() {
3737

3838
yarn add --dev jest-junit
3939
export JEST_JUNIT_OUTPUT_NAME=results.xml
40-
40+
# Trim trailing slashes since lanchainjs is doing string manipulationn, not
41+
# using the URI class.
42+
AZURE_OPENAI_BASE_PATH=$(echo "$AZURE_OPENAI_ENDPOINT" | sed 's:/*$::')
43+
export AZURE_OPENAI_BASE_PATH
44+
export AZURE_OPENAI_API_VERSION=$OPENAI_API_VERSION
4145
# optionally enable to debug local atlas in CI.
4246
# export DEBUG=testcontainers*
4347
}

mem0-python/config.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REPO_NAME=mem0
2+
REPO_ORG=mem0ai
3+
DATABASE=mem0_test_db

0 commit comments

Comments
 (0)