sinapsis 0.2.25__tar.gz → 0.2.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sinapsis-0.2.25 → sinapsis-0.2.27}/PKG-INFO +3 -1
- {sinapsis-0.2.25 → sinapsis-0.2.27}/README.md +1 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/pyproject.toml +2 -1
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/webapp/chatbot_base.py +77 -16
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/PKG-INFO +3 -1
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/SOURCES.txt +0 -8
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/requires.txt +1 -0
- sinapsis-0.2.25/.dockerignore +0 -1
- sinapsis-0.2.25/.gitignore +0 -49
- sinapsis-0.2.25/.pre-commit-config.yaml +0 -46
- sinapsis-0.2.25/.python-version +0 -1
- sinapsis-0.2.25/README-internal.md +0 -272
- sinapsis-0.2.25/docker/Dockerfile +0 -43
- sinapsis-0.2.25/docker/compose.yaml +0 -18
- sinapsis-0.2.25/src/sinapsis/configs/hello_world_agent.yml +0 -22
- {sinapsis-0.2.25 → sinapsis-0.2.27}/LICENSE +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/setup.cfg +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/__init__.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/bin/sinapsis_cli.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/templates/__init__.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/templates/display_hello_world.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/templates/hello_world.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/webapp/__init__.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/webapp/agent_gradio_helper.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/webapp/agent_webapp_utils.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis/webapp/tts_base.py +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/dependency_links.txt +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/entry_points.txt +0 -0
- {sinapsis-0.2.25 → sinapsis-0.2.27}/src/sinapsis.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sinapsis
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Modular and Universal AI platform
|
|
5
5
|
Author-email: SinapsisAI <dev@sinapsis.tech>
|
|
6
6
|
Project-URL: Homepage, https://sinapsis.tech
|
|
@@ -15,8 +15,10 @@ Provides-Extra: all
|
|
|
15
15
|
Requires-Dist: sinapsis[dev]; extra == "all"
|
|
16
16
|
Provides-Extra: webapp
|
|
17
17
|
Requires-Dist: gradio<=5.23; extra == "webapp"
|
|
18
|
+
Requires-Dist: opencv-python-headless>=4.13.0.92; extra == "webapp"
|
|
18
19
|
Dynamic: license-file
|
|
19
20
|
|
|
21
|
+
[](https://github.com/Sinapsis-AI/sinapsis/blob/main/README.es.md)
|
|
20
22
|
<h1 align="center">
|
|
21
23
|
<br>
|
|
22
24
|
<a href="https://sinapsis.tech/">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sinapsis"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.27"
|
|
4
4
|
description = "Modular and Universal AI platform"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "SinapsisAI", email = "dev@sinapsis.tech"},
|
|
@@ -28,6 +28,7 @@ all = [
|
|
|
28
28
|
]
|
|
29
29
|
webapp = [
|
|
30
30
|
"gradio<=5.23",
|
|
31
|
+
"opencv-python-headless>=4.13.0.92",
|
|
31
32
|
]
|
|
32
33
|
|
|
33
34
|
|
|
@@ -11,7 +11,8 @@ from pydantic import ConfigDict
|
|
|
11
11
|
from pydantic.dataclasses import dataclass
|
|
12
12
|
from sinapsis_core.agent.agent import Agent
|
|
13
13
|
from sinapsis_core.cli.run_agent_from_config import generic_agent_builder
|
|
14
|
-
from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket,
|
|
14
|
+
from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket, LLMConversationPacket
|
|
15
|
+
from sinapsis_core.data_containers.model_types import LLMIdentity
|
|
15
16
|
from sinapsis_core.utils.env_var_keys import SINAPSIS_CACHE_DIR
|
|
16
17
|
from sinapsis_core.utils.logging_utils import sinapsis_logger
|
|
17
18
|
|
|
@@ -33,17 +34,15 @@ class ChatbotConfig:
|
|
|
33
34
|
|
|
34
35
|
Attributes:
|
|
35
36
|
app_title (str): The title displayed on the chatbot interface.
|
|
36
|
-
login_message (str): The message shown on the login screen.
|
|
37
37
|
login_image (str): URL of the image displayed on the login screen.
|
|
38
|
-
enable_memories (bool): Flag to enable memory features.
|
|
39
38
|
examples (list[str] | None): Optional list of example inputs to show in the UI.
|
|
40
|
-
users_db_config (dict[str, str] | None): Database configuration for user authentication.
|
|
41
39
|
"""
|
|
42
40
|
|
|
43
41
|
app_title: str = "Sinapsis Chatbot"
|
|
44
42
|
login_image: str = SINAPSIS_AVATAR
|
|
45
|
-
# enable_memories: bool = True
|
|
46
43
|
examples: list[str] | None = None
|
|
44
|
+
system_prompt: str = "You are a helpful assistant"
|
|
45
|
+
delete_history_config_path: str | None = None
|
|
47
46
|
|
|
48
47
|
|
|
49
48
|
@dataclass
|
|
@@ -67,6 +66,18 @@ class ChatKeys:
|
|
|
67
66
|
video_path: str = "VideoWriter"
|
|
68
67
|
|
|
69
68
|
|
|
69
|
+
class HistoryChatKeys(ChatKeys):
|
|
70
|
+
"""Extends `ChatKeys` to include references to templates used for chat history operations.
|
|
71
|
+
|
|
72
|
+
This class centralizes template key names used for fetching, saving, and deleting
|
|
73
|
+
chat history entries within the agent.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
chat_fetch_template: str = "ChatHistoryFetch"
|
|
77
|
+
chat_save_template: str = "ChatHistorySave"
|
|
78
|
+
chat_delete_template: str = "ChatHistoryDelete"
|
|
79
|
+
|
|
80
|
+
|
|
70
81
|
@dataclass(config=ConfigDict(arbitrary_types_allowed=True))
|
|
71
82
|
class ChatInterfaceComponents:
|
|
72
83
|
"""Container for core UI components used in the chat interface.
|
|
@@ -75,12 +86,18 @@ class ChatInterfaceComponents:
|
|
|
75
86
|
chatbot (gr.Chatbot): The chatbot message display area.
|
|
76
87
|
textbox (gr.MultimodalTextbox): Input field for user messages and file uploads.
|
|
77
88
|
session_state (gr.State): State object to track the user's session.
|
|
89
|
+
user_id (gr.Textbox): Hidden input used to scope user-specific chat operations.
|
|
90
|
+
chatbot_state (gr.State): Internal Gradio chat history state used by `ChatInterface`.
|
|
91
|
+
chatbot_value (gr.State): Mirror of the chatbot value managed by `ChatInterface`.
|
|
78
92
|
chat_interface (gr.ChatInterface): Main Gradio chat interface component.
|
|
79
93
|
"""
|
|
80
94
|
|
|
81
95
|
chatbot: gr.Chatbot
|
|
82
96
|
textbox: gr.MultimodalTextbox
|
|
83
97
|
session_state: gr.State
|
|
98
|
+
user_id: gr.Textbox
|
|
99
|
+
chatbot_state: gr.State
|
|
100
|
+
chatbot_value: gr.State
|
|
84
101
|
chat_interface: gr.ChatInterface
|
|
85
102
|
|
|
86
103
|
|
|
@@ -97,6 +114,11 @@ class BaseChatbot:
|
|
|
97
114
|
def __init__(self, config_file: str, config: ChatbotConfig | dict[str, Any] = ChatbotConfig()) -> None:
|
|
98
115
|
self.config_file = config_file
|
|
99
116
|
self.config = ChatbotConfig(**config) if isinstance(config, dict) else config
|
|
117
|
+
self.deletion_agent = (
|
|
118
|
+
self.initialize_agent(self.config.delete_history_config_path)
|
|
119
|
+
if self.config.delete_history_config_path
|
|
120
|
+
else None
|
|
121
|
+
)
|
|
100
122
|
self.chatbot_height = "70vh"
|
|
101
123
|
self.agent = self.initialize_agent(self.config_file)
|
|
102
124
|
self.examples = (
|
|
@@ -157,8 +179,7 @@ class BaseChatbot:
|
|
|
157
179
|
gr.update(interactive=False),
|
|
158
180
|
)
|
|
159
181
|
|
|
160
|
-
|
|
161
|
-
def generate_packet(message: dict[str, Any], user_id: str, session_id: str | None = None) -> DataContainer:
|
|
182
|
+
def generate_packet(self, message: dict[str, Any], user_id: str, session_id: str | None = None) -> DataContainer:
|
|
162
183
|
"""Constructs a DataContainer from user input including text, files, and optional session info.
|
|
163
184
|
|
|
164
185
|
Args:
|
|
@@ -172,7 +193,12 @@ class BaseChatbot:
|
|
|
172
193
|
|
|
173
194
|
container = DataContainer()
|
|
174
195
|
if message.get(ChatKeys.text, False):
|
|
175
|
-
|
|
196
|
+
identity = LLMIdentity(session_id=session_id, user_id=user_id, run_id=session_id)
|
|
197
|
+
container.llm_conversations.append(
|
|
198
|
+
LLMConversationPacket(
|
|
199
|
+
content=message.get(ChatKeys.text), identity=identity, system_prompt=self.config.system_prompt
|
|
200
|
+
)
|
|
201
|
+
)
|
|
176
202
|
for file_path in message.get(ChatKeys.files, []):
|
|
177
203
|
if file_path.endswith(".wav"):
|
|
178
204
|
container.generic_data[ChatKeys.audio_path] = file_path
|
|
@@ -196,8 +222,8 @@ class BaseChatbot:
|
|
|
196
222
|
result_container = self.agent(container)
|
|
197
223
|
response = {}
|
|
198
224
|
|
|
199
|
-
if result_container.
|
|
200
|
-
response[ChatKeys.text] = result_container.
|
|
225
|
+
if result_container.llm_conversations:
|
|
226
|
+
response[ChatKeys.text] = result_container.llm_conversations[-1].response
|
|
201
227
|
|
|
202
228
|
if result_container.images:
|
|
203
229
|
image_packet = container.images[-1]
|
|
@@ -289,20 +315,34 @@ class BaseChatbot:
|
|
|
289
315
|
)
|
|
290
316
|
chatbot.clear(self.handle_clear_history, inputs=[session_state, user_id])
|
|
291
317
|
|
|
292
|
-
return ChatInterfaceComponents(
|
|
318
|
+
return ChatInterfaceComponents(
|
|
319
|
+
chatbot,
|
|
320
|
+
textbox,
|
|
321
|
+
session_state,
|
|
322
|
+
user_id,
|
|
323
|
+
chat_interface.chatbot_state,
|
|
324
|
+
chat_interface.chatbot_value,
|
|
325
|
+
chat_interface,
|
|
326
|
+
)
|
|
293
327
|
|
|
294
328
|
def clear_user_conversation(self, user_id: str, session_id: str | None = None) -> None:
|
|
295
329
|
"""Clears stored conversation data for the specified user/session.
|
|
296
330
|
|
|
297
|
-
Can be overridden by subclasses to customize additional actions when clearing conversations.
|
|
298
|
-
|
|
299
331
|
Args:
|
|
300
332
|
user_id (str): Unique user identifier.
|
|
301
|
-
session_id (str | None, optional):
|
|
333
|
+
session_id (str | None, optional): Optional session ID to scope clearing. Defaults to None.
|
|
302
334
|
|
|
303
335
|
Returns:
|
|
304
336
|
Any: Result of the clear operation (to be defined by subclasses).
|
|
305
337
|
"""
|
|
338
|
+
filters = {"user_id": user_id}
|
|
339
|
+
if session_id:
|
|
340
|
+
filters["session_id"] = session_id
|
|
341
|
+
|
|
342
|
+
self.deletion_agent.update_template_attribute(HistoryChatKeys.chat_delete_template, "delete_args", filters)
|
|
343
|
+
self.deletion_agent.reset_state(HistoryChatKeys.chat_delete_template)
|
|
344
|
+
self.deletion_agent()
|
|
345
|
+
gr.Info("Conversation removed!")
|
|
306
346
|
|
|
307
347
|
def handle_clear_history(self, session_state: gr.State, user_id: str) -> None:
|
|
308
348
|
"""Triggers the clearing of a user's chat history from the UI button.
|
|
@@ -311,8 +351,22 @@ class BaseChatbot:
|
|
|
311
351
|
session_state (gr.State): Current session state object.
|
|
312
352
|
user_id (str): Gradio request containing user/session info.
|
|
313
353
|
"""
|
|
314
|
-
|
|
315
|
-
|
|
354
|
+
if self.deletion_agent is not None:
|
|
355
|
+
self.clear_user_conversation(user_id, session_state)
|
|
356
|
+
|
|
357
|
+
def clear_history_and_chat(self, session_state: gr.State, user_id: str) -> tuple[list[dict[str, Any]], ...]:
|
|
358
|
+
"""Clear persisted history and reset the visible chat transcript.
|
|
359
|
+
|
|
360
|
+
Args:
|
|
361
|
+
session_state (gr.State): Current session state object.
|
|
362
|
+
user_id (str): Gradio request containing user/session info.
|
|
363
|
+
|
|
364
|
+
Returns:
|
|
365
|
+
tuple[list[dict[str, Any]], ...]: Empty values for the chatbot and internal Gradio chat state.
|
|
366
|
+
"""
|
|
367
|
+
self.handle_clear_history(session_state, user_id)
|
|
368
|
+
empty_history: list[dict[str, Any]] = []
|
|
369
|
+
return empty_history, empty_history, empty_history
|
|
316
370
|
|
|
317
371
|
def _add_buttons(self, chat_components: ChatInterfaceComponents):
|
|
318
372
|
"""Adds 'Stop' and 'Start Chatbot' buttons to control agent lifecycle.
|
|
@@ -327,6 +381,13 @@ class BaseChatbot:
|
|
|
327
381
|
restart_btn = gr.Button("Start Chatbot", interactive=False)
|
|
328
382
|
stop_btn.click(self.stop_agent, outputs=[chat_components.textbox, stop_btn, restart_btn])
|
|
329
383
|
restart_btn.click(self.restart_agent, outputs=[chat_components.textbox, stop_btn, restart_btn])
|
|
384
|
+
if self.deletion_agent is not None:
|
|
385
|
+
clear_history_btn = gr.Button("Clear history")
|
|
386
|
+
clear_history_btn.click(
|
|
387
|
+
self.clear_history_and_chat,
|
|
388
|
+
inputs=[chat_components.session_state, chat_components.user_id],
|
|
389
|
+
outputs=[chat_components.chatbot, chat_components.chatbot_state, chat_components.chatbot_value],
|
|
390
|
+
)
|
|
330
391
|
|
|
331
392
|
def _inject_header_components(self):
|
|
332
393
|
"""Adds visual elements at the top of the UI (e.g., logo, app title).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sinapsis
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Modular and Universal AI platform
|
|
5
5
|
Author-email: SinapsisAI <dev@sinapsis.tech>
|
|
6
6
|
Project-URL: Homepage, https://sinapsis.tech
|
|
@@ -15,8 +15,10 @@ Provides-Extra: all
|
|
|
15
15
|
Requires-Dist: sinapsis[dev]; extra == "all"
|
|
16
16
|
Provides-Extra: webapp
|
|
17
17
|
Requires-Dist: gradio<=5.23; extra == "webapp"
|
|
18
|
+
Requires-Dist: opencv-python-headless>=4.13.0.92; extra == "webapp"
|
|
18
19
|
Dynamic: license-file
|
|
19
20
|
|
|
21
|
+
[](https://github.com/Sinapsis-AI/sinapsis/blob/main/README.es.md)
|
|
20
22
|
<h1 align="center">
|
|
21
23
|
<br>
|
|
22
24
|
<a href="https://sinapsis.tech/">
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
.dockerignore
|
|
2
|
-
.gitignore
|
|
3
|
-
.pre-commit-config.yaml
|
|
4
|
-
.python-version
|
|
5
1
|
LICENSE
|
|
6
|
-
README-internal.md
|
|
7
2
|
README.md
|
|
8
3
|
pyproject.toml
|
|
9
|
-
docker/Dockerfile
|
|
10
|
-
docker/compose.yaml
|
|
11
4
|
src/sinapsis/__init__.py
|
|
12
5
|
src/sinapsis.egg-info/PKG-INFO
|
|
13
6
|
src/sinapsis.egg-info/SOURCES.txt
|
|
@@ -16,7 +9,6 @@ src/sinapsis.egg-info/entry_points.txt
|
|
|
16
9
|
src/sinapsis.egg-info/requires.txt
|
|
17
10
|
src/sinapsis.egg-info/top_level.txt
|
|
18
11
|
src/sinapsis/bin/sinapsis_cli.py
|
|
19
|
-
src/sinapsis/configs/hello_world_agent.yml
|
|
20
12
|
src/sinapsis/templates/__init__.py
|
|
21
13
|
src/sinapsis/templates/display_hello_world.py
|
|
22
14
|
src/sinapsis/templates/hello_world.py
|
sinapsis-0.2.25/.dockerignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.venv
|
sinapsis-0.2.25/.gitignore
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Byte-compiled / optimized / DLL files
|
|
2
|
-
__pycache__/
|
|
3
|
-
*.py[cod]
|
|
4
|
-
*$py.class
|
|
5
|
-
|
|
6
|
-
# Distribution / packaging
|
|
7
|
-
.Python
|
|
8
|
-
build/
|
|
9
|
-
develop-eggs/
|
|
10
|
-
dist/
|
|
11
|
-
downloads/
|
|
12
|
-
eggs/
|
|
13
|
-
.eggs/
|
|
14
|
-
lib/
|
|
15
|
-
lib64/
|
|
16
|
-
parts/
|
|
17
|
-
sdist/
|
|
18
|
-
var/
|
|
19
|
-
wheels/
|
|
20
|
-
share/python-wheels/
|
|
21
|
-
*.egg-info/
|
|
22
|
-
.installed.cfg
|
|
23
|
-
*.egg
|
|
24
|
-
MANIFEST
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.pdm.toml
|
|
28
|
-
.pdm-python
|
|
29
|
-
.pdm-build/
|
|
30
|
-
|
|
31
|
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
32
|
-
__pypackages__/
|
|
33
|
-
|
|
34
|
-
# Environments
|
|
35
|
-
.env
|
|
36
|
-
.venv
|
|
37
|
-
env/
|
|
38
|
-
venv/
|
|
39
|
-
ENV/
|
|
40
|
-
env.bak/
|
|
41
|
-
venv.bak/
|
|
42
|
-
|
|
43
|
-
# mypy
|
|
44
|
-
.mypy_cache/
|
|
45
|
-
.dmypy.json
|
|
46
|
-
dmypy.json
|
|
47
|
-
|
|
48
|
-
artifacts/*
|
|
49
|
-
.vscode/*
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
fail_fast: True
|
|
2
|
-
|
|
3
|
-
repos:
|
|
4
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
-
rev: v5.0.0
|
|
6
|
-
hooks:
|
|
7
|
-
- id: fix-encoding-pragma
|
|
8
|
-
exclude: 'docs/.*'
|
|
9
|
-
- id: check-yaml
|
|
10
|
-
exclude: 'docs/.*'
|
|
11
|
-
- id: trailing-whitespace
|
|
12
|
-
exclude: 'docs/.*'
|
|
13
|
-
- id: name-tests-test
|
|
14
|
-
args: ["--pytest-test-first"]
|
|
15
|
-
exclude: 'docs/.*'
|
|
16
|
-
- id: check-added-large-files
|
|
17
|
-
args: ["--maxkb=10"]
|
|
18
|
-
- id: check-docstring-first
|
|
19
|
-
exclude: 'docs/.*'
|
|
20
|
-
- id: check-case-conflict
|
|
21
|
-
exclude: 'docs/.*'
|
|
22
|
-
- id: check-shebang-scripts-are-executable
|
|
23
|
-
exclude: 'docs/.*'
|
|
24
|
-
|
|
25
|
-
- repo: https://github.com/gitleaks/gitleaks
|
|
26
|
-
rev: v8.16.1
|
|
27
|
-
hooks:
|
|
28
|
-
- id: gitleaks
|
|
29
|
-
exclude: '.*/tests/.*'
|
|
30
|
-
|
|
31
|
-
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
32
|
-
rev: v0.9.3
|
|
33
|
-
hooks:
|
|
34
|
-
- id: ruff
|
|
35
|
-
- id: ruff-format
|
|
36
|
-
|
|
37
|
-
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
38
|
-
rev: v1.14.1
|
|
39
|
-
hooks:
|
|
40
|
-
- id: mypy
|
|
41
|
-
name: mypy
|
|
42
|
-
entry: mypy
|
|
43
|
-
language: python
|
|
44
|
-
types: [python]
|
|
45
|
-
additional_dependencies:
|
|
46
|
-
- "pydantic>=2.8.2"
|
sinapsis-0.2.25/.python-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.10.12
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
<br>
|
|
3
|
-
<a href="https://sinapsis.tech/">
|
|
4
|
-
<img
|
|
5
|
-
src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
|
|
6
|
-
alt="" width="300">
|
|
7
|
-
</a>
|
|
8
|
-
<br>
|
|
9
|
-
Sinapsis
|
|
10
|
-
<br>
|
|
11
|
-
</h1>
|
|
12
|
-
|
|
13
|
-
<h4 align="center">Build and manage AI workflows through modular and scalable Agents based on composite and reusable Templates. </h4>
|
|
14
|
-
|
|
15
|
-
<p align="center">
|
|
16
|
-
<a href="#installation">⚙️ Installation</a> •
|
|
17
|
-
<a href="#quickstart">⚡ Quickstart</a> •
|
|
18
|
-
<a href="#features">🎯 Features</a> •
|
|
19
|
-
<a href="#examples">👀 Examples</a> •
|
|
20
|
-
<a href="#documentation">📙 Documentation</a> •
|
|
21
|
-
<a href="#packages">📚 Available sinapsis packages</a>
|
|
22
|
-
<a href="#packages">🔍 License</a>
|
|
23
|
-
</p>
|
|
24
|
-
|
|
25
|
-
<h4 align="center">
|
|
26
|
-
<b>Welcome to Sinapsis!</b>
|
|
27
|
-
The all-in-one AI-native platform that unifies the most powerful and innovative AI tools, from computer vision
|
|
28
|
-
and NLP to GenAI, speech processing, time-series analysis, and beyond. Whether you're building, experimenting, or
|
|
29
|
-
deploying, Sinapsis empowers you to create seamless end-to-end workflows, unlocking new possibilities and
|
|
30
|
-
accelerating AI-driven innovation like never before. Join us in shaping the future of AI!
|
|
31
|
-
</h4>
|
|
32
|
-
|
|
33
|
-
<h2 id="installation">⚙️ Installation</h2>
|
|
34
|
-
1. Clone the repository.
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
git clone git@github.com:Sinapsis-ai/sinapsis.git
|
|
38
|
-
cd sinapsis
|
|
39
|
-
```
|
|
40
|
-
> [!IMPORTANT]
|
|
41
|
-
> Sinapsis requires Python 3.10 or higher.
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
We strongly encourage the use of <code>uv</code>, although any other package manager should work too.
|
|
45
|
-
If you need to install <code>uv</code> please see the [official documentation](https://docs.astral.sh/uv/getting-started/installation/#installation-methods).
|
|
46
|
-
|
|
47
|
-
<details>
|
|
48
|
-
<summary><strong><span style="font-size: 1.4em;">🐍 Install from PyPi </span></strong></summary>
|
|
49
|
-
|
|
50
|
-
2. Install using your favourite package manager.
|
|
51
|
-
|
|
52
|
-
Example with <code>uv</code>:
|
|
53
|
-
```bash
|
|
54
|
-
uv pip install sinapsis
|
|
55
|
-
```
|
|
56
|
-
or with raw <code>pip</code>:
|
|
57
|
-
```bash
|
|
58
|
-
pip install sinapsis
|
|
59
|
-
```
|
|
60
|
-
</details>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<details>
|
|
64
|
-
<summary><strong><span style="font-size: 1.4em;">💻 Build from source with UV</span></strong></summary>
|
|
65
|
-
|
|
66
|
-
2. Create virtual environment and install dependencies:
|
|
67
|
-
```bash
|
|
68
|
-
uv sync --frozen --all-extras
|
|
69
|
-
```
|
|
70
|
-
3. Activate the virtual environment:
|
|
71
|
-
```bash
|
|
72
|
-
source .venv/bin/activate
|
|
73
|
-
```
|
|
74
|
-
4. Build and install the package:
|
|
75
|
-
```bash
|
|
76
|
-
uv build && uv pip install dist/sinapsis-0.1.0-py3-none-any.whl
|
|
77
|
-
```
|
|
78
|
-
</details>
|
|
79
|
-
|
|
80
|
-
<details>
|
|
81
|
-
<summary><strong><span style="font-size: 1.4em;">🐳 Build with Docker</span></strong></summary>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Sinapsis provides Docker images with all dependencies pre-configured. To build images:
|
|
85
|
-
|
|
86
|
-
2. run the following command
|
|
87
|
-
```bash
|
|
88
|
-
docker compose -f docker/compose.yaml build
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
This will create two docker images:
|
|
92
|
-
- **sinapsis:base**: Contains UV package manager, git with SSH support, and Python 3.10 environment.
|
|
93
|
-
- **sinapsis-nvidia:base**: Same as base plus CUDA 12.4.0 support for GPU acceleration.
|
|
94
|
-
</details>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<h2 id="quickstart">⚡ Quickstart</h2>
|
|
98
|
-
|
|
99
|
-
<details>
|
|
100
|
-
<summary><strong><span style="font-size: 1.4em;">CLI usage</span></strong></summary>
|
|
101
|
-
|
|
102
|
-
The Sinapsis CLI provides an easy way to run agents and get information about templates:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
# Run an agent with a config file
|
|
106
|
-
sinapsis run config.yml
|
|
107
|
-
|
|
108
|
-
# Run an agent with profiler enabled
|
|
109
|
-
sinapsis run config.yml --enable-profiler
|
|
110
|
-
|
|
111
|
-
# List all available templates
|
|
112
|
-
sinapsis info --all-template-names
|
|
113
|
-
|
|
114
|
-
# Get detailed info about a specific template
|
|
115
|
-
sinapsis info --template TemplateName
|
|
116
|
-
|
|
117
|
-
# Get example config for a template
|
|
118
|
-
sinapsis info --example-template-config TemplateName
|
|
119
|
-
|
|
120
|
-
# Display info for all templates
|
|
121
|
-
sinapsis info --all
|
|
122
|
-
```
|
|
123
|
-
</details>
|
|
124
|
-
|
|
125
|
-
<details>
|
|
126
|
-
<summary><strong><span style="font-size: 1.4em;">📖 Hello World Sinapsis</span></strong></summary>
|
|
127
|
-
|
|
128
|
-
**Create a config file my_test_agent.yml:**
|
|
129
|
-
|
|
130
|
-
You can also use the ones defined under the ```src/configs/``` folder
|
|
131
|
-
```yaml
|
|
132
|
-
agent:
|
|
133
|
-
name: my_test_agent
|
|
134
|
-
|
|
135
|
-
templates:
|
|
136
|
-
- template_name: InputTemplate-1
|
|
137
|
-
class_name: InputTemplate
|
|
138
|
-
attributes: {}
|
|
139
|
-
|
|
140
|
-
- template_name: HelloWorld-1
|
|
141
|
-
class_name: HelloWorld
|
|
142
|
-
template_input: InputTemplate-1
|
|
143
|
-
attributes:
|
|
144
|
-
display_text: "Hello, this is my first template!"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
**Run the agent:**
|
|
148
|
-
```bash
|
|
149
|
-
sinapsis run my_test_agent.yml
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Output**
|
|
153
|
-
|
|
154
|
-
```console
|
|
155
|
-
... | DEBUG | my_test_agent:__instantiate_templates:105 - Initialized template: InputTemplate-1
|
|
156
|
-
... | DEBUG | my_test_agent:__instantiate_templates:105 - Initialized template: HelloWorld-1
|
|
157
|
-
... | DEBUG | my_test_agent:_log_agent_execution_order:119 - Execution Order
|
|
158
|
-
... | DEBUG | my_test_agent:_log_agent_execution_order:122 - Order: <<0>>, template name: <<InputTemplate-1>>
|
|
159
|
-
... | DEBUG | my_test_agent:_log_agent_execution_order:122 - Order: <<1>>, template name: <<HelloWorld-1>>
|
|
160
|
-
... | INFO | my_test_agent:_lazy_init:63 - Agent and templates initialized
|
|
161
|
-
... | INFO | my_test_agent:signal_block_if_needed:156 - Signaling block mode for HelloWorld-1 no: 2/2
|
|
162
|
-
... | INFO | my_test_agent:all_templates_finished:192 - All templates returned finished, stopping execution...
|
|
163
|
-
... | DEBUG | .../run_agent_from_config.py:run_agent_from_config:41 - result: DataContainer(container_id=abc..., images=[], audios=[], texts=[TextPacket(content='Hello, this is my first template!', id='abc...', source='HelloWorld-1', modified_by_templates=['HelloWorld-1'], embedding=[], generic_data={}, annotations=None)], time_series=[], binary_data=[], generic_data={})
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
</details>
|
|
167
|
-
|
|
168
|
-
<h2 id="features">🎯 Key Features</h2>
|
|
169
|
-
|
|
170
|
-
<details>
|
|
171
|
-
<summary><strong><span style="font-size: 1.4em;">Agents</span></strong></summary>
|
|
172
|
-
|
|
173
|
-
- Declarative workflows
|
|
174
|
-
- Multiple execution modes:
|
|
175
|
-
- Generator
|
|
176
|
-
- Single execute
|
|
177
|
-
- Continuous execution
|
|
178
|
-
- Sophisticated template orchestration:
|
|
179
|
-
- Topological sorting of execution order
|
|
180
|
-
- Parallel template execution
|
|
181
|
-
- Execution blocking control
|
|
182
|
-
- Built-in profiling capabilities:
|
|
183
|
-
- Execution time tracking
|
|
184
|
-
- State management:
|
|
185
|
-
- Dynamic attribute updates
|
|
186
|
-
- Failure handling
|
|
187
|
-
</details>
|
|
188
|
-
|
|
189
|
-
<details>
|
|
190
|
-
<summary><strong><span style="font-size: 1.4em;">Templates</span></strong></summary>
|
|
191
|
-
|
|
192
|
-
- Self-contained components
|
|
193
|
-
- Modular task-focused execution
|
|
194
|
-
- Eager or lazy evaluation
|
|
195
|
-
- Dynamic template definitions
|
|
196
|
-
- Composite templates
|
|
197
|
-
- SubAgents
|
|
198
|
-
|
|
199
|
-
</details>
|
|
200
|
-
|
|
201
|
-
<details>
|
|
202
|
-
<summary><strong><span style="font-size: 1.4em;">Data Containers</span></strong></summary>
|
|
203
|
-
|
|
204
|
-
- Universal data transport
|
|
205
|
-
- Domain agnostic design
|
|
206
|
-
- Native built-in support for images, audio, text, time series
|
|
207
|
-
- Multimodal data
|
|
208
|
-
|
|
209
|
-
</details>
|
|
210
|
-
|
|
211
|
-
<details>
|
|
212
|
-
<summary><strong><span style="font-size: 1.4em;">General</span></strong></summary>
|
|
213
|
-
|
|
214
|
-
- Data Validation and Type Safety through Pydantic
|
|
215
|
-
- YAML-based configuration files
|
|
216
|
-
</details>
|
|
217
|
-
|
|
218
|
-
<h2 id="examples">👀 Examples</h2>
|
|
219
|
-
|
|
220
|
-
You can find specific implementations of templates in:
|
|
221
|
-
|
|
222
|
-
* **Static Templates**
|
|
223
|
-
* [Hello World Template](src/sinapsis/templates/hello_world.py)
|
|
224
|
-
* [Sinapsis Video Readers](https://github.com/Sinapsis-ai/sinapsis-data-tools/tree/main/packages/sinapsis_data_readers)
|
|
225
|
-
|
|
226
|
-
* **Dynamic Templates**
|
|
227
|
-
* [Sinapsis LangChain](https://github.com/Sinapsis-ai/sinapsis-langchain)
|
|
228
|
-
|
|
229
|
-
<h2 id="documentation">📙 Documentation</h2>
|
|
230
|
-
|
|
231
|
-
Documentation is available on the [sinapsis website](https://docs.sinapsis.tech/docs)
|
|
232
|
-
|
|
233
|
-
Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)
|
|
234
|
-
|
|
235
|
-
<h2 id="packages">📚 Available sinapsis packages</h2>
|
|
236
|
-
|
|
237
|
-
The sinapsis framework contains a list of public packages with **Templates** covering a wide range of tasks,
|
|
238
|
-
including computer vision, time series, nlp, llm'. These packages include:
|
|
239
|
-
<details>
|
|
240
|
-
<summary><strong><span style="font-size: 1.4em;">sinapsis data tools</span></strong></summary>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
* [sinapsis-data-readers](https://github.com/Sinapsis-ai/sinapsis-data-tools/tree/main/packages/sinapsis_data_readers): package with tools to handle the data reading, using different libraries to process images, videos, audios, etc.
|
|
244
|
-
|
|
245
|
-
* [sinapsis-data-writers](https://github.com/Sinapsis-ai/sinapsis-data-tools/tree/main/packages/sinapsis_data_writers): package with tools to handle data writing, using different libraries to write in local environment images, audios, videos, etc.
|
|
246
|
-
|
|
247
|
-
* [sinapsis-data-visualization](https://github.com/Sinapsis-ai/sinapsis-data-tools/tree/main/packages/sinapsis_data_visualization): package with data visualization and drawing tools.
|
|
248
|
-
|
|
249
|
-
* [sinapsis-generic-data-tools](https://github.com/Sinapsis-ai/sinapsis-data-tools/tree/main/packages/sinapsis_generic_data_tools): package with generic tools for data handling; i.e., selection regions of interest, buffering of data, postprocessing of text, etc.
|
|
250
|
-
|
|
251
|
-
</details>
|
|
252
|
-
|
|
253
|
-
<details>
|
|
254
|
-
<summary><strong><span style="font-size: 1.4em;">sinapsis langchain</span></strong></summary>
|
|
255
|
-
|
|
256
|
-
* [sinapsis-langchain-readers](https://github.com/Sinapsis-ai/sinapsis-langchain): package with document readers using the langchain library.
|
|
257
|
-
</details>
|
|
258
|
-
<details>
|
|
259
|
-
<summary><strong><span style="font-size: 1.4em;">sinapsis image transforms</span></strong></summary>
|
|
260
|
-
|
|
261
|
-
* [sinapsis-image-transforms](https://github.com/Sinapsis-ai/sinapsis-image-transforms): package with templates using the Albumentations library to perform image transformations.
|
|
262
|
-
</details>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
<h2 id="license">🔍 License</h2>
|
|
266
|
-
|
|
267
|
-
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.
|
|
268
|
-
|
|
269
|
-
For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
ARG UBUNTU_VERSION=22.04
|
|
2
|
-
ARG CUDA_VERSION=12.4.0
|
|
3
|
-
FROM ubuntu:$UBUNTU_VERSION AS base
|
|
4
|
-
|
|
5
|
-
# install essential packages
|
|
6
|
-
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
7
|
-
build-essential \
|
|
8
|
-
python3.10 \
|
|
9
|
-
python3-pip \
|
|
10
|
-
curl \
|
|
11
|
-
ca-certificates \
|
|
12
|
-
-y libglib2.0-0 libgl1-mesa-glx \
|
|
13
|
-
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
14
|
-
|
|
15
|
-
# install uv
|
|
16
|
-
ADD https://astral.sh/uv/0.6.17/install.sh /uv-installer.sh
|
|
17
|
-
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
|
18
|
-
ENV PATH="/root/.local/bin/:$PATH"
|
|
19
|
-
COPY . /app/
|
|
20
|
-
|
|
21
|
-
# sync all requirements including optional ones
|
|
22
|
-
WORKDIR /app/.venv
|
|
23
|
-
RUN uv sync --frozen --all-extras
|
|
24
|
-
|
|
25
|
-
# install the generated wheel for this app
|
|
26
|
-
RUN uv pip install sinapsis --extra-index-url https://pypi.sinapsis.tech
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
FROM nvidia/cuda:${CUDA_VERSION}-base-ubuntu$UBUNTU_VERSION AS nvidia-base
|
|
30
|
-
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
31
|
-
build-essential \
|
|
32
|
-
python3.10 \
|
|
33
|
-
python3-pip \
|
|
34
|
-
curl \
|
|
35
|
-
ca-certificates \
|
|
36
|
-
-y libglib2.0-0 libgl1-mesa-glx \
|
|
37
|
-
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
COPY --from=base /root/.local/bin /root/.local/bin
|
|
41
|
-
COPY --from=base /app/ /app/
|
|
42
|
-
ENV PATH="/root/.local/bin/:$PATH"
|
|
43
|
-
WORKDIR /app/.venv
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
sinapsis-base: &default
|
|
3
|
-
image: sinapsis:base
|
|
4
|
-
build:
|
|
5
|
-
context: ../
|
|
6
|
-
dockerfile: docker/Dockerfile
|
|
7
|
-
target: base
|
|
8
|
-
ssh:
|
|
9
|
-
- default
|
|
10
|
-
environment:
|
|
11
|
-
PYTHONPATH: /lib/python3.10/:/app/.venv/lib/python3.10/site-packages
|
|
12
|
-
|
|
13
|
-
sinapsis-nvidia-base:
|
|
14
|
-
extends:
|
|
15
|
-
service: sinapsis-base
|
|
16
|
-
image: sinapsis-nvidia:base
|
|
17
|
-
build:
|
|
18
|
-
target: nvidia-base
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
agent:
|
|
2
|
-
name: hello_world_agent
|
|
3
|
-
attributes:
|
|
4
|
-
templates_to_profile: "HelloWorld"
|
|
5
|
-
description: "Hello world agent example"
|
|
6
|
-
|
|
7
|
-
templates:
|
|
8
|
-
- template_name: InputTemplate # template name can be anything but must be unique
|
|
9
|
-
class_name: InputTemplate
|
|
10
|
-
attributes: {}
|
|
11
|
-
|
|
12
|
-
- template_name: HelloWorld
|
|
13
|
-
class_name: HelloWorld
|
|
14
|
-
template_input: InputTemplate
|
|
15
|
-
attributes:
|
|
16
|
-
display_text: "Hello, this is my first template!"
|
|
17
|
-
|
|
18
|
-
- template_name: DisplayHelloWorld
|
|
19
|
-
class_name: DisplayHelloWorld
|
|
20
|
-
template_input: HelloWorld
|
|
21
|
-
attributes: {} # we did not define any attributes in our template
|
|
22
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|