symbolicai 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
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.
- symai/__init__.py +198 -134
- symai/backend/base.py +51 -51
- symai/backend/engines/drawing/engine_bfl.py +33 -33
- symai/backend/engines/drawing/engine_gpt_image.py +4 -10
- symai/backend/engines/embedding/engine_llama_cpp.py +50 -35
- symai/backend/engines/embedding/engine_openai.py +22 -16
- symai/backend/engines/execute/engine_python.py +16 -16
- symai/backend/engines/files/engine_io.py +51 -49
- symai/backend/engines/imagecaptioning/engine_blip2.py +27 -23
- symai/backend/engines/imagecaptioning/engine_llavacpp_client.py +53 -46
- symai/backend/engines/index/engine_pinecone.py +116 -88
- symai/backend/engines/index/engine_qdrant.py +1011 -0
- symai/backend/engines/index/engine_vectordb.py +78 -52
- symai/backend/engines/lean/engine_lean4.py +65 -25
- symai/backend/engines/neurosymbolic/__init__.py +35 -28
- symai/backend/engines/neurosymbolic/engine_anthropic_claudeX_chat.py +137 -135
- symai/backend/engines/neurosymbolic/engine_anthropic_claudeX_reasoning.py +145 -152
- symai/backend/engines/neurosymbolic/engine_cerebras.py +328 -0
- symai/backend/engines/neurosymbolic/engine_deepseekX_reasoning.py +75 -49
- symai/backend/engines/neurosymbolic/engine_google_geminiX_reasoning.py +199 -155
- symai/backend/engines/neurosymbolic/engine_groq.py +106 -72
- symai/backend/engines/neurosymbolic/engine_huggingface.py +100 -67
- symai/backend/engines/neurosymbolic/engine_llama_cpp.py +121 -93
- symai/backend/engines/neurosymbolic/engine_openai_gptX_chat.py +213 -132
- symai/backend/engines/neurosymbolic/engine_openai_gptX_reasoning.py +180 -137
- symai/backend/engines/ocr/engine_apilayer.py +18 -20
- symai/backend/engines/output/engine_stdout.py +9 -9
- symai/backend/engines/{webscraping → scrape}/engine_requests.py +25 -11
- symai/backend/engines/search/engine_openai.py +95 -83
- symai/backend/engines/search/engine_parallel.py +665 -0
- symai/backend/engines/search/engine_perplexity.py +40 -41
- symai/backend/engines/search/engine_serpapi.py +33 -28
- symai/backend/engines/speech_to_text/engine_local_whisper.py +37 -27
- symai/backend/engines/symbolic/engine_wolframalpha.py +14 -8
- symai/backend/engines/text_to_speech/engine_openai.py +15 -19
- symai/backend/engines/text_vision/engine_clip.py +34 -28
- symai/backend/engines/userinput/engine_console.py +3 -4
- symai/backend/mixin/__init__.py +4 -0
- symai/backend/mixin/anthropic.py +48 -40
- symai/backend/mixin/cerebras.py +9 -0
- symai/backend/mixin/deepseek.py +4 -5
- symai/backend/mixin/google.py +5 -4
- symai/backend/mixin/groq.py +2 -4
- symai/backend/mixin/openai.py +132 -110
- symai/backend/settings.py +14 -14
- symai/chat.py +164 -94
- symai/collect/dynamic.py +13 -11
- symai/collect/pipeline.py +39 -31
- symai/collect/stats.py +109 -69
- symai/components.py +578 -238
- symai/constraints.py +14 -5
- symai/core.py +1495 -1210
- symai/core_ext.py +55 -50
- symai/endpoints/api.py +113 -58
- symai/extended/api_builder.py +22 -17
- symai/extended/arxiv_pdf_parser.py +13 -5
- symai/extended/bibtex_parser.py +8 -4
- symai/extended/conversation.py +88 -69
- symai/extended/document.py +40 -27
- symai/extended/file_merger.py +45 -7
- symai/extended/graph.py +38 -24
- symai/extended/html_style_template.py +17 -11
- symai/extended/interfaces/blip_2.py +1 -1
- symai/extended/interfaces/clip.py +4 -2
- symai/extended/interfaces/console.py +5 -3
- symai/extended/interfaces/dall_e.py +3 -1
- symai/extended/interfaces/file.py +2 -0
- symai/extended/interfaces/flux.py +3 -1
- symai/extended/interfaces/gpt_image.py +15 -6
- symai/extended/interfaces/input.py +2 -1
- symai/extended/interfaces/llava.py +1 -1
- symai/extended/interfaces/{naive_webscraping.py → naive_scrape.py} +3 -2
- symai/extended/interfaces/naive_vectordb.py +2 -2
- symai/extended/interfaces/ocr.py +4 -2
- symai/extended/interfaces/openai_search.py +2 -0
- symai/extended/interfaces/parallel.py +30 -0
- symai/extended/interfaces/perplexity.py +2 -0
- symai/extended/interfaces/pinecone.py +6 -4
- symai/extended/interfaces/python.py +2 -0
- symai/extended/interfaces/serpapi.py +2 -0
- symai/extended/interfaces/terminal.py +0 -1
- symai/extended/interfaces/tts.py +2 -1
- symai/extended/interfaces/whisper.py +2 -1
- symai/extended/interfaces/wolframalpha.py +1 -0
- symai/extended/metrics/__init__.py +1 -1
- symai/extended/metrics/similarity.py +5 -2
- symai/extended/os_command.py +31 -22
- symai/extended/packages/symdev.py +39 -34
- symai/extended/packages/sympkg.py +30 -27
- symai/extended/packages/symrun.py +46 -35
- symai/extended/repo_cloner.py +10 -9
- symai/extended/seo_query_optimizer.py +15 -12
- symai/extended/solver.py +104 -76
- symai/extended/summarizer.py +8 -7
- symai/extended/taypan_interpreter.py +10 -9
- symai/extended/vectordb.py +28 -15
- symai/formatter/formatter.py +39 -31
- symai/formatter/regex.py +46 -44
- symai/functional.py +184 -86
- symai/imports.py +85 -51
- symai/interfaces.py +1 -1
- symai/memory.py +33 -24
- symai/menu/screen.py +28 -19
- symai/misc/console.py +27 -27
- symai/misc/loader.py +4 -3
- symai/models/base.py +147 -76
- symai/models/errors.py +1 -1
- symai/ops/__init__.py +1 -1
- symai/ops/measures.py +17 -14
- symai/ops/primitives.py +933 -635
- symai/post_processors.py +28 -24
- symai/pre_processors.py +58 -52
- symai/processor.py +15 -9
- symai/prompts.py +714 -649
- symai/server/huggingface_server.py +115 -32
- symai/server/llama_cpp_server.py +14 -6
- symai/server/qdrant_server.py +206 -0
- symai/shell.py +98 -39
- symai/shellsv.py +307 -223
- symai/strategy.py +135 -81
- symai/symbol.py +276 -225
- symai/utils.py +62 -46
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.1.dist-info}/METADATA +19 -9
- symbolicai-1.1.1.dist-info/RECORD +169 -0
- symbolicai-1.0.0.dist-info/RECORD +0 -163
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.1.dist-info}/WHEEL +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.1.dist-info}/entry_points.txt +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.1.dist-info}/top_level.txt +0 -0
symai/__init__.py
CHANGED
|
@@ -23,19 +23,20 @@ logging.getLogger("httpx").setLevel(logging.ERROR)
|
|
|
23
23
|
logging.getLogger("httpcore").setLevel(logging.ERROR)
|
|
24
24
|
logging.getLogger("huggingface_hub").setLevel(logging.ERROR)
|
|
25
25
|
logging.getLogger("huggingface").setLevel(logging.ERROR)
|
|
26
|
-
logging.getLogger(
|
|
26
|
+
logging.getLogger("pydub").setLevel(logging.ERROR)
|
|
27
27
|
|
|
28
28
|
warnings.simplefilter("ignore")
|
|
29
29
|
|
|
30
30
|
# set the environment variable for the transformers library
|
|
31
|
-
os.environ[
|
|
31
|
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
32
32
|
|
|
33
33
|
# Create singleton instance
|
|
34
34
|
config_manager = settings.SymAIConfig()
|
|
35
35
|
|
|
36
|
-
SYMAI_VERSION = "1.
|
|
37
|
-
__version__
|
|
38
|
-
__root_dir__
|
|
36
|
+
SYMAI_VERSION = "1.1.1"
|
|
37
|
+
__version__ = SYMAI_VERSION
|
|
38
|
+
__root_dir__ = config_manager.config_dir
|
|
39
|
+
|
|
39
40
|
|
|
40
41
|
def _start_symai():
|
|
41
42
|
# Create config directories if they don't exist
|
|
@@ -44,97 +45,108 @@ def _start_symai():
|
|
|
44
45
|
|
|
45
46
|
# CREATE THE SHELL CONFIGURATION FILE IF IT DOES NOT EXIST YET
|
|
46
47
|
# *==============================================================================================================*
|
|
47
|
-
_symsh_config_path_ = config_manager.get_config_path(
|
|
48
|
+
_symsh_config_path_ = config_manager.get_config_path("symsh.config.json")
|
|
48
49
|
if not _symsh_config_path_.exists():
|
|
49
|
-
config_manager.save_config(
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
config_manager.save_config(
|
|
51
|
+
"symsh.config.json",
|
|
52
|
+
{
|
|
53
|
+
"colors": {
|
|
54
|
+
"completion-menu.completion.current": "bg:#323232 #212121",
|
|
55
|
+
"completion-menu.completion": "bg:#800080 #212121",
|
|
56
|
+
"scrollbar.background": "bg:#222222",
|
|
57
|
+
"scrollbar.button": "bg:#776677",
|
|
58
|
+
"history-completion": "bg:#212121 #f5f5f5",
|
|
59
|
+
"path-completion": "bg:#800080 #f5f5f5",
|
|
60
|
+
"file-completion": "bg:#9040b2 #f5f5f5",
|
|
61
|
+
"history-completion-selected": "bg:#efefef #b3d7ff",
|
|
62
|
+
"path-completion-selected": "bg:#efefef #b3d7ff",
|
|
63
|
+
"file-completion-selected": "bg:#efefef #b3d7ff",
|
|
64
|
+
},
|
|
65
|
+
"map-nt-cmd": True,
|
|
66
|
+
"show-splash-screen": True,
|
|
67
|
+
"plugin_prefix": None,
|
|
61
68
|
},
|
|
62
|
-
|
|
63
|
-
"show-splash-screen": True,
|
|
64
|
-
"plugin_prefix": None
|
|
65
|
-
})
|
|
69
|
+
)
|
|
66
70
|
|
|
67
71
|
# CREATE A SERVER CONFIGURATION FILE IF IT DOES NOT EXIST YET
|
|
68
72
|
# *==============================================================================================================*
|
|
69
|
-
_symserver_config_path_ = config_manager.get_config_path(
|
|
73
|
+
_symserver_config_path_ = config_manager.get_config_path("symserver.config.json")
|
|
70
74
|
if not _symserver_config_path_.exists():
|
|
71
|
-
config_manager.save_config(
|
|
75
|
+
config_manager.save_config("symserver.config.json", {})
|
|
72
76
|
|
|
73
77
|
# Get appropriate config path (debug mode handling is now in config_manager)
|
|
74
|
-
_symai_config_path_ = config_manager.get_config_path(
|
|
78
|
+
_symai_config_path_ = config_manager.get_config_path("symai.config.json")
|
|
75
79
|
|
|
76
80
|
if not _symai_config_path_.exists():
|
|
77
81
|
setup_wizard(_symai_config_path_)
|
|
78
|
-
UserMessage(
|
|
82
|
+
UserMessage(
|
|
83
|
+
f"No configuration file found for the environment. A new configuration file has been created at {_symai_config_path_}. Please configure your environment."
|
|
84
|
+
)
|
|
79
85
|
sys.exit(1)
|
|
80
86
|
|
|
81
87
|
# Load and manage configurations
|
|
82
|
-
symai_config = config_manager.load_config(
|
|
88
|
+
symai_config = config_manager.load_config("symai.config.json")
|
|
83
89
|
|
|
84
90
|
# MIGRATE THE ENVIRONMENT VARIABLES
|
|
85
91
|
# *==========================================================================================================*
|
|
86
|
-
if
|
|
92
|
+
if "COLLECTION_URI" not in symai_config:
|
|
87
93
|
updates = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
"COLLECTION_URI": "mongodb+srv://User:vt3epocXitd6WlQ6@extensityai.c1ajxxy.mongodb.net/?retryWrites=true&w=majority",
|
|
95
|
+
"COLLECTION_DB": "ExtensityAI",
|
|
96
|
+
"COLLECTION_STORAGE": "SymbolicAI",
|
|
97
|
+
"SUPPORT_COMMUNITY": False,
|
|
92
98
|
}
|
|
93
|
-
config_manager.migrate_config(
|
|
94
|
-
with ConsoleStyle(
|
|
95
|
-
msg =
|
|
99
|
+
config_manager.migrate_config("symai.config.json", updates)
|
|
100
|
+
with ConsoleStyle("info") as console:
|
|
101
|
+
msg = "Currently you are sharing your user experience with us by uploading the data to our research server, and thereby helping us improve future models and the overall SymbolicAI experience. We thank you very much for supporting the research community! If you wish to disable the data collection option go to your .symai config situated in your home directory or set the environment variable `SUPPORT_COMMUNITY` to `False`."
|
|
96
102
|
console.print(msg)
|
|
97
103
|
|
|
98
104
|
# POST-MIGRATION CHECKS
|
|
99
105
|
# *==============================================================================================================*
|
|
100
|
-
if
|
|
106
|
+
if "TEXT_TO_SPEECH_ENGINE_API_KEY" not in symai_config:
|
|
101
107
|
updates = {
|
|
102
|
-
|
|
108
|
+
"TEXT_TO_SPEECH_ENGINE_API_KEY": symai_config.get("NEUROSYMBOLIC_ENGINE_API_KEY", "")
|
|
103
109
|
}
|
|
104
|
-
config_manager.migrate_config(
|
|
110
|
+
config_manager.migrate_config("symai.config.json", updates)
|
|
105
111
|
|
|
106
112
|
# Load all configurations
|
|
107
|
-
symai_config = config_manager.load_config(
|
|
108
|
-
symsh_config = config_manager.load_config(
|
|
109
|
-
symserver_config = config_manager.load_config(
|
|
113
|
+
symai_config = config_manager.load_config("symai.config.json")
|
|
114
|
+
symsh_config = config_manager.load_config("symsh.config.json")
|
|
115
|
+
symserver_config = config_manager.load_config("symserver.config.json")
|
|
110
116
|
|
|
111
117
|
# MIGRATE THE SHELL SPLASH SCREEN CONFIGURATION
|
|
112
118
|
# *==============================================================================================================*
|
|
113
|
-
if
|
|
114
|
-
config_manager.migrate_config(
|
|
119
|
+
if "show-splash-screen" not in symsh_config:
|
|
120
|
+
config_manager.migrate_config("symsh.config.json", {"show-splash-screen": True})
|
|
115
121
|
|
|
116
122
|
# CHECK IF THE USER HAS A NEUROSYMBOLIC API KEY
|
|
117
123
|
# *==============================================================================================================*
|
|
118
124
|
if not (
|
|
119
|
-
symai_config[
|
|
120
|
-
symai_config[
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
symai_config["NEUROSYMBOLIC_ENGINE_MODEL"].lower().startswith("llama")
|
|
126
|
+
or symai_config["NEUROSYMBOLIC_ENGINE_MODEL"].lower().startswith("huggingface")
|
|
127
|
+
) and (
|
|
128
|
+
symai_config["NEUROSYMBOLIC_ENGINE_API_KEY"] is None
|
|
129
|
+
or len(symai_config["NEUROSYMBOLIC_ENGINE_API_KEY"]) == 0
|
|
130
|
+
):
|
|
131
|
+
# Try to fallback to the global (home) config if environment is not home
|
|
132
|
+
if config_manager.config_dir != config_manager._home_config_dir:
|
|
133
|
+
show_intro_menu()
|
|
134
|
+
UserMessage(
|
|
135
|
+
f"You didn't configure your environment ({config_manager.config_dir})! Falling back to the global ({config_manager._home_config_dir}) configuration if it exists."
|
|
136
|
+
)
|
|
137
|
+
# Force loading from home
|
|
138
|
+
symai_config = config_manager.load_config("symai.config.json", fallback_to_home=True)
|
|
139
|
+
symsh_config = config_manager.load_config("symsh.config.json", fallback_to_home=True)
|
|
140
|
+
symserver_config = config_manager.load_config(
|
|
141
|
+
"symserver.config.json", fallback_to_home=True
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# If still not valid, warn and exit
|
|
145
|
+
if not symai_config.get("NEUROSYMBOLIC_ENGINE_API_KEY"):
|
|
146
|
+
UserMessage(
|
|
147
|
+
"The mandatory neuro-symbolic engine is not initialized. Please set NEUROSYMBOLIC_ENGINE_MODEL and NEUROSYMBOLIC_ENGINE_API_KEY."
|
|
148
|
+
)
|
|
149
|
+
sys.exit(1)
|
|
138
150
|
|
|
139
151
|
settings.SYMAI_CONFIG = symai_config
|
|
140
152
|
settings.SYMSH_CONFIG = symsh_config
|
|
@@ -144,17 +156,58 @@ def _start_symai():
|
|
|
144
156
|
|
|
145
157
|
def run_server():
|
|
146
158
|
_symserver_config_ = {}
|
|
147
|
-
|
|
159
|
+
|
|
160
|
+
# Check for explicit Qdrant server request via command line
|
|
161
|
+
qdrant_requested = any("qdrant" in arg.lower() for arg in sys.argv[1:])
|
|
162
|
+
|
|
163
|
+
if (
|
|
164
|
+
qdrant_requested
|
|
165
|
+
or settings.SYMAI_CONFIG.get("INDEXING_ENGINE") == "qdrant"
|
|
166
|
+
or any(
|
|
167
|
+
"qdrant" in str(v).lower()
|
|
168
|
+
for v in [
|
|
169
|
+
settings.SYMAI_CONFIG.get("INDEXING_ENGINE_API_KEY", ""),
|
|
170
|
+
settings.SYMAI_CONFIG.get("INDEXING_ENGINE_URL", ""),
|
|
171
|
+
]
|
|
172
|
+
)
|
|
173
|
+
):
|
|
174
|
+
from .server.qdrant_server import qdrant_server # noqa
|
|
175
|
+
|
|
176
|
+
command, args = qdrant_server()
|
|
177
|
+
_symserver_config_.update(zip(args[::2], args[1::2], strict=False))
|
|
178
|
+
_symserver_config_["online"] = True
|
|
179
|
+
_symserver_config_["url"] = (
|
|
180
|
+
f"http://{_symserver_config_.get('--host', 'localhost')}:{_symserver_config_.get('--port', 6333)}"
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
config_manager.save_config("symserver.config.json", _symserver_config_)
|
|
184
|
+
config_manager.save_config(
|
|
185
|
+
"symserver.config.json", _symserver_config_, fallback_to_home=True
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
try:
|
|
189
|
+
subprocess.run(command, check=True)
|
|
190
|
+
except KeyboardInterrupt:
|
|
191
|
+
UserMessage("Server stopped!")
|
|
192
|
+
except Exception as e:
|
|
193
|
+
UserMessage(f"Error running server: {e}")
|
|
194
|
+
finally:
|
|
195
|
+
config_manager.save_config("symserver.config.json", {"online": False})
|
|
196
|
+
elif settings.SYMAI_CONFIG.get("NEUROSYMBOLIC_ENGINE_MODEL").startswith(
|
|
197
|
+
"llama"
|
|
198
|
+
) or settings.SYMAI_CONFIG.get("EMBEDDING_ENGINE_MODEL").startswith("llama"):
|
|
148
199
|
# Keep optional llama_cpp dependencies lazy.
|
|
149
|
-
from .server.llama_cpp_server import llama_cpp_server
|
|
200
|
+
from .server.llama_cpp_server import llama_cpp_server # noqa
|
|
150
201
|
|
|
151
202
|
command, args = llama_cpp_server()
|
|
152
203
|
_symserver_config_.update(zip(args[::2], args[1::2], strict=False))
|
|
153
|
-
_symserver_config_[
|
|
204
|
+
_symserver_config_["online"] = True
|
|
154
205
|
|
|
155
206
|
config_manager.save_config("symserver.config.json", _symserver_config_)
|
|
156
|
-
|
|
157
|
-
config_manager.save_config(
|
|
207
|
+
# @NOTE: Save in both places since you can start the server from anywhere and still not have a nesy engine configured
|
|
208
|
+
config_manager.save_config(
|
|
209
|
+
"symserver.config.json", _symserver_config_, fallback_to_home=True
|
|
210
|
+
)
|
|
158
211
|
|
|
159
212
|
try:
|
|
160
213
|
subprocess.run(command, check=True)
|
|
@@ -163,15 +216,15 @@ def run_server():
|
|
|
163
216
|
except Exception as e:
|
|
164
217
|
UserMessage(f"Error running server: {e}")
|
|
165
218
|
finally:
|
|
166
|
-
config_manager.save_config("symserver.config.json", {
|
|
219
|
+
config_manager.save_config("symserver.config.json", {"online": False})
|
|
167
220
|
|
|
168
221
|
elif settings.SYMAI_CONFIG.get("NEUROSYMBOLIC_ENGINE_MODEL").startswith("huggingface"):
|
|
169
222
|
# HuggingFace server stack is optional; import only when requested.
|
|
170
|
-
from .server.huggingface_server import huggingface_server
|
|
223
|
+
from .server.huggingface_server import huggingface_server # noqa
|
|
171
224
|
|
|
172
225
|
command, args = huggingface_server()
|
|
173
226
|
_symserver_config_.update(vars(args))
|
|
174
|
-
_symserver_config_[
|
|
227
|
+
_symserver_config_["online"] = True
|
|
175
228
|
|
|
176
229
|
config_manager.save_config("symserver.config.json", _symserver_config_)
|
|
177
230
|
|
|
@@ -182,11 +235,11 @@ def run_server():
|
|
|
182
235
|
except Exception as e:
|
|
183
236
|
UserMessage(f"Error running server: {e}")
|
|
184
237
|
finally:
|
|
185
|
-
config_manager.save_config("symserver.config.json", {
|
|
238
|
+
config_manager.save_config("symserver.config.json", {"online": False})
|
|
186
239
|
else:
|
|
187
240
|
msg = (
|
|
188
241
|
"You're trying to run a local server without a valid neuro-symbolic engine model. "
|
|
189
|
-
"Please set a valid model in your configuration file. Current available options are 'llamacpp' and '
|
|
242
|
+
"Please set a valid model in your configuration file. Current available options are 'llamacpp', 'huggingface' and 'qdrant'."
|
|
190
243
|
)
|
|
191
244
|
UserMessage(msg, raise_with=ValueError)
|
|
192
245
|
|
|
@@ -196,30 +249,33 @@ def format_config_content(config: dict) -> str:
|
|
|
196
249
|
"""Format config content for display, truncating API keys."""
|
|
197
250
|
formatted = {}
|
|
198
251
|
for k, v in config.items():
|
|
199
|
-
if isinstance(v, str) and (
|
|
252
|
+
if isinstance(v, str) and ("KEY" in k or "URI" in k) and v:
|
|
200
253
|
# Show first/last 4 chars of keys/URIs
|
|
201
254
|
formatted[k] = f"{v[:4]}...{v[-4:]}" if len(v) > 8 else v
|
|
202
255
|
else:
|
|
203
256
|
formatted[k] = v
|
|
204
257
|
return json.dumps(formatted, indent=2)
|
|
205
258
|
|
|
259
|
+
|
|
206
260
|
def display_config():
|
|
207
261
|
"""Display all configuration paths and their content."""
|
|
208
262
|
|
|
209
263
|
console = Console()
|
|
210
264
|
|
|
211
265
|
# Create header
|
|
212
|
-
console.print(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
266
|
+
console.print(
|
|
267
|
+
Panel.fit(
|
|
268
|
+
f"[bold cyan]SymbolicAI Configuration Inspector v{__version__}[/bold cyan]",
|
|
269
|
+
border_style="cyan",
|
|
270
|
+
)
|
|
271
|
+
)
|
|
216
272
|
|
|
217
273
|
# Create main tree
|
|
218
274
|
tree = Tree("[bold]Configuration Locations[/bold]")
|
|
219
275
|
|
|
220
276
|
# Debug config
|
|
221
277
|
debug_branch = tree.add("[yellow]Debug Mode Config (CWD)[/yellow]")
|
|
222
|
-
debug_config = config_manager._debug_dir /
|
|
278
|
+
debug_config = config_manager._debug_dir / "symai.config.json"
|
|
223
279
|
if debug_config.exists():
|
|
224
280
|
with debug_config.open() as f:
|
|
225
281
|
content = json.load(f)
|
|
@@ -230,9 +286,9 @@ def display_config():
|
|
|
230
286
|
# Environment config
|
|
231
287
|
env_branch = tree.add("[yellow]Environment Config[/yellow]")
|
|
232
288
|
env_configs = {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
289
|
+
"symai.config.json": "⚙️",
|
|
290
|
+
"symsh.config.json": "🖥️",
|
|
291
|
+
"symserver.config.json": "🌐",
|
|
236
292
|
}
|
|
237
293
|
|
|
238
294
|
for config_file, icon in env_configs.items():
|
|
@@ -251,7 +307,9 @@ def display_config():
|
|
|
251
307
|
if config_path.exists():
|
|
252
308
|
with config_path.open() as f:
|
|
253
309
|
content = json.load(f)
|
|
254
|
-
home_branch.add(
|
|
310
|
+
home_branch.add(
|
|
311
|
+
f"{icon} [green]{config_path}[/green]\n{format_config_content(content)}"
|
|
312
|
+
)
|
|
255
313
|
else:
|
|
256
314
|
home_branch.add(f"[dim]{icon} {config_file} (not found)[/dim]")
|
|
257
315
|
|
|
@@ -262,9 +320,9 @@ def display_config():
|
|
|
262
320
|
|
|
263
321
|
active_paths = {
|
|
264
322
|
"Primary Config Dir": config_manager.get_active_config_dir(),
|
|
265
|
-
"symai.config.json": config_manager.get_active_path(
|
|
266
|
-
"symsh.config.json": config_manager.get_active_path(
|
|
267
|
-
"symserver.config.json": config_manager.get_active_path(
|
|
323
|
+
"symai.config.json": config_manager.get_active_path("symai.config.json"),
|
|
324
|
+
"symsh.config.json": config_manager.get_active_path("symsh.config.json"),
|
|
325
|
+
"symserver.config.json": config_manager.get_active_path("symserver.config.json"),
|
|
268
326
|
}
|
|
269
327
|
|
|
270
328
|
for config_type, path in active_paths.items():
|
|
@@ -281,64 +339,70 @@ def display_config():
|
|
|
281
339
|
console.print("🖥️ symsh.config.json (Shell configuration)")
|
|
282
340
|
console.print("🌐 symserver.config.json (Server configuration)")
|
|
283
341
|
console.print("\n[dim]Note: API keys and URIs are truncated for security[/dim]")
|
|
342
|
+
|
|
343
|
+
|
|
284
344
|
# *==============================================================================================================*
|
|
285
345
|
|
|
286
346
|
|
|
287
347
|
def setup_wizard(_symai_config_path_):
|
|
288
348
|
show_intro_menu()
|
|
289
349
|
|
|
290
|
-
_nesy_engine_api_key
|
|
291
|
-
_nesy_engine_model
|
|
292
|
-
_symbolic_engine_api_key
|
|
293
|
-
_symbolic_engine_model
|
|
294
|
-
_embedding_engine_api_key
|
|
295
|
-
_embedding_model
|
|
296
|
-
_drawing_engine_api_key
|
|
297
|
-
_drawing_engine_model
|
|
298
|
-
_vision_engine_model
|
|
299
|
-
_search_engine_api_key
|
|
300
|
-
_search_engine_model
|
|
301
|
-
_ocr_engine_api_key
|
|
302
|
-
_speech_to_text_engine_model
|
|
303
|
-
_speech_to_text_api_key
|
|
304
|
-
_text_to_speech_engine_api_key
|
|
305
|
-
_text_to_speech_engine_model
|
|
306
|
-
_text_to_speech_engine_voice
|
|
307
|
-
_indexing_engine_api_key
|
|
308
|
-
_indexing_engine_environment
|
|
309
|
-
_caption_engine_environment
|
|
310
|
-
_support_comminity
|
|
311
|
-
|
|
312
|
-
config_manager.save_config(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
350
|
+
_nesy_engine_api_key = ""
|
|
351
|
+
_nesy_engine_model = ""
|
|
352
|
+
_symbolic_engine_api_key = ""
|
|
353
|
+
_symbolic_engine_model = ""
|
|
354
|
+
_embedding_engine_api_key = ""
|
|
355
|
+
_embedding_model = ""
|
|
356
|
+
_drawing_engine_api_key = ""
|
|
357
|
+
_drawing_engine_model = ""
|
|
358
|
+
_vision_engine_model = ""
|
|
359
|
+
_search_engine_api_key = ""
|
|
360
|
+
_search_engine_model = ""
|
|
361
|
+
_ocr_engine_api_key = ""
|
|
362
|
+
_speech_to_text_engine_model = ""
|
|
363
|
+
_speech_to_text_api_key = ""
|
|
364
|
+
_text_to_speech_engine_api_key = ""
|
|
365
|
+
_text_to_speech_engine_model = ""
|
|
366
|
+
_text_to_speech_engine_voice = ""
|
|
367
|
+
_indexing_engine_api_key = ""
|
|
368
|
+
_indexing_engine_environment = ""
|
|
369
|
+
_caption_engine_environment = ""
|
|
370
|
+
_support_comminity = False
|
|
371
|
+
|
|
372
|
+
config_manager.save_config(
|
|
373
|
+
_symai_config_path_,
|
|
374
|
+
{
|
|
375
|
+
"NEUROSYMBOLIC_ENGINE_API_KEY": _nesy_engine_api_key,
|
|
376
|
+
"NEUROSYMBOLIC_ENGINE_MODEL": _nesy_engine_model,
|
|
377
|
+
"SYMBOLIC_ENGINE_API_KEY": _symbolic_engine_api_key,
|
|
378
|
+
"SYMBOLIC_ENGINE": _symbolic_engine_model,
|
|
379
|
+
"EMBEDDING_ENGINE_API_KEY": _embedding_engine_api_key,
|
|
380
|
+
"EMBEDDING_ENGINE_MODEL": _embedding_model,
|
|
381
|
+
"DRAWING_ENGINE_API_KEY": _drawing_engine_api_key,
|
|
382
|
+
"DRAWING_ENGINE_MODEL": _drawing_engine_model,
|
|
383
|
+
"VISION_ENGINE_MODEL": _vision_engine_model,
|
|
384
|
+
"SEARCH_ENGINE_API_KEY": _search_engine_api_key,
|
|
385
|
+
"SEARCH_ENGINE_MODEL": _search_engine_model,
|
|
386
|
+
"OCR_ENGINE_API_KEY": _ocr_engine_api_key,
|
|
387
|
+
"SPEECH_TO_TEXT_ENGINE_MODEL": _speech_to_text_engine_model,
|
|
388
|
+
"SPEECH_TO_TEXT_API_KEY": _speech_to_text_api_key,
|
|
389
|
+
"TEXT_TO_SPEECH_ENGINE_API_KEY": _text_to_speech_engine_api_key,
|
|
390
|
+
"TEXT_TO_SPEECH_ENGINE_MODEL": _text_to_speech_engine_model,
|
|
391
|
+
"TEXT_TO_SPEECH_ENGINE_VOICE": _text_to_speech_engine_voice,
|
|
392
|
+
"INDEXING_ENGINE_API_KEY": _indexing_engine_api_key,
|
|
393
|
+
"INDEXING_ENGINE_ENVIRONMENT": _indexing_engine_environment,
|
|
394
|
+
"CAPTION_ENGINE_MODEL": _caption_engine_environment,
|
|
395
|
+
"COLLECTION_URI": "mongodb+srv://User:vt3epocXitd6WlQ6@extensityai.c1ajxxy.mongodb.net/?retryWrites=true&w=majority",
|
|
396
|
+
"COLLECTION_DB": "ExtensityAI",
|
|
397
|
+
"COLLECTION_STORAGE": "SymbolicAI",
|
|
398
|
+
"SUPPORT_COMMUNITY": _support_comminity,
|
|
399
|
+
},
|
|
400
|
+
)
|
|
401
|
+
|
|
338
402
|
|
|
339
403
|
_symai_config_, _symsh_config_, _symserver_config_ = _start_symai()
|
|
340
404
|
|
|
341
|
-
from .backend.base import Engine
|
|
405
|
+
from .backend.base import Engine # noqa
|
|
342
406
|
from .components import Function, PrimitiveDisabler # noqa
|
|
343
407
|
from .core import few_shot, zero_shot # noqa
|
|
344
408
|
from .extended import Conversation # noqa
|