Skip to content

Commit aee9879

Browse files
Merge pull request #5 from sensein/dev
StructSense
2 parents 26fc866 + ee804fc commit aee9879

56 files changed

Lines changed: 41044 additions & 153 deletions

Some content is hidden

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

.gitignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# Ruff
22
.ruff_cache
3-
3+
config/agents.yaml
44
# Mac
55
.DS_Store
6-
6+
crew_memory/
7+
.venv/
8+
.*/*
9+
.ipynb_checkpoints
710
# Byte-compiled / optimized / DLL files
811
__pycache__/
912
*.py[cod]
1013
*$py.class
11-
14+
example/.structsense_env
1215
# C extensions
1316
*.so
14-
17+
.chainlit/
1518
# Distribution / packaging
1619
.Python
1720
build/
@@ -37,7 +40,7 @@ MANIFEST
3740
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3841
*.manifest
3942
*.spec
40-
43+
*.env
4144
# Installer logs
4245
pip-log.txt
4346
pip-delete-this-directory.txt

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include src/structsense/default_config_ner *.yaml

README.md

Lines changed: 281 additions & 69 deletions
Large diffs are not rendered by default.

__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
# -----------------------------------------------------------------------------
3+
# DISCLAIMER: This software is provided "as is" without any warranty,
4+
# express or implied, including but not limited to the warranties of
5+
# merchantability, fitness for a particular purpose, and non-infringement.
6+
#
7+
# In no event shall the authors or copyright holders be liable for any
8+
# claim, damages, or other liability, whether in an action of contract,
9+
# tort, or otherwise, arising from, out of, or in connection with the
10+
# software or the use or other dealings in the software.
11+
# -----------------------------------------------------------------------------
12+
13+
# @Author : Tek Raj Chhetri
14+
# @Email : tekraj@mit.edu
15+
# @Web : https://tekrajchhetri.com/
16+
# @File : __init__.py.py
17+
# @Software: PyCharm

config/config.yaml

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

config_template/config.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#agent config
2+
# Do not introduce any new variable name
3+
# the variables inside {} receives data from the previous agent. the {literature} variable is the one that passes the
4+
# initial input.
5+
agent_config:
6+
extractor_agent:
7+
role: >
8+
agent role
9+
goal: >
10+
goal
11+
backstory: >
12+
agent back story
13+
llm:
14+
model: openrouter/openai/gpt-4o-mini
15+
base_url: https://openrouter.ai/api/v1
16+
17+
alignment_agent:
18+
role: >
19+
agent role
20+
goal: >
21+
agent goal
22+
backstory: >
23+
agent back story
24+
llm:
25+
model: openrouter/openai/gpt-4o-mini
26+
base_url: https://openrouter.ai/api/v1
27+
28+
judge_agent:
29+
role: >
30+
agent role
31+
goal: >
32+
goal
33+
backstory: >
34+
agent back story
35+
llm:
36+
model: openrouter/openai/gpt-4o-mini
37+
base_url: https://openrouter.ai/api/v1
38+
39+
humanfeedback_agent:
40+
role: >
41+
agent role
42+
goal: >
43+
agent goal
44+
backstory: >
45+
agent back story
46+
llm:
47+
model: openrouter/openai/gpt-4o-mini
48+
base_url: https://openrouter.ai/api/v1
49+
50+
# agent task config
51+
task_config:
52+
extraction_task:
53+
description: >
54+
#add task description
55+
56+
Input: {literature}
57+
58+
59+
expected_output: >
60+
output format: json
61+
Example output: add example
62+
63+
# do not chage this, remove it later
64+
agent_id: extractor_agent
65+
66+
alignment_task:
67+
description: >
68+
Inputs: {extracted_structured_information}
69+
70+
Instructions:
71+
72+
73+
expected_output: >
74+
output format: json
75+
Example output: add example
76+
77+
# do not chage this, remove it later
78+
agent_id: alignment_agent
79+
80+
judge_task:
81+
description: >
82+
{aligned_structured_information}
83+
84+
Instuctions: add instructions
85+
86+
expected_output: >
87+
output format: json
88+
Example output: addd example
89+
90+
# do not chage this, remove it later
91+
agent_id: judge_agent
92+
93+
humanfeedback_task:
94+
description: >
95+
Input: {judged_structured_information_with_human_feedback}
96+
97+
modification_context:
98+
{modification_context}
99+
100+
user_feedback_text:
101+
{user_feedback_text}
102+
103+
Instructions:
104+
add you instructions
105+
106+
107+
108+
expected_output: >
109+
output format: json
110+
Example output: addd example
111+
112+
agent_id: humanfeedback_agent
113+
114+
# embedding config
115+
# see for more details and parameters for config
116+
# https://docs.crewai.com/concepts/memory#additional-embedding-providerscl
117+
embedder_config:
118+
provider: ollama
119+
config:
120+
api_base: http://localhost:11434
121+
model: nomic-embed-text:latest
122+
123+
# knowledge search config
124+
knowledge_config:
125+
search_key: #local vector database
126+
- entity
127+
- label
128+
# human in loop config
129+
human_in_loop_config:
130+
humanfeedback_agent: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
grobid:
3+
image: lfoppiano/grobid:0.8.0
4+
ports:
5+
- "8070:8070"
6+
environment:
7+
JAVA_OPTS: "-XX:+UseZGC"
8+
init: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
ollama:
3+
image: ollama/ollama
4+
container_name: ollama
5+
restart: unless-stopped
6+
ports:
7+
- "11434:11434"
8+
volumes:
9+
- ollama_models:/root/.ollama
10+
entrypoint: >
11+
sh -c "
12+
ollama serve &
13+
sleep 5 &&
14+
ollama pull nomic-embed-text &&
15+
ollama pull deepseek-r1:7b &&
16+
tail -f /dev/null
17+
"
18+
19+
volumes:
20+
ollama_models:

docker/individual/ollama/readme.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## 🔧 Setting Up
2+
3+
1. **Install Docker**
4+
If Docker is not installed on your system, [download and install it](https://docs.docker.com/get-docker/).
5+
6+
2. **Start the Container**
7+
From the project directory, run:
8+
```bash
9+
docker compose up
10+
3. **Test the Setup**
11+
Use the following curl command to verify that the model is responding correctly:
12+
```bash
13+
curl -s http://localhost:11434/api/chat \
14+
-H "Content-Type: application/json" \
15+
-d '{
16+
"model": "deepseek-r1:7b",
17+
"messages": [
18+
{ "role": "user", "content": "Why is the sky blue?" }
19+
]
20+
}' | jq -r 'select(.message.role=="assistant") | .message.content' | tr -d "\n"
21+
22+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
services:
2+
weaviate:
3+
command:
4+
- --host
5+
- 0.0.0.0
6+
- --port
7+
- '8080'
8+
- --scheme
9+
- http
10+
image: cr.weaviate.io/semitechnologies/weaviate:1.29.1
11+
ports:
12+
- 8080:8080
13+
- 50051:50051
14+
volumes:
15+
- weaviate_data:/var/lib/weaviate
16+
- weaviate_backups:/backups # Add this line
17+
restart: on-failure:0
18+
environment:
19+
QUERY_DEFAULTS_LIMIT: 25
20+
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
21+
BACKUP_FILESYSTEM_PATH: '/backups' # Add this line
22+
ENABLE_MODULES: 'text2vec-ollama,generative-ollama'
23+
ENABLE_API_BASED_MODULES: 'true'
24+
CLUSTER_HOSTNAME: 'node1'
25+
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
26+
AUTHENTICATION_APIKEY_ENABLED: 'true'
27+
AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'user-a-key,user-b-key'
28+
AUTHENTICATION_APIKEY_USERS: 'user-a,user-b'
29+
AUTHORIZATION_ENABLE_RBAC: 'true'
30+
AUTHORIZATION_RBAC_ROOT_USERS: 'user-a'
31+
32+
volumes:
33+
weaviate_data:
34+
weaviate_backups:

0 commit comments

Comments
 (0)