symbolicai 1.0.0__py3-none-any.whl → 1.1.0__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 +28 -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/anthropic.py +48 -40
- 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 +556 -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.0.dist-info}/METADATA +19 -9
- symbolicai-1.1.0.dist-info/RECORD +168 -0
- symbolicai-1.0.0.dist-info/RECORD +0 -163
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.0.dist-info}/WHEEL +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.0.dist-info}/entry_points.txt +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.0.dist-info}/licenses/LICENSE +0 -0
- {symbolicai-1.0.0.dist-info → symbolicai-1.1.0.dist-info}/top_level.txt +0 -0
symai/shell.py
CHANGED
|
@@ -44,18 +44,22 @@ $> New-Item -ItemType Directory -Path <path> EOF
|
|
|
44
44
|
--------------
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
|
+
|
|
47
48
|
class ShellPreProcessor(PreProcessor):
|
|
48
49
|
def __call__(self, argument):
|
|
49
|
-
return f
|
|
50
|
+
return f"// {argument.prop.instance!s}\n$>"
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
class Shell(Expression):
|
|
53
54
|
def forward(self, **kwargs) -> str:
|
|
54
|
-
@few_shot(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
@few_shot(
|
|
56
|
+
prompt="Convert a user query to a shell command:\n",
|
|
57
|
+
examples=[],
|
|
58
|
+
pre_processors=[ShellPreProcessor()],
|
|
59
|
+
post_processors=[StripPostProcessor()],
|
|
60
|
+
stop=["EOF"],
|
|
61
|
+
**kwargs,
|
|
62
|
+
)
|
|
59
63
|
def _func(_) -> str:
|
|
60
64
|
return "Sorry, something went wrong. Please check if your backend is available and try again or report an issue to the devs. :("
|
|
61
65
|
|
|
@@ -68,17 +72,19 @@ class Shell(Expression):
|
|
|
68
72
|
|
|
69
73
|
def process_query(args) -> None:
|
|
70
74
|
if args.version:
|
|
71
|
-
with ConsoleStyle(
|
|
75
|
+
with ConsoleStyle("extensity") as console:
|
|
72
76
|
console.print(f"ExtensityAI: Symbolic Shell v{SYMAI_VERSION}")
|
|
73
77
|
return
|
|
74
78
|
|
|
75
79
|
query = args.query
|
|
76
80
|
if query is None or len(query) == 0:
|
|
77
|
-
with ConsoleStyle(
|
|
81
|
+
with ConsoleStyle("extensity") as console:
|
|
78
82
|
console.print(f"Starting ExtensityAI: Symbolic Shell v{SYMAI_VERSION}")
|
|
79
|
-
shellsv_run(
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
shellsv_run(
|
|
84
|
+
auto_query_on_error=args.auto,
|
|
85
|
+
conversation_style=args.style if args.style is not None and args.style != "" else None,
|
|
86
|
+
verbose=args.verbose,
|
|
87
|
+
)
|
|
82
88
|
return
|
|
83
89
|
|
|
84
90
|
shell = Shell(query)
|
|
@@ -95,44 +101,97 @@ def process_query(args) -> None:
|
|
|
95
101
|
if args.delete:
|
|
96
102
|
msg = msg - args.delete
|
|
97
103
|
if args.exec:
|
|
98
|
-
msg = str(msg).strip().replace(
|
|
104
|
+
msg = str(msg).strip().replace("EOF", "")
|
|
99
105
|
os.system(msg)
|
|
100
106
|
if args.more:
|
|
101
|
-
cmd = msg.extract(
|
|
102
|
-
cmd_help = cmd <<
|
|
103
|
-
expr = Try(expr=Lambda(lambda kwargs: os.system(str(kwargs[
|
|
107
|
+
cmd = msg.extract("the main command used")
|
|
108
|
+
cmd_help = cmd << "get manual for the command"
|
|
109
|
+
expr = Try(expr=Lambda(lambda kwargs: os.system(str(kwargs["args"][0]))))
|
|
104
110
|
with Loader(desc="Inference ...", end=""):
|
|
105
111
|
expr(cmd_help)
|
|
106
112
|
|
|
107
|
-
with ConsoleStyle(
|
|
108
|
-
msg = str(msg).strip().replace(
|
|
113
|
+
with ConsoleStyle("code") as console:
|
|
114
|
+
msg = str(msg).strip().replace("EOF", "")
|
|
109
115
|
console.print(msg)
|
|
110
116
|
|
|
111
117
|
|
|
112
118
|
def run() -> None:
|
|
113
119
|
# All the logic of argparse goes in this function
|
|
114
|
-
parser = argparse.ArgumentParser(description=
|
|
115
|
-
parser.add_argument(
|
|
116
|
-
parser.add_argument(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
parser.add_argument(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
parser.add_argument(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
120
|
+
parser = argparse.ArgumentParser(description="Welcome to the Symbolic<AI/> Shell support tool!")
|
|
121
|
+
parser.add_argument("query", type=str, nargs="?", help="The prompt for the shell query.")
|
|
122
|
+
parser.add_argument(
|
|
123
|
+
"--add",
|
|
124
|
+
dest="add",
|
|
125
|
+
default="",
|
|
126
|
+
required=False,
|
|
127
|
+
type=str,
|
|
128
|
+
help="integrate the added text to the query.",
|
|
129
|
+
)
|
|
130
|
+
parser.add_argument(
|
|
131
|
+
"--convert",
|
|
132
|
+
dest="convert",
|
|
133
|
+
default="",
|
|
134
|
+
required=False,
|
|
135
|
+
type=str,
|
|
136
|
+
help="convert a command to another shell. (e.g. --convert=windows or --convert=linux)",
|
|
137
|
+
)
|
|
138
|
+
parser.add_argument(
|
|
139
|
+
"--edit",
|
|
140
|
+
dest="edit",
|
|
141
|
+
default="",
|
|
142
|
+
required=False,
|
|
143
|
+
type=str,
|
|
144
|
+
help="edit the added text to the query.",
|
|
145
|
+
)
|
|
146
|
+
parser.add_argument(
|
|
147
|
+
"--del",
|
|
148
|
+
dest="delete",
|
|
149
|
+
default="",
|
|
150
|
+
required=False,
|
|
151
|
+
type=str,
|
|
152
|
+
help="remove the added text to the query.",
|
|
153
|
+
)
|
|
154
|
+
parser.add_argument(
|
|
155
|
+
"--more",
|
|
156
|
+
dest="more",
|
|
157
|
+
default=False,
|
|
158
|
+
required=False,
|
|
159
|
+
action=argparse.BooleanOptionalAction,
|
|
160
|
+
help="add more context to the generated command.",
|
|
161
|
+
)
|
|
162
|
+
parser.add_argument(
|
|
163
|
+
"--exec",
|
|
164
|
+
dest="exec",
|
|
165
|
+
default=False,
|
|
166
|
+
required=False,
|
|
167
|
+
action=argparse.BooleanOptionalAction,
|
|
168
|
+
help="execute command after creation (ATTENTION: Executing a generated command without verification may be risky!).",
|
|
169
|
+
)
|
|
170
|
+
parser.add_argument(
|
|
171
|
+
"--auto",
|
|
172
|
+
dest="auto",
|
|
173
|
+
default=False,
|
|
174
|
+
required=False,
|
|
175
|
+
action=argparse.BooleanOptionalAction,
|
|
176
|
+
help="query the the LLM if a command resulted unsuccessfully.",
|
|
177
|
+
)
|
|
178
|
+
parser.add_argument(
|
|
179
|
+
"--style",
|
|
180
|
+
dest="style",
|
|
181
|
+
default=None,
|
|
182
|
+
required=False,
|
|
183
|
+
type=str,
|
|
184
|
+
help="add speech style to the shell.",
|
|
185
|
+
)
|
|
186
|
+
parser.add_argument(
|
|
187
|
+
"--version",
|
|
188
|
+
dest="version",
|
|
189
|
+
default=False,
|
|
190
|
+
required=False,
|
|
191
|
+
action=argparse.BooleanOptionalAction,
|
|
192
|
+
help="show the version of the shell.",
|
|
193
|
+
)
|
|
194
|
+
parser.add_argument("--verbose", action="store_true", help="Print verbose errors.")
|
|
136
195
|
|
|
137
196
|
args = parser.parse_args()
|
|
138
197
|
process_query(args)
|