Skip to content
Draft
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Add your description here"
requires-python = ">=3.11"
dependencies = [
"imagehash>=4.3.2",
"mcp>=1.22.0,<2.0",
"mcp-agent[openai]>=0.2.5",
"openai>=1.30.0",
"pillow>=12.0.0",
Expand Down
25 changes: 21 additions & 4 deletions tests/test_dataset_smith_multiclass.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
import asyncio
import logging
import sys
from pathlib import Path

from obp.agents.dataset_smith import dataset_smith
from obp.export import exporter
import pytest


ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

_deps_available = True
try:
from obp.agents.dataset_smith import dataset_smith
from obp.export import exporter
except ImportError:
_deps_available = False


logging.basicConfig(level=logging.INFO)


async def run_tests() -> None:
@pytest.mark.skipif(
not _deps_available,
reason="Required dependencies (tavily, pymongo, imagehash) are not installed",
)
async def test_build_multiclass_dataset() -> None:
scenarios = [
("Single-class: cats", ["cat"], 20),
(
Expand Down Expand Up @@ -39,4 +56,4 @@ async def run_tests() -> None:


if __name__ == "__main__":
asyncio.run(run_tests())
asyncio.run(test_build_multiclass_dataset())
26 changes: 23 additions & 3 deletions tests/test_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import logging
from obp.agents.foundational_gatherer import FoundationalGatherer
from obp.downloader import FoundationalDownloader
from obp.db import get_resources_collection
import sys
from pathlib import Path

import pytest


ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

_deps_available = True
try:
from obp.agents.foundational_gatherer import FoundationalGatherer
from obp.downloader import FoundationalDownloader
from obp.db import get_resources_collection
except ImportError:
_deps_available = False

from uuid import uuid4
import time

logging.basicConfig(level=logging.INFO)


@pytest.mark.skipif(
not _deps_available,
reason="Required dependencies (tavily, pymongo) are not installed",
)
def test_end_to_end():
request_id = str(uuid4())
query = "Recent advances in quantum computing 2024"
Expand Down
25 changes: 21 additions & 4 deletions tests/test_foundational_agent.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import logging
import sys
import json
from obp.agents.foundational_gatherer import FoundationalGatherer
from pathlib import Path

import pytest


ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

_deps_available = True
try:
from obp.agents.foundational_gatherer import FoundationalGatherer
except ImportError:
_deps_available = False

# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

def run_tests():

@pytest.mark.skipif(
not _deps_available,
reason="Required dependencies (tavily, pymongo) are not installed",
)
def test_foundational_agent():
gatherer = FoundationalGatherer()

test_cases = [
Expand Down Expand Up @@ -76,4 +93,4 @@ def run_tests():
print(f"{'='*60}\n")

if __name__ == "__main__":
run_tests()
test_foundational_agent()
30 changes: 24 additions & 6 deletions tests/test_labeled_corpus.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
import csv
import logging
from uuid import uuid4
import sys
from pathlib import Path

import pytest


from obp.agents.foundational_gatherer import FoundationalGatherer
from obp.downloader import FoundationalDownloader
from obp.export import exporter
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

_deps_available = True
try:
from obp.agents.foundational_gatherer import FoundationalGatherer
from obp.downloader import FoundationalDownloader
from obp.export import exporter
except ImportError:
_deps_available = False

from uuid import uuid4


logging.basicConfig(level=logging.INFO)


def run_labeled_corpus_tests() -> None:
@pytest.mark.skipif(
not _deps_available,
reason="Required dependencies (tavily, pymongo) are not installed",
)
def test_labeled_corpus() -> None:
gatherer = FoundationalGatherer()
downloader = FoundationalDownloader()

Expand Down Expand Up @@ -89,4 +107,4 @@ def run_labeled_corpus_tests() -> None:


if __name__ == "__main__":
run_labeled_corpus_tests()
test_labeled_corpus()
16 changes: 13 additions & 3 deletions tests/test_mcp_numerical_corpus_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
import sys
from pathlib import Path

import pytest


ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

from apps.mcp_agent_main import app, build_labeled_numerical_corpus
_mcp_available = True
try:
from apps.mcp_agent_main import app, build_labeled_numerical_corpus
except ImportError:
_mcp_available = False


async def main() -> None:
@pytest.mark.skipif(
not _mcp_available,
reason="mcp_agent is not installed (mcp.server.fastmcp unavailable)",
)
async def test_build_labeled_numerical_corpus() -> None:
async with app.run() as agent_app:
result = await build_labeled_numerical_corpus(
labels=[
Expand All @@ -29,4 +39,4 @@ async def main() -> None:


if __name__ == "__main__":
asyncio.run(main())
asyncio.run(test_build_labeled_numerical_corpus())
16 changes: 13 additions & 3 deletions tests/test_mcp_text_corpus_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
import sys
from pathlib import Path

import pytest


ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

from apps.mcp_agent_main import app, build_labeled_text_corpus
_mcp_available = True
try:
from apps.mcp_agent_main import app, build_labeled_text_corpus
except ImportError:
_mcp_available = False


async def main() -> None:
@pytest.mark.skipif(
not _mcp_available,
reason="mcp_agent is not installed (mcp.server.fastmcp unavailable)",
)
async def test_build_labeled_text_corpus() -> None:
async with app.run() as agent_app:
result = await build_labeled_text_corpus(
labels=[
Expand All @@ -33,4 +43,4 @@ async def main() -> None:


if __name__ == "__main__":
asyncio.run(main())
asyncio.run(test_build_labeled_text_corpus())
2 changes: 2 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.