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/backend/mixin/anthropic.py
CHANGED
|
@@ -1,58 +1,66 @@
|
|
|
1
1
|
# https://docs.anthropic.com/en/docs/about-claude/models
|
|
2
2
|
SUPPORTED_CHAT_MODELS = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
"claude-3-5-sonnet-latest",
|
|
4
|
+
"claude-3-5-haiku-latest",
|
|
5
|
+
"claude-3-5-sonnet-20241022",
|
|
6
|
+
"claude-3-5-sonnet-20240620",
|
|
7
|
+
"claude-3-opus-latest",
|
|
8
|
+
"claude-3-opus-20240229",
|
|
9
|
+
"claude-3-sonnet-20240229",
|
|
10
|
+
"claude-3-haiku-20240307",
|
|
11
11
|
]
|
|
12
12
|
SUPPORTED_REASONING_MODELS = [
|
|
13
13
|
"claude-opus-4-1",
|
|
14
14
|
"claude-opus-4-0",
|
|
15
15
|
"claude-sonnet-4-0",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"claude-3-7-sonnet-latest",
|
|
17
|
+
"claude-haiku-4-5",
|
|
18
|
+
"claude-sonnet-4-5",
|
|
19
19
|
]
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
class AnthropicMixin:
|
|
22
23
|
def api_max_context_tokens(self):
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
if (
|
|
25
|
+
self.model == "claude-opus-4-1"
|
|
26
|
+
or self.model == "claude-opus-4-0"
|
|
27
|
+
or self.model == "claude-sonnet-4-0"
|
|
28
|
+
or self.model == "claude-3-7-sonnet-latest"
|
|
29
|
+
or self.model == "claude-haiku-4-5"
|
|
30
|
+
or self.model == "claude-sonnet-4-5"
|
|
31
|
+
or self.model == "claude-3-5-sonnet-latest"
|
|
32
|
+
or self.model == "claude-3-5-sonnet-20241022"
|
|
33
|
+
or self.model == "claude-3-5-sonnet-20240620"
|
|
34
|
+
or self.model == "claude-3-opus-latest"
|
|
35
|
+
or self.model == "claude-3-opus-20240229"
|
|
36
|
+
or self.model == "claude-3-sonnet-20240229"
|
|
37
|
+
or self.model == "claude-3-haiku-20240307"
|
|
38
|
+
):
|
|
39
|
+
return 200_000
|
|
37
40
|
return None
|
|
38
41
|
|
|
39
42
|
def api_max_response_tokens(self):
|
|
40
|
-
if
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
if (
|
|
44
|
+
self.model == "claude-sonnet-4-0"
|
|
45
|
+
or self.model == "claude-3-7-sonnet-latest"
|
|
46
|
+
or self.model == "claude-haiku-4-5"
|
|
47
|
+
or self.model == "claude-sonnet-4-5"
|
|
48
|
+
):
|
|
44
49
|
return 64_000
|
|
45
|
-
if self.model ==
|
|
46
|
-
self.model == 'claude-opus-4-0':
|
|
50
|
+
if self.model == "claude-opus-4-1" or self.model == "claude-opus-4-0":
|
|
47
51
|
return 32_000
|
|
48
|
-
if
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
if (
|
|
53
|
+
self.model == "claude-3-5-sonnet-latest"
|
|
54
|
+
or self.model == "claude-3-5-sonnet-20241022"
|
|
55
|
+
or self.model == "claude-3-5-haiku-latest"
|
|
56
|
+
):
|
|
51
57
|
return 8_192
|
|
52
|
-
if
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
if (
|
|
59
|
+
self.model == "claude-3-5-sonnet-20240620"
|
|
60
|
+
or self.model == "claude-3-opus-latest"
|
|
61
|
+
or self.model == "clade-3-opus-20240229"
|
|
62
|
+
or self.model == "claude-3-sonnet-20240229"
|
|
63
|
+
or self.model == "claude-3-haiku-20240307"
|
|
64
|
+
):
|
|
65
|
+
return 4_096
|
|
58
66
|
return None
|
symai/backend/mixin/deepseek.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# https://api-docs.deepseek.com/quick_start/pricing
|
|
2
2
|
SUPPORTED_CHAT_MODELS = []
|
|
3
|
-
SUPPORTED_REASONING_MODELS = [
|
|
4
|
-
|
|
5
|
-
]
|
|
3
|
+
SUPPORTED_REASONING_MODELS = ["deepseek-reasoner"]
|
|
4
|
+
|
|
6
5
|
|
|
7
6
|
class DeepSeekMixin:
|
|
8
7
|
def api_max_context_tokens(self):
|
|
9
|
-
if self.model ==
|
|
8
|
+
if self.model == "deepseek-reasoner":
|
|
10
9
|
return 64_000
|
|
11
10
|
return None
|
|
12
11
|
|
|
13
12
|
def api_max_response_tokens(self):
|
|
14
|
-
if self.model ==
|
|
13
|
+
if self.model == "deepseek-reasoner":
|
|
15
14
|
return 8_000
|
|
16
15
|
return None
|
symai/backend/mixin/google.py
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
SUPPORTED_CHAT_MODELS = []
|
|
3
3
|
SUPPORTED_REASONING_MODELS = [
|
|
4
4
|
# Check the latest snapshots; ie. *-06-05, etc
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
"gemini-2.5-pro",
|
|
6
|
+
"gemini-2.5-flash",
|
|
7
7
|
]
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
class GoogleMixin:
|
|
10
11
|
def api_max_context_tokens(self):
|
|
11
|
-
if self.model.startswith(
|
|
12
|
+
if self.model.startswith("gemini-2.5-"):
|
|
12
13
|
return 1_048_576
|
|
13
14
|
return None
|
|
14
15
|
|
|
15
16
|
def api_max_response_tokens(self):
|
|
16
|
-
if self.model ==
|
|
17
|
+
if self.model == "gemini-2.5-":
|
|
17
18
|
return 65_536
|
|
18
19
|
return None
|
symai/backend/mixin/groq.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
SUPPORTED_CHAT_MODELS = [
|
|
2
|
-
"groq:moonshotai/kimi-k2-instruct"
|
|
3
|
-
]
|
|
1
|
+
SUPPORTED_CHAT_MODELS = ["groq:moonshotai/kimi-k2-instruct"]
|
|
4
2
|
|
|
5
3
|
SUPPORTED_REASONING_MODELS = [
|
|
6
4
|
"groq:openai/gpt-oss-120b",
|
|
7
5
|
"groq:openai/gpt-oss-20b",
|
|
8
6
|
"groq:qwen/qwen3-32b",
|
|
9
|
-
"groq:deepseek-r1-distill-llama-70b"
|
|
7
|
+
"groq:deepseek-r1-distill-llama-70b",
|
|
10
8
|
]
|
symai/backend/mixin/openai.py
CHANGED
|
@@ -1,142 +1,164 @@
|
|
|
1
1
|
from ...utils import UserMessage
|
|
2
2
|
|
|
3
3
|
SUPPORTED_COMPLETION_MODELS = [
|
|
4
|
-
|
|
4
|
+
"davinci-002",
|
|
5
5
|
]
|
|
6
6
|
SUPPORTED_CHAT_MODELS = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
"gpt-3.5-turbo",
|
|
8
|
+
"gpt-3.5-turbo-16k",
|
|
9
|
+
"gpt-3.5-turbo-1106",
|
|
10
|
+
"gpt-3.5-turbo-0613",
|
|
11
|
+
"gpt-4",
|
|
12
|
+
"gpt-4-0613",
|
|
13
|
+
"gpt-4-1106-preview", # @NOTE: probabily obsolete; same price as 'gpt-4-turbo-2024-04-09' but no vision
|
|
14
|
+
"gpt-4-turbo",
|
|
15
|
+
"gpt-4-turbo-2024-04-09",
|
|
16
|
+
"gpt-4o",
|
|
17
|
+
"gpt-4o-2024-11-20",
|
|
18
|
+
"gpt-4o-mini",
|
|
19
|
+
"chatgpt-4o-latest",
|
|
20
|
+
"gpt-4.1",
|
|
21
|
+
"gpt-4.1-mini",
|
|
22
|
+
"gpt-4.1-nano",
|
|
23
|
+
"gpt-5-chat-latest",
|
|
24
|
+
"gpt-5.1-chat-latest",
|
|
24
25
|
]
|
|
25
26
|
SUPPORTED_REASONING_MODELS = [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
"o3-mini",
|
|
28
|
+
"o4-mini",
|
|
29
|
+
"o1",
|
|
30
|
+
"o3",
|
|
31
|
+
"gpt-5",
|
|
32
|
+
"gpt-5.1",
|
|
33
|
+
"gpt-5-mini",
|
|
34
|
+
"gpt-5-nano",
|
|
33
35
|
]
|
|
34
36
|
SUPPORTED_EMBEDDING_MODELS = [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
"text-embedding-ada-002",
|
|
38
|
+
"text-embedding-3-small",
|
|
39
|
+
"text-embedding-3-large",
|
|
38
40
|
]
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
class OpenAIMixin:
|
|
42
44
|
def api_max_context_tokens(self):
|
|
43
|
-
if
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
45
|
+
if (
|
|
46
|
+
self.model == "text-curie-001"
|
|
47
|
+
or self.model == "text-babbage-001"
|
|
48
|
+
or self.model == "text-ada-001"
|
|
49
|
+
or self.model == "davinci"
|
|
50
|
+
or self.model == "curie"
|
|
51
|
+
or self.model == "babbage"
|
|
52
|
+
or self.model == "ada"
|
|
53
|
+
):
|
|
54
|
+
return 2_049
|
|
55
|
+
if (
|
|
56
|
+
self.model == "gpt-3.5-turbo"
|
|
57
|
+
or self.model == "gpt-3.5-turbo-0613"
|
|
58
|
+
or self.model == "gpt-3.5-turbo-1106"
|
|
59
|
+
):
|
|
60
|
+
return 4_096
|
|
61
|
+
if (
|
|
62
|
+
self.model == "gpt-4"
|
|
63
|
+
or self.model == "gpt-4-0613"
|
|
64
|
+
or self.model == "text-embedding-ada-002"
|
|
65
|
+
or self.model == "text-embedding-3-small"
|
|
66
|
+
or self.model == "text-embedding-3-large"
|
|
67
|
+
):
|
|
68
|
+
return 8_192
|
|
69
|
+
if (
|
|
70
|
+
self.model == "gpt-3.5-turbo-16k"
|
|
71
|
+
or self.model == "gpt-3.5-turbo-16k-0613"
|
|
72
|
+
or self.model == "davinci-002"
|
|
73
|
+
):
|
|
74
|
+
return 16_384
|
|
75
|
+
if self.model == "gpt-4-32k" or self.model == "gpt-4-32k-0613":
|
|
76
|
+
return 32_768
|
|
77
|
+
if (
|
|
78
|
+
self.model == "gpt-4-1106-preview"
|
|
79
|
+
or self.model == "gpt-4-turbo-2024-04-09"
|
|
80
|
+
or self.model == "gpt-4-turbo"
|
|
81
|
+
or self.model == "gpt-4-1106"
|
|
82
|
+
or self.model == "gpt-4o"
|
|
83
|
+
or self.model == "gpt-4o-2024-11-20"
|
|
84
|
+
or self.model == "gpt-4o-mini"
|
|
85
|
+
or self.model == "chatgpt-4o-latest"
|
|
86
|
+
):
|
|
87
|
+
return 128_000
|
|
88
|
+
if (
|
|
89
|
+
self.model == "o1"
|
|
90
|
+
or self.model == "o3"
|
|
91
|
+
or self.model == "o3-mini"
|
|
92
|
+
or self.model == "o4-mini"
|
|
93
|
+
or self.model == "gpt-5-chat-latest"
|
|
94
|
+
or self.model == "gpt-5.1-chat-latest"
|
|
95
|
+
):
|
|
96
|
+
return 200_000
|
|
97
|
+
if (
|
|
98
|
+
self.model == "gpt-5"
|
|
99
|
+
or self.model == "gpt-5.1"
|
|
100
|
+
or self.model == "gpt-5-mini"
|
|
101
|
+
or self.model == "gpt-5-nano"
|
|
102
|
+
):
|
|
86
103
|
return 400_000
|
|
87
|
-
if self.model ==
|
|
88
|
-
self.model == 'gpt-4.1-mini' or \
|
|
89
|
-
self.model == 'gpt-4.1-nano':
|
|
104
|
+
if self.model == "gpt-4.1" or self.model == "gpt-4.1-mini" or self.model == "gpt-4.1-nano":
|
|
90
105
|
return 1_047_576
|
|
91
|
-
msg = f
|
|
106
|
+
msg = f"Unsupported model: {self.model}"
|
|
92
107
|
UserMessage(msg)
|
|
93
108
|
raise ValueError(msg)
|
|
94
109
|
|
|
95
110
|
def api_max_response_tokens(self):
|
|
96
|
-
if self.model ==
|
|
111
|
+
if self.model == "davinci-002":
|
|
97
112
|
return 2_048
|
|
98
|
-
if
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
if (
|
|
114
|
+
self.model == "gpt-4-turbo"
|
|
115
|
+
or self.model == "gpt-4-turbo-2024-04-09"
|
|
116
|
+
or self.model == "gpt-4-1106-preview"
|
|
117
|
+
or self.model == "gpt-3.5-turbo-1106"
|
|
118
|
+
or self.model == "gpt-3.5-turbo-0613"
|
|
119
|
+
or self.model == "gpt-3.5-turbo"
|
|
120
|
+
):
|
|
121
|
+
return 4_096
|
|
122
|
+
if self.model == "gpt-4-0613" or self.model == "gpt-4":
|
|
123
|
+
return 8_192
|
|
124
|
+
if (
|
|
125
|
+
self.model == "gpt-3.5-turbo-16k-0613"
|
|
126
|
+
or self.model == "gpt-3.5-turbo-16k"
|
|
127
|
+
or self.model == "gpt-4o-mini"
|
|
128
|
+
or self.model == "gpt-4o"
|
|
129
|
+
or self.model == "gpt-4o-2024-11-20"
|
|
130
|
+
or self.model == "chatgpt-4o-latest"
|
|
131
|
+
or self.model == "gpt-5-chat-latest"
|
|
132
|
+
or self.model == "gpt-5.1-chat-latest"
|
|
133
|
+
):
|
|
134
|
+
return 16_384
|
|
135
|
+
if self.model == "gpt-4.1" or self.model == "gpt-4.1-mini" or self.model == "gpt-4.1-nano":
|
|
118
136
|
return 32_768
|
|
119
|
-
if
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
if (
|
|
138
|
+
self.model == "o1"
|
|
139
|
+
or self.model == "o3"
|
|
140
|
+
or self.model == "o3-mini"
|
|
141
|
+
or self.model == "o4-mini"
|
|
142
|
+
):
|
|
143
|
+
return 100_000
|
|
144
|
+
if (
|
|
145
|
+
self.model == "gpt-5"
|
|
146
|
+
or self.model == "gpt-5.1"
|
|
147
|
+
or self.model == "gpt-5-mini"
|
|
148
|
+
or self.model == "gpt-5-nano"
|
|
149
|
+
):
|
|
128
150
|
return 128_000
|
|
129
|
-
msg = f
|
|
151
|
+
msg = f"Unsupported model: {self.model}"
|
|
130
152
|
UserMessage(msg)
|
|
131
153
|
raise ValueError(msg)
|
|
132
154
|
|
|
133
155
|
def api_embedding_dims(self):
|
|
134
|
-
if self.model ==
|
|
156
|
+
if self.model == "text-embedding-ada-002":
|
|
135
157
|
return 1_536
|
|
136
|
-
if self.model ==
|
|
158
|
+
if self.model == "text-embedding-3-small":
|
|
137
159
|
return 1_536
|
|
138
|
-
if self.model ==
|
|
160
|
+
if self.model == "text-embedding-3-large":
|
|
139
161
|
return 3_072
|
|
140
|
-
msg = f
|
|
162
|
+
msg = f"Unsupported model: {self.model}"
|
|
141
163
|
UserMessage(msg)
|
|
142
164
|
raise ValueError(msg)
|
symai/backend/settings.py
CHANGED
|
@@ -14,8 +14,8 @@ class SymAIConfig:
|
|
|
14
14
|
def __init__(self):
|
|
15
15
|
"""Initialize configuration paths based on current Python environment."""
|
|
16
16
|
self._env_path = Path(sys.prefix)
|
|
17
|
-
self._env_config_dir = self._env_path /
|
|
18
|
-
self._home_config_dir = Path.home() /
|
|
17
|
+
self._env_config_dir = self._env_path / ".symai"
|
|
18
|
+
self._home_config_dir = Path.home() / ".symai"
|
|
19
19
|
self._debug_dir = Path.cwd() # Current working directory for debug mode
|
|
20
20
|
self._active_paths: dict[str, Path] = {}
|
|
21
21
|
|
|
@@ -31,7 +31,8 @@ class SymAIConfig:
|
|
|
31
31
|
target_path = Path(key)
|
|
32
32
|
target_name = target_path.name or key
|
|
33
33
|
stale_keys: list[Path] = [
|
|
34
|
-
existing_key
|
|
34
|
+
existing_key
|
|
35
|
+
for existing_key in self._active_paths
|
|
35
36
|
if isinstance(existing_key, Path)
|
|
36
37
|
and (existing_key.name == target_name or str(existing_key) == key)
|
|
37
38
|
]
|
|
@@ -42,8 +43,8 @@ class SymAIConfig:
|
|
|
42
43
|
def config_dir(self) -> Path:
|
|
43
44
|
"""Returns the active configuration directory based on priority system."""
|
|
44
45
|
# Debug mode takes precedence
|
|
45
|
-
if (self._debug_dir /
|
|
46
|
-
return self._debug_dir /
|
|
46
|
+
if (self._debug_dir / "symai.config.json").exists():
|
|
47
|
+
return self._debug_dir / ".symai"
|
|
47
48
|
# Then environment config
|
|
48
49
|
if self._env_config_dir.exists():
|
|
49
50
|
return self._env_config_dir
|
|
@@ -60,11 +61,11 @@ class SymAIConfig:
|
|
|
60
61
|
# Only use the basename for managed directories
|
|
61
62
|
normalized_filename = Path(normalized_filename).name
|
|
62
63
|
debug_config = self._debug_dir / normalized_filename
|
|
63
|
-
env_config
|
|
64
|
-
home_config
|
|
64
|
+
env_config = self._env_config_dir / normalized_filename
|
|
65
|
+
home_config = self._home_config_dir / normalized_filename
|
|
65
66
|
|
|
66
67
|
# Check debug first (only valid for symai.config.json)
|
|
67
|
-
if normalized_filename ==
|
|
68
|
+
if normalized_filename == "symai.config.json" and debug_config.exists():
|
|
68
69
|
return debug_config
|
|
69
70
|
|
|
70
71
|
# If forced to fallback, return home config if it exists, otherwise environment
|
|
@@ -88,7 +89,7 @@ class SymAIConfig:
|
|
|
88
89
|
self._remove_legacy_path_keys(key)
|
|
89
90
|
self._active_paths.pop(key, None)
|
|
90
91
|
return {}
|
|
91
|
-
with config_path.open(encoding=
|
|
92
|
+
with config_path.open(encoding="utf-8") as f:
|
|
92
93
|
config = json.load(f)
|
|
93
94
|
self._remove_legacy_path_keys(key)
|
|
94
95
|
self._active_paths[key] = config_path
|
|
@@ -99,7 +100,7 @@ class SymAIConfig:
|
|
|
99
100
|
config_path = self.get_config_path(filename, fallback_to_home=fallback_to_home)
|
|
100
101
|
key = self._canonical_key(filename)
|
|
101
102
|
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
102
|
-
with config_path.open(
|
|
103
|
+
with config_path.open("w", encoding="utf-8") as f:
|
|
103
104
|
json.dump(data, f, indent=4)
|
|
104
105
|
self._remove_legacy_path_keys(key)
|
|
105
106
|
self._active_paths[key] = config_path
|
|
@@ -117,9 +118,7 @@ class SymAIConfig:
|
|
|
117
118
|
if cached is not None:
|
|
118
119
|
return cached
|
|
119
120
|
for legacy_key, cached_path in list(self._active_paths.items()):
|
|
120
|
-
if isinstance(legacy_key, Path) and (
|
|
121
|
-
legacy_key.name == key or str(legacy_key) == key
|
|
122
|
-
):
|
|
121
|
+
if isinstance(legacy_key, Path) and (legacy_key.name == key or str(legacy_key) == key):
|
|
123
122
|
self._active_paths.pop(legacy_key, None)
|
|
124
123
|
self._active_paths[key] = cached_path
|
|
125
124
|
return cached_path
|
|
@@ -127,7 +126,7 @@ class SymAIConfig:
|
|
|
127
126
|
|
|
128
127
|
def get_active_config_dir(self) -> Path:
|
|
129
128
|
"""Returns the directory backing the active symai configuration."""
|
|
130
|
-
symai_key = self._canonical_key(
|
|
129
|
+
symai_key = self._canonical_key("symai.config.json")
|
|
131
130
|
cached = self._active_paths.get(symai_key)
|
|
132
131
|
if cached is not None:
|
|
133
132
|
return cached.parent
|
|
@@ -140,6 +139,7 @@ class SymAIConfig:
|
|
|
140
139
|
return cached_path.parent
|
|
141
140
|
return self.config_dir
|
|
142
141
|
|
|
142
|
+
|
|
143
143
|
SYMAI_CONFIG = {}
|
|
144
144
|
SYMSH_CONFIG = {}
|
|
145
145
|
SYMSERVER_CONFIG = {}
|