dtSpark 1.0.4__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.
- dtspark-1.0.4/LICENSE +21 -0
- dtspark-1.0.4/MANIFEST.in +7 -0
- dtspark-1.0.4/PKG-INFO +187 -0
- dtspark-1.0.4/README.md +113 -0
- dtspark-1.0.4/pyproject.toml +156 -0
- dtspark-1.0.4/setup.cfg +4 -0
- dtspark-1.0.4/setup.py +139 -0
- dtspark-1.0.4/src/dtSpark/__init__.py +0 -0
- dtspark-1.0.4/src/dtSpark/_description.txt +1 -0
- dtspark-1.0.4/src/dtSpark/_full_name.txt +1 -0
- dtspark-1.0.4/src/dtSpark/_licence.txt +21 -0
- dtspark-1.0.4/src/dtSpark/_metadata.yaml +6 -0
- dtspark-1.0.4/src/dtSpark/_name.txt +1 -0
- dtspark-1.0.4/src/dtSpark/_version.txt +1 -0
- dtspark-1.0.4/src/dtSpark/aws/__init__.py +7 -0
- dtspark-1.0.4/src/dtSpark/aws/authentication.py +296 -0
- dtspark-1.0.4/src/dtSpark/aws/bedrock.py +578 -0
- dtspark-1.0.4/src/dtSpark/aws/costs.py +318 -0
- dtspark-1.0.4/src/dtSpark/aws/pricing.py +580 -0
- dtspark-1.0.4/src/dtSpark/cli_interface.py +2645 -0
- dtspark-1.0.4/src/dtSpark/conversation_manager.py +3050 -0
- dtspark-1.0.4/src/dtSpark/core/__init__.py +12 -0
- dtspark-1.0.4/src/dtSpark/core/application.py +3355 -0
- dtspark-1.0.4/src/dtSpark/core/context_compaction.py +735 -0
- dtspark-1.0.4/src/dtSpark/daemon/__init__.py +104 -0
- dtspark-1.0.4/src/dtSpark/daemon/__main__.py +10 -0
- dtspark-1.0.4/src/dtSpark/daemon/action_monitor.py +213 -0
- dtspark-1.0.4/src/dtSpark/daemon/daemon_app.py +730 -0
- dtspark-1.0.4/src/dtSpark/daemon/daemon_manager.py +289 -0
- dtspark-1.0.4/src/dtSpark/daemon/execution_coordinator.py +194 -0
- dtspark-1.0.4/src/dtSpark/daemon/pid_file.py +169 -0
- dtspark-1.0.4/src/dtSpark/database/__init__.py +482 -0
- dtspark-1.0.4/src/dtSpark/database/autonomous_actions.py +1191 -0
- dtspark-1.0.4/src/dtSpark/database/backends.py +329 -0
- dtspark-1.0.4/src/dtSpark/database/connection.py +122 -0
- dtspark-1.0.4/src/dtSpark/database/conversations.py +520 -0
- dtspark-1.0.4/src/dtSpark/database/credential_prompt.py +218 -0
- dtspark-1.0.4/src/dtSpark/database/files.py +205 -0
- dtspark-1.0.4/src/dtSpark/database/mcp_ops.py +355 -0
- dtspark-1.0.4/src/dtSpark/database/messages.py +161 -0
- dtspark-1.0.4/src/dtSpark/database/schema.py +673 -0
- dtspark-1.0.4/src/dtSpark/database/tool_permissions.py +186 -0
- dtspark-1.0.4/src/dtSpark/database/usage.py +167 -0
- dtspark-1.0.4/src/dtSpark/files/__init__.py +4 -0
- dtspark-1.0.4/src/dtSpark/files/manager.py +322 -0
- dtspark-1.0.4/src/dtSpark/launch.py +39 -0
- dtspark-1.0.4/src/dtSpark/limits/__init__.py +10 -0
- dtspark-1.0.4/src/dtSpark/limits/costs.py +296 -0
- dtspark-1.0.4/src/dtSpark/limits/tokens.py +342 -0
- dtspark-1.0.4/src/dtSpark/llm/__init__.py +17 -0
- dtspark-1.0.4/src/dtSpark/llm/anthropic_direct.py +446 -0
- dtspark-1.0.4/src/dtSpark/llm/base.py +146 -0
- dtspark-1.0.4/src/dtSpark/llm/context_limits.py +438 -0
- dtspark-1.0.4/src/dtSpark/llm/manager.py +177 -0
- dtspark-1.0.4/src/dtSpark/llm/ollama.py +578 -0
- dtspark-1.0.4/src/dtSpark/mcp_integration/__init__.py +5 -0
- dtspark-1.0.4/src/dtSpark/mcp_integration/manager.py +653 -0
- dtspark-1.0.4/src/dtSpark/mcp_integration/tool_selector.py +225 -0
- dtspark-1.0.4/src/dtSpark/resources/config.yaml.template +631 -0
- dtspark-1.0.4/src/dtSpark/safety/__init__.py +22 -0
- dtspark-1.0.4/src/dtSpark/safety/llm_service.py +111 -0
- dtspark-1.0.4/src/dtSpark/safety/patterns.py +229 -0
- dtspark-1.0.4/src/dtSpark/safety/prompt_inspector.py +442 -0
- dtspark-1.0.4/src/dtSpark/safety/violation_logger.py +346 -0
- dtspark-1.0.4/src/dtSpark/scheduler/__init__.py +20 -0
- dtspark-1.0.4/src/dtSpark/scheduler/creation_tools.py +599 -0
- dtspark-1.0.4/src/dtSpark/scheduler/execution_queue.py +159 -0
- dtspark-1.0.4/src/dtSpark/scheduler/executor.py +1152 -0
- dtspark-1.0.4/src/dtSpark/scheduler/manager.py +395 -0
- dtspark-1.0.4/src/dtSpark/tools/__init__.py +4 -0
- dtspark-1.0.4/src/dtSpark/tools/builtin.py +833 -0
- dtspark-1.0.4/src/dtSpark/web/__init__.py +20 -0
- dtspark-1.0.4/src/dtSpark/web/auth.py +152 -0
- dtspark-1.0.4/src/dtSpark/web/dependencies.py +37 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/__init__.py +17 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/autonomous_actions.py +1125 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/chat.py +621 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/conversations.py +353 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/main_menu.py +547 -0
- dtspark-1.0.4/src/dtSpark/web/endpoints/streaming.py +421 -0
- dtspark-1.0.4/src/dtSpark/web/server.py +578 -0
- dtspark-1.0.4/src/dtSpark/web/session.py +167 -0
- dtspark-1.0.4/src/dtSpark/web/ssl_utils.py +195 -0
- dtspark-1.0.4/src/dtSpark/web/static/css/dark-theme.css +427 -0
- dtspark-1.0.4/src/dtSpark/web/static/js/actions.js +1101 -0
- dtspark-1.0.4/src/dtSpark/web/static/js/chat.js +614 -0
- dtspark-1.0.4/src/dtSpark/web/static/js/main.js +496 -0
- dtspark-1.0.4/src/dtSpark/web/static/js/sse-client.js +242 -0
- dtspark-1.0.4/src/dtSpark/web/templates/actions.html +408 -0
- dtspark-1.0.4/src/dtSpark/web/templates/base.html +93 -0
- dtspark-1.0.4/src/dtSpark/web/templates/chat.html +814 -0
- dtspark-1.0.4/src/dtSpark/web/templates/conversations.html +350 -0
- dtspark-1.0.4/src/dtSpark/web/templates/goodbye.html +81 -0
- dtspark-1.0.4/src/dtSpark/web/templates/login.html +90 -0
- dtspark-1.0.4/src/dtSpark/web/templates/main_menu.html +983 -0
- dtspark-1.0.4/src/dtSpark/web/templates/new_conversation.html +191 -0
- dtspark-1.0.4/src/dtSpark/web/web_interface.py +137 -0
- dtspark-1.0.4/src/dtSpark.egg-info/PKG-INFO +187 -0
- dtspark-1.0.4/src/dtSpark.egg-info/SOURCES.txt +119 -0
- dtspark-1.0.4/src/dtSpark.egg-info/dependency_links.txt +1 -0
- dtspark-1.0.4/src/dtSpark.egg-info/entry_points.txt +3 -0
- dtspark-1.0.4/src/dtSpark.egg-info/not-zip-safe +1 -0
- dtspark-1.0.4/src/dtSpark.egg-info/requires.txt +43 -0
- dtspark-1.0.4/src/dtSpark.egg-info/top_level.txt +1 -0
- dtspark-1.0.4/tests/README.md +464 -0
- dtspark-1.0.4/tests/debug_bulk_api.py +77 -0
- dtspark-1.0.4/tests/diagnose_aws_costs.py +226 -0
- dtspark-1.0.4/tests/test_builtin_tools.py +139 -0
- dtspark-1.0.4/tests/test_builtin_tools_integration.py +186 -0
- dtspark-1.0.4/tests/test_bulk_pricing.py +88 -0
- dtspark-1.0.4/tests/test_filesystem_tools.py +408 -0
- dtspark-1.0.4/tests/test_mcp_server.py +231 -0
- dtspark-1.0.4/tests/test_ollama_context.py +97 -0
- dtspark-1.0.4/tests/test_ollama_conversation.py +71 -0
- dtspark-1.0.4/tests/test_ollama_integration.py +76 -0
- dtspark-1.0.4/tests/test_pricing_integration.py +74 -0
- dtspark-1.0.4/tests/test_prompt_inspection.py +184 -0
- dtspark-1.0.4/tests/test_status_indicator.py +91 -0
- dtspark-1.0.4/tests/test_tool_selector.py +209 -0
- dtspark-1.0.4/tests/test_web_auth.py +102 -0
- dtspark-1.0.4/tests/test_web_session.py +150 -0
dtspark-1.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2025 Matthew Westwood-Hill / Digital-Thought
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dtspark-1.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dtSpark
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Secure Personal AI Research Kit - Multi-provider LLM CLI/Web interface with MCP tool integration
|
|
5
|
+
Home-page: https://github.com/digital-thought/dtSpark
|
|
6
|
+
Author: Matthew Westwood-Hill
|
|
7
|
+
Author-email: Matthew Westwood-Hill <matthew@digital-thought.org>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/digital-thought/dtSpark
|
|
10
|
+
Project-URL: Documentation, https://github.com/digital-thought/dtSpark#readme
|
|
11
|
+
Project-URL: Repository, https://github.com/digital-thought/dtSpark
|
|
12
|
+
Project-URL: Issues, https://github.com/digital-thought/dtSpark/issues
|
|
13
|
+
Keywords: llm,ai,chatbot,aws,bedrock,anthropic,claude,ollama,mcp,model-context-protocol,cli,web
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Environment :: Web Environment
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Information Technology
|
|
19
|
+
Classifier: Intended Audience :: Science/Research
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Topic :: Communications :: Chat
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: boto3>=1.28.0
|
|
33
|
+
Requires-Dist: botocore>=1.31.0
|
|
34
|
+
Requires-Dist: fastapi>=0.100.0
|
|
35
|
+
Requires-Dist: uvicorn>=0.22.0
|
|
36
|
+
Requires-Dist: jinja2>=3.1.0
|
|
37
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
38
|
+
Requires-Dist: sse-starlette>=1.6.0
|
|
39
|
+
Requires-Dist: rich>=13.0.0
|
|
40
|
+
Requires-Dist: prompt_toolkit>=3.0.0
|
|
41
|
+
Requires-Dist: httpx>=0.24.0
|
|
42
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
43
|
+
Requires-Dist: mcp>=0.9.0
|
|
44
|
+
Requires-Dist: pyyaml>=6.0
|
|
45
|
+
Requires-Dist: dtPyAppFramework>=4.0.3
|
|
46
|
+
Requires-Dist: tiktoken>=0.5.0
|
|
47
|
+
Requires-Dist: ollama>=0.2.0
|
|
48
|
+
Requires-Dist: cryptography>=41.0.0
|
|
49
|
+
Requires-Dist: anthropic>=0.18.0
|
|
50
|
+
Requires-Dist: APScheduler>=3.10.0
|
|
51
|
+
Requires-Dist: markdown>=3.4.0
|
|
52
|
+
Provides-Extra: dev
|
|
53
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
57
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
58
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
60
|
+
Provides-Extra: mysql
|
|
61
|
+
Requires-Dist: mysql-connector-python>=8.0.0; extra == "mysql"
|
|
62
|
+
Provides-Extra: postgresql
|
|
63
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgresql"
|
|
64
|
+
Provides-Extra: mssql
|
|
65
|
+
Requires-Dist: pyodbc>=4.0.0; extra == "mssql"
|
|
66
|
+
Provides-Extra: all-databases
|
|
67
|
+
Requires-Dist: mysql-connector-python>=8.0.0; extra == "all-databases"
|
|
68
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all-databases"
|
|
69
|
+
Requires-Dist: pyodbc>=4.0.0; extra == "all-databases"
|
|
70
|
+
Dynamic: author
|
|
71
|
+
Dynamic: home-page
|
|
72
|
+
Dynamic: license-file
|
|
73
|
+
Dynamic: requires-python
|
|
74
|
+
|
|
75
|
+
# Spark - Secure Personal AI Research Kit
|
|
76
|
+
|
|
77
|
+
[](https://opensource.org/licenses/MIT)
|
|
78
|
+
[](https://www.python.org/downloads/)
|
|
79
|
+
|
|
80
|
+
**Spark** is a powerful, multi-provider LLM interface for conversational AI with integrated tool support. It supports AWS Bedrock, Anthropic Direct API, and Ollama local models through both CLI and Web interfaces.
|
|
81
|
+
|
|
82
|
+
## Key Features
|
|
83
|
+
|
|
84
|
+
- **Multi-Provider Support** - AWS Bedrock, Anthropic Direct API, and Ollama local models
|
|
85
|
+
- **Dual Interface** - Rich CLI terminal UI and modern Web browser interface
|
|
86
|
+
- **MCP Tool Integration** - Connect external tools via Model Context Protocol
|
|
87
|
+
- **Intelligent Context Management** - Automatic conversation compaction with model-aware limits
|
|
88
|
+
- **Security Features** - Prompt inspection, tool permissions, and audit logging
|
|
89
|
+
- **Multiple Database Backends** - SQLite, MySQL, PostgreSQL, and Microsoft SQL Server
|
|
90
|
+
|
|
91
|
+
## Quick Start
|
|
92
|
+
|
|
93
|
+
### Installation
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install dtSpark
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### First-Time Setup
|
|
100
|
+
|
|
101
|
+
Run the interactive setup wizard to configure Spark:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
spark --setup
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This guides you through:
|
|
108
|
+
- LLM provider selection and configuration
|
|
109
|
+
- Database setup
|
|
110
|
+
- Interface preferences
|
|
111
|
+
- Security settings
|
|
112
|
+
|
|
113
|
+
### Running Spark
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Start with CLI interface
|
|
117
|
+
spark
|
|
118
|
+
|
|
119
|
+
# Or use the alternative command
|
|
120
|
+
dtSpark
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Documentation
|
|
124
|
+
|
|
125
|
+
Comprehensive documentation is available in the [docs](docs/) folder:
|
|
126
|
+
|
|
127
|
+
- [Installation Guide](docs/installation.md) - Detailed installation instructions
|
|
128
|
+
- [Configuration Reference](docs/configuration.md) - Complete config.yaml documentation
|
|
129
|
+
- [Features Guide](docs/features.md) - Detailed feature documentation
|
|
130
|
+
- [CLI Reference](docs/cli-reference.md) - Command-line options and chat commands
|
|
131
|
+
- [Web Interface](docs/web-interface.md) - Web UI guide
|
|
132
|
+
- [MCP Integration](docs/mcp-integration.md) - Tool integration documentation
|
|
133
|
+
- [Security](docs/security.md) - Security features and best practices
|
|
134
|
+
|
|
135
|
+
## Architecture Overview
|
|
136
|
+
|
|
137
|
+
```mermaid
|
|
138
|
+
graph LR
|
|
139
|
+
subgraph Interfaces
|
|
140
|
+
CLI[CLI]
|
|
141
|
+
WEB[Web]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
subgraph Core
|
|
145
|
+
CM[Conversation<br/>Manager]
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
subgraph Providers
|
|
149
|
+
BEDROCK[AWS Bedrock]
|
|
150
|
+
ANTHROPIC[Anthropic]
|
|
151
|
+
OLLAMA[Ollama]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
subgraph Tools
|
|
155
|
+
MCP[MCP Servers]
|
|
156
|
+
BUILTIN[Built-in Tools]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
CLI --> CM
|
|
160
|
+
WEB --> CM
|
|
161
|
+
CM --> BEDROCK
|
|
162
|
+
CM --> ANTHROPIC
|
|
163
|
+
CM --> OLLAMA
|
|
164
|
+
CM --> MCP
|
|
165
|
+
CM --> BUILTIN
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Requirements
|
|
169
|
+
|
|
170
|
+
- Python 3.10 or higher
|
|
171
|
+
- AWS credentials (for Bedrock)
|
|
172
|
+
- Anthropic API key (for direct API)
|
|
173
|
+
- Ollama server (for local models)
|
|
174
|
+
|
|
175
|
+
## Licence
|
|
176
|
+
|
|
177
|
+
MIT Licence - see [LICENSE](LICENSE) for details.
|
|
178
|
+
|
|
179
|
+
## Author
|
|
180
|
+
|
|
181
|
+
Matthew Westwood-Hill
|
|
182
|
+
matthew@digital-thought.org
|
|
183
|
+
|
|
184
|
+
## Support
|
|
185
|
+
|
|
186
|
+
- **Documentation**: [docs/](docs/)
|
|
187
|
+
- **Issues**: [GitHub Issues](https://github.com/digital-thought/dtSpark/issues)
|
dtspark-1.0.4/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Spark - Secure Personal AI Research Kit
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
**Spark** is a powerful, multi-provider LLM interface for conversational AI with integrated tool support. It supports AWS Bedrock, Anthropic Direct API, and Ollama local models through both CLI and Web interfaces.
|
|
7
|
+
|
|
8
|
+
## Key Features
|
|
9
|
+
|
|
10
|
+
- **Multi-Provider Support** - AWS Bedrock, Anthropic Direct API, and Ollama local models
|
|
11
|
+
- **Dual Interface** - Rich CLI terminal UI and modern Web browser interface
|
|
12
|
+
- **MCP Tool Integration** - Connect external tools via Model Context Protocol
|
|
13
|
+
- **Intelligent Context Management** - Automatic conversation compaction with model-aware limits
|
|
14
|
+
- **Security Features** - Prompt inspection, tool permissions, and audit logging
|
|
15
|
+
- **Multiple Database Backends** - SQLite, MySQL, PostgreSQL, and Microsoft SQL Server
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install dtSpark
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### First-Time Setup
|
|
26
|
+
|
|
27
|
+
Run the interactive setup wizard to configure Spark:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
spark --setup
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This guides you through:
|
|
34
|
+
- LLM provider selection and configuration
|
|
35
|
+
- Database setup
|
|
36
|
+
- Interface preferences
|
|
37
|
+
- Security settings
|
|
38
|
+
|
|
39
|
+
### Running Spark
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Start with CLI interface
|
|
43
|
+
spark
|
|
44
|
+
|
|
45
|
+
# Or use the alternative command
|
|
46
|
+
dtSpark
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
Comprehensive documentation is available in the [docs](docs/) folder:
|
|
52
|
+
|
|
53
|
+
- [Installation Guide](docs/installation.md) - Detailed installation instructions
|
|
54
|
+
- [Configuration Reference](docs/configuration.md) - Complete config.yaml documentation
|
|
55
|
+
- [Features Guide](docs/features.md) - Detailed feature documentation
|
|
56
|
+
- [CLI Reference](docs/cli-reference.md) - Command-line options and chat commands
|
|
57
|
+
- [Web Interface](docs/web-interface.md) - Web UI guide
|
|
58
|
+
- [MCP Integration](docs/mcp-integration.md) - Tool integration documentation
|
|
59
|
+
- [Security](docs/security.md) - Security features and best practices
|
|
60
|
+
|
|
61
|
+
## Architecture Overview
|
|
62
|
+
|
|
63
|
+
```mermaid
|
|
64
|
+
graph LR
|
|
65
|
+
subgraph Interfaces
|
|
66
|
+
CLI[CLI]
|
|
67
|
+
WEB[Web]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
subgraph Core
|
|
71
|
+
CM[Conversation<br/>Manager]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
subgraph Providers
|
|
75
|
+
BEDROCK[AWS Bedrock]
|
|
76
|
+
ANTHROPIC[Anthropic]
|
|
77
|
+
OLLAMA[Ollama]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
subgraph Tools
|
|
81
|
+
MCP[MCP Servers]
|
|
82
|
+
BUILTIN[Built-in Tools]
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
CLI --> CM
|
|
86
|
+
WEB --> CM
|
|
87
|
+
CM --> BEDROCK
|
|
88
|
+
CM --> ANTHROPIC
|
|
89
|
+
CM --> OLLAMA
|
|
90
|
+
CM --> MCP
|
|
91
|
+
CM --> BUILTIN
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
|
|
96
|
+
- Python 3.10 or higher
|
|
97
|
+
- AWS credentials (for Bedrock)
|
|
98
|
+
- Anthropic API key (for direct API)
|
|
99
|
+
- Ollama server (for local models)
|
|
100
|
+
|
|
101
|
+
## Licence
|
|
102
|
+
|
|
103
|
+
MIT Licence - see [LICENSE](LICENSE) for details.
|
|
104
|
+
|
|
105
|
+
## Author
|
|
106
|
+
|
|
107
|
+
Matthew Westwood-Hill
|
|
108
|
+
matthew@digital-thought.org
|
|
109
|
+
|
|
110
|
+
## Support
|
|
111
|
+
|
|
112
|
+
- **Documentation**: [docs/](docs/)
|
|
113
|
+
- **Issues**: [GitHub Issues](https://github.com/digital-thought/dtSpark/issues)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dtSpark"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Secure Personal AI Research Kit - Multi-provider LLM CLI/Web interface with MCP tool integration"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Matthew Westwood-Hill", email = "matthew@digital-thought.org"}
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"llm",
|
|
17
|
+
"ai",
|
|
18
|
+
"chatbot",
|
|
19
|
+
"aws",
|
|
20
|
+
"bedrock",
|
|
21
|
+
"anthropic",
|
|
22
|
+
"claude",
|
|
23
|
+
"ollama",
|
|
24
|
+
"mcp",
|
|
25
|
+
"model-context-protocol",
|
|
26
|
+
"cli",
|
|
27
|
+
"web",
|
|
28
|
+
]
|
|
29
|
+
classifiers = [
|
|
30
|
+
"Development Status :: 4 - Beta",
|
|
31
|
+
"Environment :: Console",
|
|
32
|
+
"Environment :: Web Environment",
|
|
33
|
+
"Intended Audience :: Developers",
|
|
34
|
+
"Intended Audience :: Information Technology",
|
|
35
|
+
"Intended Audience :: Science/Research",
|
|
36
|
+
"License :: OSI Approved :: MIT License",
|
|
37
|
+
"Operating System :: OS Independent",
|
|
38
|
+
"Programming Language :: Python :: 3",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
43
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
44
|
+
"Topic :: Communications :: Chat",
|
|
45
|
+
]
|
|
46
|
+
dependencies = [
|
|
47
|
+
"boto3>=1.28.0",
|
|
48
|
+
"botocore>=1.31.0",
|
|
49
|
+
"fastapi>=0.100.0",
|
|
50
|
+
"uvicorn>=0.22.0",
|
|
51
|
+
"jinja2>=3.1.0",
|
|
52
|
+
"python-multipart>=0.0.6",
|
|
53
|
+
"sse-starlette>=1.6.0",
|
|
54
|
+
"rich>=13.0.0",
|
|
55
|
+
"prompt_toolkit>=3.0.0",
|
|
56
|
+
"httpx>=0.24.0",
|
|
57
|
+
"aiohttp>=3.8.0",
|
|
58
|
+
"mcp>=0.9.0",
|
|
59
|
+
"pyyaml>=6.0",
|
|
60
|
+
"dtPyAppFramework>=4.0.3",
|
|
61
|
+
"tiktoken>=0.5.0",
|
|
62
|
+
"ollama>=0.2.0",
|
|
63
|
+
"cryptography>=41.0.0",
|
|
64
|
+
"anthropic>=0.18.0",
|
|
65
|
+
"APScheduler>=3.10.0",
|
|
66
|
+
"markdown>=3.4.0",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[project.optional-dependencies]
|
|
70
|
+
dev = [
|
|
71
|
+
"pytest>=7.0.0",
|
|
72
|
+
"pytest-asyncio>=0.21.0",
|
|
73
|
+
"pytest-cov>=4.0.0",
|
|
74
|
+
"black>=23.0.0",
|
|
75
|
+
"isort>=5.12.0",
|
|
76
|
+
"mypy>=1.0.0",
|
|
77
|
+
"flake8>=6.0.0",
|
|
78
|
+
]
|
|
79
|
+
mysql = ["mysql-connector-python>=8.0.0"]
|
|
80
|
+
postgresql = ["psycopg2-binary>=2.9.0"]
|
|
81
|
+
mssql = ["pyodbc>=4.0.0"]
|
|
82
|
+
all-databases = [
|
|
83
|
+
"mysql-connector-python>=8.0.0",
|
|
84
|
+
"psycopg2-binary>=2.9.0",
|
|
85
|
+
"pyodbc>=4.0.0",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[project.scripts]
|
|
89
|
+
spark = "dtSpark.launch:main"
|
|
90
|
+
dtSpark = "dtSpark.launch:main"
|
|
91
|
+
|
|
92
|
+
[project.urls]
|
|
93
|
+
Homepage = "https://github.com/digital-thought/dtSpark"
|
|
94
|
+
Documentation = "https://github.com/digital-thought/dtSpark#readme"
|
|
95
|
+
Repository = "https://github.com/digital-thought/dtSpark"
|
|
96
|
+
Issues = "https://github.com/digital-thought/dtSpark/issues"
|
|
97
|
+
|
|
98
|
+
[tool.poetry]
|
|
99
|
+
name = "dtSpark"
|
|
100
|
+
|
|
101
|
+
[tool.setuptools]
|
|
102
|
+
package-dir = {"" = "src"}
|
|
103
|
+
|
|
104
|
+
[tool.setuptools.packages.find]
|
|
105
|
+
where = ["src"]
|
|
106
|
+
|
|
107
|
+
[tool.setuptools.dynamic]
|
|
108
|
+
version = {file = "src/dtSpark/_version.txt"}
|
|
109
|
+
|
|
110
|
+
[tool.setuptools.package-data]
|
|
111
|
+
dtSpark = [
|
|
112
|
+
"_*.txt",
|
|
113
|
+
"_*.yaml",
|
|
114
|
+
"resources/*.yaml",
|
|
115
|
+
"resources/*.template",
|
|
116
|
+
"web/templates/*.html",
|
|
117
|
+
"web/static/css/*.css",
|
|
118
|
+
"web/static/js/*.js",
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
[tool.black]
|
|
122
|
+
line-length = 100
|
|
123
|
+
target-version = ['py310', 'py311', 'py312']
|
|
124
|
+
include = '\.pyi?$'
|
|
125
|
+
exclude = '''
|
|
126
|
+
/(
|
|
127
|
+
\.eggs
|
|
128
|
+
| \.git
|
|
129
|
+
| \.hg
|
|
130
|
+
| \.mypy_cache
|
|
131
|
+
| \.tox
|
|
132
|
+
| \.venv
|
|
133
|
+
| _build
|
|
134
|
+
| buck-out
|
|
135
|
+
| build
|
|
136
|
+
| dist
|
|
137
|
+
)/
|
|
138
|
+
'''
|
|
139
|
+
|
|
140
|
+
[tool.isort]
|
|
141
|
+
profile = "black"
|
|
142
|
+
line_length = 100
|
|
143
|
+
skip_gitignore = true
|
|
144
|
+
|
|
145
|
+
[tool.mypy]
|
|
146
|
+
python_version = "3.10"
|
|
147
|
+
warn_return_any = true
|
|
148
|
+
warn_unused_configs = true
|
|
149
|
+
ignore_missing_imports = true
|
|
150
|
+
|
|
151
|
+
[tool.pytest.ini_options]
|
|
152
|
+
testpaths = ["tests"]
|
|
153
|
+
python_files = "test_*.py"
|
|
154
|
+
python_classes = "Test*"
|
|
155
|
+
python_functions = "test_*"
|
|
156
|
+
addopts = "-v --tb=short"
|
dtspark-1.0.4/setup.cfg
ADDED
dtspark-1.0.4/setup.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Setup script for Spark - Secure Personal AI Research Kit.
|
|
4
|
+
|
|
5
|
+
A multi-provider LLM CLI and Web interface with MCP tool integration.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from setuptools import setup, find_packages
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
# Read the README file
|
|
12
|
+
this_directory = Path(__file__).parent
|
|
13
|
+
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
|
14
|
+
|
|
15
|
+
# Read version from _version.txt
|
|
16
|
+
version_file = this_directory / "src" / "dtSpark" / "_version.txt"
|
|
17
|
+
version = version_file.read_text(encoding="utf-8").strip()
|
|
18
|
+
|
|
19
|
+
setup(
|
|
20
|
+
name="dtSpark",
|
|
21
|
+
version=version,
|
|
22
|
+
author="Matthew Westwood-Hill",
|
|
23
|
+
author_email="matthew@digital-thought.org",
|
|
24
|
+
description="Secure Personal AI Research Kit - Multi-provider LLM CLI/Web interface with MCP tool integration",
|
|
25
|
+
long_description=long_description,
|
|
26
|
+
long_description_content_type="text/markdown",
|
|
27
|
+
url="https://github.com/digital-thought/dtSpark",
|
|
28
|
+
project_urls={
|
|
29
|
+
"Bug Reports": "https://github.com/digital-thought/dtSpark/issues",
|
|
30
|
+
"Source": "https://github.com/digital-thought/dtSpark",
|
|
31
|
+
"Documentation": "https://github.com/digital-thought/dtSpark#readme",
|
|
32
|
+
},
|
|
33
|
+
license="MIT",
|
|
34
|
+
classifiers=[
|
|
35
|
+
"Development Status :: 4 - Beta",
|
|
36
|
+
"Environment :: Console",
|
|
37
|
+
"Environment :: Web Environment",
|
|
38
|
+
"Intended Audience :: Developers",
|
|
39
|
+
"Intended Audience :: Information Technology",
|
|
40
|
+
"Intended Audience :: Science/Research",
|
|
41
|
+
"License :: OSI Approved :: MIT License",
|
|
42
|
+
"Operating System :: OS Independent",
|
|
43
|
+
"Programming Language :: Python :: 3",
|
|
44
|
+
"Programming Language :: Python :: 3.10",
|
|
45
|
+
"Programming Language :: Python :: 3.11",
|
|
46
|
+
"Programming Language :: Python :: 3.12",
|
|
47
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
48
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
49
|
+
"Topic :: Communications :: Chat",
|
|
50
|
+
],
|
|
51
|
+
keywords=[
|
|
52
|
+
"llm",
|
|
53
|
+
"ai",
|
|
54
|
+
"chatbot",
|
|
55
|
+
"aws",
|
|
56
|
+
"bedrock",
|
|
57
|
+
"anthropic",
|
|
58
|
+
"claude",
|
|
59
|
+
"ollama",
|
|
60
|
+
"mcp",
|
|
61
|
+
"model-context-protocol",
|
|
62
|
+
"cli",
|
|
63
|
+
"web",
|
|
64
|
+
],
|
|
65
|
+
package_dir={"": "src"},
|
|
66
|
+
packages=find_packages(where="src"),
|
|
67
|
+
include_package_data=True,
|
|
68
|
+
package_data={
|
|
69
|
+
"dtSpark": [
|
|
70
|
+
"_*.txt",
|
|
71
|
+
"_*.yaml",
|
|
72
|
+
"resources/*.yaml",
|
|
73
|
+
"resources/*.template",
|
|
74
|
+
"web/templates/*.html",
|
|
75
|
+
"web/static/css/*.css",
|
|
76
|
+
"web/static/js/*.js",
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
python_requires=">=3.10",
|
|
80
|
+
install_requires=[
|
|
81
|
+
# AWS SDK
|
|
82
|
+
"boto3>=1.28.0",
|
|
83
|
+
"botocore>=1.31.0",
|
|
84
|
+
# Web framework
|
|
85
|
+
"fastapi>=0.100.0",
|
|
86
|
+
"uvicorn>=0.22.0",
|
|
87
|
+
"jinja2>=3.1.0",
|
|
88
|
+
"python-multipart>=0.0.6",
|
|
89
|
+
"sse-starlette>=1.6.0",
|
|
90
|
+
# CLI interface
|
|
91
|
+
"rich>=13.0.0",
|
|
92
|
+
"prompt_toolkit>=3.0.0",
|
|
93
|
+
# HTTP client
|
|
94
|
+
"httpx>=0.24.0",
|
|
95
|
+
"aiohttp>=3.8.0",
|
|
96
|
+
# MCP (Model Context Protocol)
|
|
97
|
+
"mcp>=0.9.0",
|
|
98
|
+
# Data handling
|
|
99
|
+
"pyyaml>=6.0",
|
|
100
|
+
# Application framework
|
|
101
|
+
"dtPyAppFramework>=0.1.0",
|
|
102
|
+
# Cryptography for SSL
|
|
103
|
+
"cryptography>=41.0.0",
|
|
104
|
+
# Anthropic direct API (optional but commonly used)
|
|
105
|
+
"anthropic>=0.18.0",
|
|
106
|
+
],
|
|
107
|
+
extras_require={
|
|
108
|
+
"dev": [
|
|
109
|
+
"pytest>=7.0.0",
|
|
110
|
+
"pytest-asyncio>=0.21.0",
|
|
111
|
+
"pytest-cov>=4.0.0",
|
|
112
|
+
"black>=23.0.0",
|
|
113
|
+
"isort>=5.12.0",
|
|
114
|
+
"mypy>=1.0.0",
|
|
115
|
+
"flake8>=6.0.0",
|
|
116
|
+
],
|
|
117
|
+
"mysql": [
|
|
118
|
+
"mysql-connector-python>=8.0.0",
|
|
119
|
+
],
|
|
120
|
+
"postgresql": [
|
|
121
|
+
"psycopg2-binary>=2.9.0",
|
|
122
|
+
],
|
|
123
|
+
"mssql": [
|
|
124
|
+
"pyodbc>=4.0.0",
|
|
125
|
+
],
|
|
126
|
+
"all-databases": [
|
|
127
|
+
"mysql-connector-python>=8.0.0",
|
|
128
|
+
"psycopg2-binary>=2.9.0",
|
|
129
|
+
"pyodbc>=4.0.0",
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
entry_points={
|
|
133
|
+
"console_scripts": [
|
|
134
|
+
"spark=dtSpark.launch:main",
|
|
135
|
+
"dtSpark=dtSpark.launch:main"
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
zip_safe=False,
|
|
139
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Spark is a powerful, multi-provider LLM interface for conversational AI with integrated tool support. It supports AWS Bedrock, Anthropic Direct API, and Ollama local models through both CLI and Web interfaces.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Secure Personal AI Research Kit
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Digital-Thought
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dtSpark
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.4
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""AWS integration module."""
|
|
2
|
+
from .authentication import AWSAuthenticator
|
|
3
|
+
from .bedrock import BedrockService
|
|
4
|
+
from .pricing import BedrockPricing
|
|
5
|
+
from .costs import CostTracker
|
|
6
|
+
|
|
7
|
+
__all__ = ['AWSAuthenticator', 'BedrockService', 'BedrockPricing', 'CostTracker']
|