Skip to content

Commit 80d0e9c

Browse files
committed
update
1 parent e28714b commit 80d0e9c

File tree

325 files changed

+28924
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+28924
-2
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.txt
2+
dataset
3+
dataset_paper
4+
dataset_test
5+
test*

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Medical-Graph-RAG
2+
We build a Graph RAG System specifically for the medical domain.
23

3-
paper: https://arxiv.org/html/2408.04187v1
4+
Check our paper here: https://arxiv.org/html/2408.04187v1
45

5-
code comming soon
6+
# Quick Start
7+
1. conda env create -f medgraphrag.yml
8+
9+
2. export OPENAI_API_KEY = <your OPENAI_API_KEY>
10+
11+
3. python run.py -simple True (now using ./dataset_ex/report_0.txt as RAG doc, "What is the main symptom of the patient?" as the prompt, change the prompt in run.py as you like.)
12+
13+
# Build from scratch
14+
## Prepare Neo4j and LLM:
15+
prepare neo4j and LLM (using ChatGPT here for an example), you need to export:
16+
export OPENAI_API_KEY = <your OPENAI_API_KEY>
17+
export NEO4J_URL= <your NEO4J_URL>
18+
export NEO4J_USERNAME= <your NEO4J_USERNAME>
19+
export NEO4J_PASSWORD=<your NEO4J_PASSWORD>
20+
21+
## Construct the graph (use "mimic_ex" dataset as an example):
22+
1. Download mimic_ex here, put that under your data path, like ./dataset/mimic_ex
23+
24+
2. python run.py -dataset mimic_ex -data_path ./dataset/mimic_ex(where you put the dataset) -grained_chunk True -ingraphmerge True -construct_graph True
25+
26+
## Model Inference:
27+
1. put your prompt to ./prompt.txt
28+
29+
2. python run.py -dataset mimic_ex -data_path ./dataset/mimic_ex(where you put the dataset) -inference True
12.4 KB
Binary file not shown.
1.04 KB
Binary file not shown.
1.88 KB
Binary file not shown.
435 Bytes
Binary file not shown.

__pycache__/retrieve.cpython-310.pyc

1.16 KB
Binary file not shown.

__pycache__/summerize.cpython-310.pyc

2.9 KB
Binary file not shown.

__pycache__/utils.cpython-310.pyc

8.38 KB
Binary file not shown.

agentic_chunker.py

Lines changed: 367 additions & 0 deletions
Large diffs are not rendered by default.

camel/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
2+
# Licensed under the Apache License, Version 2.0 (the “License”);
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an “AS IS” BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14+
15+
__version__ = '0.1.6.2'
16+
17+
__all__ = [
18+
'__version__',
19+
'camel',
20+
]
216 Bytes
Binary file not shown.

camel/agents/__init__.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
2+
# Licensed under the Apache License, Version 2.0 (the “License”);
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an “AS IS” BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14+
from .base import BaseAgent
15+
from .chat_agent import ChatAgent
16+
from .critic_agent import CriticAgent
17+
from .embodied_agent import EmbodiedAgent
18+
from .knowledge_graph_agent import KnowledgeGraphAgent
19+
from .role_assignment_agent import RoleAssignmentAgent
20+
from .search_agent import SearchAgent
21+
from .task_agent import (
22+
TaskCreationAgent,
23+
TaskPlannerAgent,
24+
TaskPrioritizationAgent,
25+
TaskSpecifyAgent,
26+
)
27+
from .tool_agents.base import BaseToolAgent
28+
from .tool_agents.hugging_face_tool_agent import HuggingFaceToolAgent
29+
30+
__all__ = [
31+
'BaseAgent',
32+
'ChatAgent',
33+
'TaskSpecifyAgent',
34+
'TaskPlannerAgent',
35+
'TaskCreationAgent',
36+
'TaskPrioritizationAgent',
37+
'CriticAgent',
38+
'BaseToolAgent',
39+
'HuggingFaceToolAgent',
40+
'EmbodiedAgent',
41+
'RoleAssignmentAgent',
42+
'SearchAgent',
43+
'KnowledgeGraphAgent',
44+
]
885 Bytes
Binary file not shown.
849 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

camel/agents/base.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
2+
# Licensed under the Apache License, Version 2.0 (the “License”);
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an “AS IS” BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14+
from abc import ABC, abstractmethod
15+
from typing import Any
16+
17+
18+
class BaseAgent(ABC):
19+
r"""An abstract base class for all CAMEL agents."""
20+
21+
@abstractmethod
22+
def reset(self, *args: Any, **kwargs: Any) -> Any:
23+
r"""Resets the agent to its initial state."""
24+
pass
25+
26+
@abstractmethod
27+
def step(self, *args: Any, **kwargs: Any) -> Any:
28+
r"""Performs a single step of the agent."""
29+
pass

0 commit comments

Comments
 (0)