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

Tool unit tests #44

Merged
merged 44 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8dd50d8
Migrated bluenaas
cszsol Oct 25, 2024
a6c9a45
Merged main
cszsol Oct 25, 2024
ab556be
Migration of the rest of the tools
cszsol Oct 28, 2024
1f43a44
Some pydantic fixes
cszsol Oct 28, 2024
e9f368d
Fixed error when calling agents
cszsol Oct 30, 2024
ddb9557
Merged main
cszsol Oct 30, 2024
5e1e396
Removed references from neuroagent in swarm_copy
cszsol Nov 1, 2024
186f970
Remove changelog job
cszsol Nov 1, 2024
4f27cd5
CR fixes
cszsol Nov 1, 2024
a929697
Review fixes
cszsol Nov 5, 2024
379c651
lint
cszsol Nov 5, 2024
3d2537a
Merge branch 'main' into migrate_tools
cszsol Nov 5, 2024
817718c
lint
cszsol Nov 5, 2024
6dce733
MR comments
cszsol Nov 6, 2024
39c5a5a
Migrated electrophys tool tests
cszsol Nov 6, 2024
6a4dfd2
Added test for me_model_tool
cszsol Nov 6, 2024
b7f07da
Added tests for get_morpho tool
cszsol Nov 6, 2024
6233b68
Added tests for kg_morpho_features_tool
cszsol Nov 7, 2024
dfe9dc8
Added morpho features test
cszsol Nov 7, 2024
54c6b73
Added test for resolve entitie tool
cszsol Nov 7, 2024
5531e01
added traces tool tests
cszsol Nov 7, 2024
601b66f
Added traces tool tests
cszsol Nov 7, 2024
64e420c
Merged main
cszsol Nov 12, 2024
89a92f1
Update ci.yaml
cszsol Nov 12, 2024
2a33c2e
Run new tests
cszsol Nov 20, 2024
8e3f1d5
Merge branch 'tool_unit_tests' of github.com-cszsolnai:BlueBrain/neur…
cszsol Nov 20, 2024
a2df343
Merged main
cszsol Nov 20, 2024
95b03bf
Fixed unit test problems after mergint main
cszsol Nov 20, 2024
61f7c3f
lint
cszsol Nov 20, 2024
3c9f73b
Removed unneeded imports
Dec 2, 2024
8c66c33
Use httpx_mock
Dec 2, 2024
a4481b7
Bring back changelog
kanesoban Dec 2, 2024
81f3702
lint
kanesoban Dec 2, 2024
cfb1da4
Update changelog.yml
kanesoban Dec 2, 2024
7f1e047
Merged main
kanesoban Dec 17, 2024
4a7388f
Fixed fixture
kanesoban Dec 17, 2024
cc82dee
Fixed fixtures
kanesoban Dec 17, 2024
386c9f8
Merged main
kanesoban Dec 18, 2024
52be9a5
Merged main
kanesoban Dec 18, 2024
e1a9095
Merged main
kanesoban Dec 18, 2024
f81ab8d
Fixed some failing tests
kanesoban Dec 18, 2024
15c8f4b
fix last tool tests
BoBer78 Dec 19, 2024
ca03354
added test_create_query to morpho tool
BoBer78 Dec 19, 2024
2bd077d
Small changes
WonderPG Dec 19, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- LLM evaluation logic
- Integrated Alembic for managing chat history migrations
- Tool implementations without langchain or langgraph dependencies
- Unit tests for the migrated tools
- CRUDs.
- BlueNaas CRUD tools
- Cell types, resolving and utils tests
Expand Down
5 changes: 3 additions & 2 deletions swarm_copy/tools/get_morpho_tool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Get Morpho tool."""

import logging
from pathlib import Path
from typing import Any, ClassVar

from pydantic import BaseModel, Field
Expand Down Expand Up @@ -30,8 +31,8 @@ class GetMorphoMetadata(BaseMetadata):
knowledge_graph_url: str
token: str
morpho_search_size: int
brainregion_path: str
celltypes_path: str
brainregion_path: str | Path
celltypes_path: str | Path


class KnowledgeGraphOutput(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion swarm_copy/tools/kg_morpho_features_tool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""KG Morpho Feature tool."""

import logging
from pathlib import Path
from typing import Any, ClassVar, Literal

from pydantic import BaseModel, Field, model_validator
Expand Down Expand Up @@ -151,7 +152,7 @@ class KGMorphoFeatureMetadata(BaseMetadata):
knowledge_graph_url: str
token: str
kg_morpho_feature_search_size: int
brainregion_path: str
brainregion_path: str | Path


class KGMorphoFeatureOutput(BaseModel):
Expand Down
Binary file added swarm_copy_tests/data/99111002.nwb
Binary file not shown.
201 changes: 201 additions & 0 deletions swarm_copy_tests/data/get_traces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"hits": {
"hits": [
{
"_id": "https://bbp.epfl.ch/data/demo/morpho-demo/1761e604-03fc-452b-9bf2-2214782bb751",
"_index": "nexus_search_d067e019-1398-4eb8-9e28-3af8a717dcd7_41b1545a-cb2e-4848-8c74-195ec79f7bd3_18",
"_score": 6.0860696,
"_source": {
"@id": "https://bbp.epfl.ch/data/demo/morpho-demo/1761e604-03fc-452b-9bf2-2214782bb751",
"@type": [
"https://neuroshapes.org/Trace",
"https://bbp.epfl.ch/ontologies/core/bmo/ExperimentalTrace"
],
"brainRegion": {
"@id": "http://api.brain-map.org/api/v2/data/Structure/382",
"idLabel": "http://api.brain-map.org/api/v2/data/Structure/382|Field CA1",
"identifier": "http://api.brain-map.org/api/v2/data/Structure/382",
"label": "Field CA1"
},
"contributors": [
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/859a20a2-9eea-4ab5-9504-d080c3c79311",
"@type": [
"http://www.w3.org/ns/prov#Agent",
"http://schema.org/Person"
],
"idLabel": "https://bbp.epfl.ch/neurosciencegraph/data/859a20a2-9eea-4ab5-9504-d080c3c79311|Zsolt Kohus",
"label": "Zsolt Kohus"
}
],
"createdAt": "2024-04-09T21:47:08.569Z",
"createdBy": "https://bbp.epfl.ch/nexus/v1/realms/bbp/users/budd",
"deprecated": false,
"derivation": [
{
"@type": [
"http://www.w3.org/ns/prov#Entity",
"https://neuroshapes.org/PatchedCell"
],
"identifier": "https://bbp.epfl.ch/data/data/demo/morpho-demo/7173ea54-8e59-478d-85f3-ff86246ef22b",
"label": "s160106_0201"
}
],
"distribution": [
{
"contentSize": 4919928,
"contentUrl": "https://bbp.epfl.ch/nexus/v1/files/demo/morpho-demo/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdata%2Fdemo%2Fmorpho-demo%2F01dffb7b-1122-4e1a-9acf-837e683da4ba",
"encodingFormat": "application/nwb",
"label": "s160106_02.nwb"
}
],
"generation": {
"@id": "https://bbp.epfl.ch/data/demo/morpho-demo/d857ff82-b558-4117-b643-74d44dbda5e6",
"endedAt": "2016-01-06T23:59:00.000Z",
"startedAt": "2016-01-06T00:00:00.000Z"
},
"image": [
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdata%2Fdemo%2Fmorpho-demo%2Fc1ef69e4-0073-481d-9446-fcfd7b5b5f7a",
"about": "https://neuroshapes.org/StimulationTrace",
"identifier": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdata%2Fdemo%2Fmorpho-demo%2Fc1ef69e4-0073-481d-9446-fcfd7b5b5f7a",
"repetition": 0,
"stimulusType": "square"
},
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdata%2Fdemo%2Fmorpho-demo%2F6fd03e92-b2ae-4ab8-8c9e-f0ff52d20a0d",
"about": "https://neuroshapes.org/ResponseTrace",
"identifier": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdata%2Fdemo%2Fmorpho-demo%2F6fd03e92-b2ae-4ab8-8c9e-f0ff52d20a0d",
"repetition": 0,
"stimulusType": "square"
}
],
"name": "s160106_02",
"project": {
"@id": "https://bbp.epfl.ch/nexus/v1/projects/demo/morpho-demo",
"identifier": "https://bbp.epfl.ch/nexus/v1/projects/demo/morpho-demo",
"label": "demo/morpho-demo"
},
"subjectAge": {
"label": "59 days Post-natal",
"period": "Post-natal",
"unit": "days",
"value": 59
},
"subjectSpecies": {
"@id": "http://purl.obolibrary.org/obo/NCBITaxon_10090",
"identifier": "http://purl.obolibrary.org/obo/NCBITaxon_10090",
"label": "Mus musculus"
},
"updatedAt": "2024-04-10T08:40:23.039Z",
"updatedBy": "https://bbp.epfl.ch/nexus/v1/realms/bbp/users/cgonzale",
"_self": "https://bbp.epfl.ch/nexus/v1/resources/demo/morpho-demo/_/https:%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2F1761e604-03fc-452b-9bf2-2214782bb751"
}
},
{
"_id": "https://bbp.epfl.ch/data/demo/morpho-demo/5f710291-9aac-45d0-94ff-d3d318c6ba2f",
"_index": "nexus_search_d067e019-1398-4eb8-9e28-3af8a717dcd7_41b1545a-cb2e-4848-8c74-195ec79f7bd3_18",
"_score": 6.0860696,
"_source": {
"@id": "https://bbp.epfl.ch/data/demo/morpho-demo/5f710291-9aac-45d0-94ff-d3d318c6ba2f",
"@type": [
"https://neuroshapes.org/Trace",
"https://bbp.epfl.ch/ontologies/core/bmo/ExperimentalTrace"
],
"brainRegion": {
"@id": "http://api.brain-map.org/api/v2/data/Structure/382",
"idLabel": "http://api.brain-map.org/api/v2/data/Structure/382|Field CA1",
"identifier": "http://api.brain-map.org/api/v2/data/Structure/382",
"label": "Field CA1"
},
"contributors": [
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/859a20a2-9eea-4ab5-9504-d080c3c79311",
"@type": [
"http://www.w3.org/ns/prov#Agent",
"http://schema.org/Person"
],
"idLabel": "https://bbp.epfl.ch/neurosciencegraph/data/859a20a2-9eea-4ab5-9504-d080c3c79311|Zsolt Kohus",
"label": "Zsolt Kohus"
}
],
"createdAt": "2024-04-10T13:58:37.803Z",
"createdBy": "https://bbp.epfl.ch/nexus/v1/realms/bbp/users/budd",
"deprecated": false,
"derivation": [
{
"@type": [
"https://neuroshapes.org/PatchedCell",
"http://www.w3.org/ns/prov#Entity"
],
"identifier": "https://bbp.epfl.ch/data/demo/morpho-demo/c5c68107-39e5-4124-8681-8a644ab0f8ce",
"label": "s160106_0201"
}
],
"distribution": [
{
"contentSize": 4919928,
"contentUrl": "https://bbp.epfl.ch/nexus/v1/files/demo/morpho-demo/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2Ff759098b-3db5-4236-a577-eac23191e063",
"encodingFormat": "application/nwb",
"label": "s160106_02.nwb"
}
],
"generation": {
"@id": "https://bbp.epfl.ch/data/demo/morpho-demo/d47968ad-7644-4153-9bf5-a68277f9e17e",
"endedAt": "2016-01-06T23:59:00.000Z",
"startedAt": "2016-01-06T00:00:00.000Z"
},
"image": [
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2F835b1f06-c688-4771-9e45-c9c091666a8d",
"about": "https://neuroshapes.org/ResponseTrace",
"identifier": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2F835b1f06-c688-4771-9e45-c9c091666a8d",
"repetition": 0,
"stimulusType": "square"
},
{
"@id": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2Fde25efaf-6f6a-4245-a5a5-eeed4eddc83e",
"about": "https://neuroshapes.org/StimulationTrace",
"identifier": "https://bbp.epfl.ch/neurosciencegraph/data/https%3A%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2Fde25efaf-6f6a-4245-a5a5-eeed4eddc83e",
"repetition": 0,
"stimulusType": "square"
}
],
"name": "s160106_02",
"project": {
"@id": "https://bbp.epfl.ch/nexus/v1/projects/demo/morpho-demo",
"identifier": "https://bbp.epfl.ch/nexus/v1/projects/demo/morpho-demo",
"label": "demo/morpho-demo"
},
"subjectAge": {
"label": "59 days Post-natal",
"period": "Post-natal",
"unit": "days",
"value": 59
},
"subjectSpecies": {
"@id": "http://purl.obolibrary.org/obo/NCBITaxon_10090",
"identifier": "http://purl.obolibrary.org/obo/NCBITaxon_10090",
"label": "Mus musculus"
},
"updatedAt": "2024-04-10T13:58:37.803Z",
"updatedBy": "https://bbp.epfl.ch/nexus/v1/realms/bbp/users/budd",
"_self": "https://bbp.epfl.ch/nexus/v1/resources/demo/morpho-demo/_/https:%2F%2Fbbp.epfl.ch%2Fdata%2Fdemo%2Fmorpho-demo%2F5f710291-9aac-45d0-94ff-d3d318c6ba2f"
}
}
],
"max_score": 6.0860696,
"total": {
"relation": "eq",
"value": 1905
}
},
"timed_out": false,
"took": 65,
"_shards": {
"failed": 0,
"skipped": 664,
"successful": 742,
"total": 742
}
}
Loading
Loading