zrb 1.8.10__py3-none-any.whl → 1.21.29__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.
Potentially problematic release.
This version of zrb might be problematic. Click here for more details.
- zrb/__init__.py +126 -113
- zrb/__main__.py +1 -1
- zrb/attr/type.py +10 -7
- zrb/builtin/__init__.py +2 -50
- zrb/builtin/git.py +12 -1
- zrb/builtin/group.py +31 -15
- zrb/builtin/http.py +7 -8
- zrb/builtin/llm/attachment.py +40 -0
- zrb/builtin/llm/chat_completion.py +274 -0
- zrb/builtin/llm/chat_session.py +152 -85
- zrb/builtin/llm/chat_session_cmd.py +288 -0
- zrb/builtin/llm/chat_trigger.py +79 -0
- zrb/builtin/llm/history.py +7 -9
- zrb/builtin/llm/llm_ask.py +221 -98
- zrb/builtin/llm/tool/api.py +74 -52
- zrb/builtin/llm/tool/cli.py +46 -17
- zrb/builtin/llm/tool/code.py +71 -90
- zrb/builtin/llm/tool/file.py +301 -241
- zrb/builtin/llm/tool/note.py +84 -0
- zrb/builtin/llm/tool/rag.py +38 -8
- zrb/builtin/llm/tool/sub_agent.py +67 -50
- zrb/builtin/llm/tool/web.py +146 -122
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
- zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
- zrb/builtin/searxng/config/settings.yml +5671 -0
- zrb/builtin/searxng/start.py +21 -0
- zrb/builtin/setup/latex/ubuntu.py +1 -0
- zrb/builtin/setup/ubuntu.py +1 -1
- zrb/builtin/shell/autocomplete/bash.py +4 -3
- zrb/builtin/shell/autocomplete/zsh.py +4 -3
- zrb/builtin/todo.py +13 -2
- zrb/config/config.py +614 -0
- zrb/config/default_prompt/file_extractor_system_prompt.md +112 -0
- zrb/config/default_prompt/interactive_system_prompt.md +29 -0
- zrb/config/default_prompt/persona.md +1 -0
- zrb/config/default_prompt/repo_extractor_system_prompt.md +112 -0
- zrb/config/default_prompt/repo_summarizer_system_prompt.md +29 -0
- zrb/config/default_prompt/summarization_prompt.md +57 -0
- zrb/config/default_prompt/system_prompt.md +38 -0
- zrb/config/llm_config.py +339 -0
- zrb/config/llm_context/config.py +166 -0
- zrb/config/llm_context/config_parser.py +40 -0
- zrb/config/llm_context/workflow.py +81 -0
- zrb/config/llm_rate_limitter.py +190 -0
- zrb/{runner → config}/web_auth_config.py +17 -22
- zrb/context/any_shared_context.py +17 -1
- zrb/context/context.py +16 -2
- zrb/context/shared_context.py +18 -8
- zrb/group/any_group.py +12 -5
- zrb/group/group.py +67 -3
- zrb/input/any_input.py +5 -1
- zrb/input/base_input.py +18 -6
- zrb/input/option_input.py +13 -1
- zrb/input/text_input.py +8 -25
- zrb/runner/cli.py +25 -23
- zrb/runner/common_util.py +24 -19
- zrb/runner/web_app.py +3 -3
- zrb/runner/web_route/docs_route.py +1 -1
- zrb/runner/web_route/error_page/serve_default_404.py +1 -1
- zrb/runner/web_route/error_page/show_error_page.py +1 -1
- zrb/runner/web_route/home_page/home_page_route.py +2 -2
- zrb/runner/web_route/login_api_route.py +1 -1
- zrb/runner/web_route/login_page/login_page_route.py +2 -2
- zrb/runner/web_route/logout_api_route.py +1 -1
- zrb/runner/web_route/logout_page/logout_page_route.py +2 -2
- zrb/runner/web_route/node_page/group/show_group_page.py +1 -1
- zrb/runner/web_route/node_page/node_page_route.py +1 -1
- zrb/runner/web_route/node_page/task/show_task_page.py +1 -1
- zrb/runner/web_route/refresh_token_api_route.py +1 -1
- zrb/runner/web_route/static/static_route.py +1 -1
- zrb/runner/web_route/task_input_api_route.py +6 -6
- zrb/runner/web_route/task_session_api_route.py +20 -12
- zrb/runner/web_util/cookie.py +1 -1
- zrb/runner/web_util/token.py +1 -1
- zrb/runner/web_util/user.py +8 -4
- zrb/session/any_session.py +24 -17
- zrb/session/session.py +50 -25
- zrb/session_state_logger/any_session_state_logger.py +9 -4
- zrb/session_state_logger/file_session_state_logger.py +16 -6
- zrb/session_state_logger/session_state_logger_factory.py +1 -1
- zrb/task/any_task.py +30 -9
- zrb/task/base/context.py +17 -9
- zrb/task/base/execution.py +15 -8
- zrb/task/base/lifecycle.py +8 -4
- zrb/task/base/monitoring.py +12 -7
- zrb/task/base_task.py +69 -5
- zrb/task/base_trigger.py +12 -5
- zrb/task/cmd_task.py +1 -1
- zrb/task/llm/agent.py +154 -161
- zrb/task/llm/agent_runner.py +152 -0
- zrb/task/llm/config.py +47 -18
- zrb/task/llm/conversation_history.py +209 -0
- zrb/task/llm/conversation_history_model.py +67 -0
- zrb/task/llm/default_workflow/coding/workflow.md +41 -0
- zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
- zrb/task/llm/default_workflow/git/workflow.md +118 -0
- zrb/task/llm/default_workflow/golang/workflow.md +128 -0
- zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
- zrb/task/llm/default_workflow/java/workflow.md +146 -0
- zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
- zrb/task/llm/default_workflow/python/workflow.md +160 -0
- zrb/task/llm/default_workflow/researching/workflow.md +153 -0
- zrb/task/llm/default_workflow/rust/workflow.md +162 -0
- zrb/task/llm/default_workflow/shell/workflow.md +299 -0
- zrb/task/llm/error.py +24 -10
- zrb/task/llm/file_replacement.py +206 -0
- zrb/task/llm/file_tool_model.py +57 -0
- zrb/task/llm/history_processor.py +206 -0
- zrb/task/llm/history_summarization.py +11 -166
- zrb/task/llm/print_node.py +193 -69
- zrb/task/llm/prompt.py +242 -45
- zrb/task/llm/subagent_conversation_history.py +41 -0
- zrb/task/llm/tool_wrapper.py +260 -57
- zrb/task/llm/workflow.py +76 -0
- zrb/task/llm_task.py +182 -171
- zrb/task/make_task.py +2 -3
- zrb/task/rsync_task.py +26 -11
- zrb/task/scheduler.py +4 -4
- zrb/util/attr.py +54 -39
- zrb/util/callable.py +23 -0
- zrb/util/cli/markdown.py +12 -0
- zrb/util/cli/text.py +30 -0
- zrb/util/file.py +29 -11
- zrb/util/git.py +8 -11
- zrb/util/git_diff_model.py +10 -0
- zrb/util/git_subtree.py +9 -14
- zrb/util/git_subtree_model.py +32 -0
- zrb/util/init_path.py +1 -1
- zrb/util/markdown.py +62 -0
- zrb/util/string/conversion.py +2 -2
- zrb/util/todo.py +17 -50
- zrb/util/todo_model.py +46 -0
- zrb/util/truncate.py +23 -0
- zrb/util/yaml.py +204 -0
- zrb/xcom/xcom.py +10 -0
- zrb-1.21.29.dist-info/METADATA +270 -0
- {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/RECORD +140 -98
- {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/WHEEL +1 -1
- zrb/config.py +0 -335
- zrb/llm_config.py +0 -411
- zrb/llm_rate_limitter.py +0 -125
- zrb/task/llm/context.py +0 -102
- zrb/task/llm/context_enrichment.py +0 -199
- zrb/task/llm/history.py +0 -211
- zrb-1.8.10.dist-info/METADATA +0 -264
- {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/entry_points.txt +0 -0
zrb/config.py
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import importlib.metadata as metadata
|
|
2
|
-
import logging
|
|
3
|
-
import os
|
|
4
|
-
import platform
|
|
5
|
-
|
|
6
|
-
from zrb.util.string.conversion import to_boolean
|
|
7
|
-
from zrb.util.string.format import fstring_format
|
|
8
|
-
|
|
9
|
-
_DEFAULT_BANNER = """
|
|
10
|
-
bb
|
|
11
|
-
zzzzz rr rr bb
|
|
12
|
-
zz rrr r bbbbbb
|
|
13
|
-
zz rr bb bb
|
|
14
|
-
zzzzz rr bbbbbb {VERSION} Janggala
|
|
15
|
-
_ _ . . . _ . _ . . .
|
|
16
|
-
Your Automation Powerhouse
|
|
17
|
-
☕ Donate at: https://stalchmst.com
|
|
18
|
-
🐙 Submit issues/PR at: https://github.com/state-alchemists/zrb
|
|
19
|
-
🐤 Follow us at: https://twitter.com/zarubastalchmst
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class Config:
|
|
24
|
-
@property
|
|
25
|
-
def LOGGER(self) -> logging.Logger:
|
|
26
|
-
return logging.getLogger()
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
def DEFAULT_SHELL(self) -> str:
|
|
30
|
-
return os.getenv("ZRB_SHELL", self._get_current_shell())
|
|
31
|
-
|
|
32
|
-
def _get_current_shell(self) -> str:
|
|
33
|
-
if platform.system() == "Windows":
|
|
34
|
-
return "PowerShell"
|
|
35
|
-
current_shell = os.getenv("SHELL", "")
|
|
36
|
-
if current_shell.endswith("zsh"):
|
|
37
|
-
return "zsh"
|
|
38
|
-
return "bash"
|
|
39
|
-
|
|
40
|
-
@property
|
|
41
|
-
def DEFAULT_EDITOR(self) -> str:
|
|
42
|
-
return os.getenv("ZRB_EDITOR", "nano")
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def INIT_MODULES(self) -> list[str]:
|
|
46
|
-
init_modules_str = os.getenv("ZRB_INIT_MODULES", "")
|
|
47
|
-
if init_modules_str != "":
|
|
48
|
-
return [
|
|
49
|
-
module.strip()
|
|
50
|
-
for module in init_modules_str.split(":")
|
|
51
|
-
if module.strip() != ""
|
|
52
|
-
]
|
|
53
|
-
return []
|
|
54
|
-
|
|
55
|
-
@property
|
|
56
|
-
def ROOT_GROUP_NAME(self) -> str:
|
|
57
|
-
return os.getenv("ZRB_ROOT_GROUP_NAME", "zrb")
|
|
58
|
-
|
|
59
|
-
@property
|
|
60
|
-
def ROOT_GROUP_DESCRIPTION(self) -> str:
|
|
61
|
-
return os.getenv("ZRB_ROOT_GROUP_DESCRIPTION", "Your Automation Powerhouse")
|
|
62
|
-
|
|
63
|
-
@property
|
|
64
|
-
def INIT_SCRIPTS(self) -> list[str]:
|
|
65
|
-
init_scripts_str = os.getenv("ZRB_INIT_SCRIPTS", "")
|
|
66
|
-
if init_scripts_str != "":
|
|
67
|
-
return [
|
|
68
|
-
script.strip()
|
|
69
|
-
for script in init_scripts_str.split(":")
|
|
70
|
-
if script.strip() != ""
|
|
71
|
-
]
|
|
72
|
-
return []
|
|
73
|
-
|
|
74
|
-
@property
|
|
75
|
-
def INIT_FILE_NAME(self) -> str:
|
|
76
|
-
return os.getenv("ZRB_INIT_FILE_NAME", "zrb_init.py")
|
|
77
|
-
|
|
78
|
-
@property
|
|
79
|
-
def LOGGING_LEVEL(self) -> int:
|
|
80
|
-
return self._get_log_level(os.getenv("ZRB_LOGGING_LEVEL", "WARNING"))
|
|
81
|
-
|
|
82
|
-
def _get_log_level(self, level: str) -> int:
|
|
83
|
-
level = level.upper()
|
|
84
|
-
log_levels = {
|
|
85
|
-
"CRITICAL": logging.CRITICAL, # 50
|
|
86
|
-
"ERROR": logging.ERROR, # 40
|
|
87
|
-
"WARN": logging.WARNING, # 30
|
|
88
|
-
"WARNING": logging.WARNING, # 30
|
|
89
|
-
"INFO": logging.INFO, # 20
|
|
90
|
-
"DEBUG": logging.DEBUG, # 10
|
|
91
|
-
"NOTSET": logging.NOTSET, # 0
|
|
92
|
-
}
|
|
93
|
-
if level in log_levels:
|
|
94
|
-
return log_levels[level]
|
|
95
|
-
return logging.WARNING
|
|
96
|
-
|
|
97
|
-
@property
|
|
98
|
-
def LOAD_BUILTIN(self) -> bool:
|
|
99
|
-
return to_boolean(os.getenv("ZRB_LOAD_BUILTIN", "1"))
|
|
100
|
-
|
|
101
|
-
@property
|
|
102
|
-
def WARN_UNRECOMMENDED_COMMAND(self) -> bool:
|
|
103
|
-
return to_boolean(os.getenv("ZRB_WARN_UNRECOMMENDED_COMMAND", "1"))
|
|
104
|
-
|
|
105
|
-
@property
|
|
106
|
-
def SESSION_LOG_DIR(self) -> str:
|
|
107
|
-
return os.getenv(
|
|
108
|
-
"ZRB_SESSION_LOG_DIR", os.path.expanduser(os.path.join("~", ".zrb-session"))
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
@property
|
|
112
|
-
def TODO_DIR(self) -> str:
|
|
113
|
-
return os.getenv("ZRB_TODO_DIR", os.path.expanduser(os.path.join("~", "todo")))
|
|
114
|
-
|
|
115
|
-
@property
|
|
116
|
-
def TODO_VISUAL_FILTER(self) -> str:
|
|
117
|
-
return os.getenv("ZRB_TODO_FILTER", "")
|
|
118
|
-
|
|
119
|
-
@property
|
|
120
|
-
def TODO_RETENTION(self) -> str:
|
|
121
|
-
return os.getenv("ZRB_TODO_RETENTION", "2w")
|
|
122
|
-
|
|
123
|
-
@property
|
|
124
|
-
def VERSION(self) -> str:
|
|
125
|
-
custom_version = os.getenv("_ZRB_CUSTOM_VERSION", "")
|
|
126
|
-
if custom_version != "":
|
|
127
|
-
return custom_version
|
|
128
|
-
return metadata.version("zrb")
|
|
129
|
-
|
|
130
|
-
@property
|
|
131
|
-
def WEB_CSS_PATH(self) -> list[str]:
|
|
132
|
-
web_css_path_str = os.getenv("ZRB_WEB_CSS_PATH", "")
|
|
133
|
-
if web_css_path_str != "":
|
|
134
|
-
return [
|
|
135
|
-
path.strip()
|
|
136
|
-
for path in web_css_path_str.split(":")
|
|
137
|
-
if path.strip() != ""
|
|
138
|
-
]
|
|
139
|
-
return []
|
|
140
|
-
|
|
141
|
-
@property
|
|
142
|
-
def WEB_JS_PATH(self) -> list[str]:
|
|
143
|
-
web_js_path_str = os.getenv("ZRB_WEB_JS_PATH", "")
|
|
144
|
-
if web_js_path_str != "":
|
|
145
|
-
return [
|
|
146
|
-
path.strip()
|
|
147
|
-
for path in web_js_path_str.split(":")
|
|
148
|
-
if path.strip() != ""
|
|
149
|
-
]
|
|
150
|
-
return []
|
|
151
|
-
|
|
152
|
-
@property
|
|
153
|
-
def WEB_FAVICON_PATH(self) -> str:
|
|
154
|
-
return os.getenv("ZRB_WEB_FAVICON_PATH", "/static/favicon-32x32.png")
|
|
155
|
-
|
|
156
|
-
@property
|
|
157
|
-
def WEB_COLOR(self) -> str:
|
|
158
|
-
return os.getenv("ZRB_WEB_COLOR", "")
|
|
159
|
-
|
|
160
|
-
@property
|
|
161
|
-
def WEB_HTTP_PORT(self) -> int:
|
|
162
|
-
return int(os.getenv("ZRB_WEB_HTTP_PORT", "21213"))
|
|
163
|
-
|
|
164
|
-
@property
|
|
165
|
-
def WEB_GUEST_USERNAME(self) -> str:
|
|
166
|
-
return os.getenv("ZRB_WEB_GUEST_USERNAME", "user")
|
|
167
|
-
|
|
168
|
-
@property
|
|
169
|
-
def WEB_SUPER_ADMIN_USERNAME(self) -> str:
|
|
170
|
-
return os.getenv("ZRB_WEB_SUPERADMIN_USERNAME", "admin")
|
|
171
|
-
|
|
172
|
-
@property
|
|
173
|
-
def WEB_SUPER_ADMIN_PASSWORD(self) -> str:
|
|
174
|
-
return os.getenv("ZRB_WEB_SUPERADMIN_PASSWORD", "admin")
|
|
175
|
-
|
|
176
|
-
@property
|
|
177
|
-
def WEB_ACCESS_TOKEN_COOKIE_NAME(self) -> str:
|
|
178
|
-
return os.getenv("ZRB_WEB_ACCESS_TOKEN_COOKIE_NAME", "access_token")
|
|
179
|
-
|
|
180
|
-
@property
|
|
181
|
-
def WEB_REFRESH_TOKEN_COOKIE_NAME(self) -> str:
|
|
182
|
-
return os.getenv("ZRB_WEB_REFRESH_TOKEN_COOKIE_NAME", "refresh_token")
|
|
183
|
-
|
|
184
|
-
@property
|
|
185
|
-
def WEB_SECRET_KEY(self) -> str:
|
|
186
|
-
return os.getenv("ZRB_WEB_SECRET", "zrb")
|
|
187
|
-
|
|
188
|
-
@property
|
|
189
|
-
def WEB_ENABLE_AUTH(self) -> bool:
|
|
190
|
-
return to_boolean(os.getenv("ZRB_WEB_ENABLE_AUTH", "0"))
|
|
191
|
-
|
|
192
|
-
@property
|
|
193
|
-
def WEB_AUTH_ACCESS_TOKEN_EXPIRE_MINUTES(self) -> int:
|
|
194
|
-
return int(os.getenv("ZRB_WEB_ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
|
|
195
|
-
|
|
196
|
-
@property
|
|
197
|
-
def WEB_AUTH_REFRESH_TOKEN_EXPIRE_MINUTES(self) -> int:
|
|
198
|
-
return int(os.getenv("ZRB_WEB_REFRESH_TOKEN_EXPIRE_MINUTES", "60"))
|
|
199
|
-
|
|
200
|
-
@property
|
|
201
|
-
def WEB_TITLE(self) -> str:
|
|
202
|
-
return os.getenv("ZRB_WEB_TITLE", "Zrb")
|
|
203
|
-
|
|
204
|
-
@property
|
|
205
|
-
def WEB_JARGON(self) -> str:
|
|
206
|
-
return os.getenv("ZRB_WEB_JARGON", "Your Automation PowerHouse")
|
|
207
|
-
|
|
208
|
-
@property
|
|
209
|
-
def WEB_HOMEPAGE_INTRO(self) -> str:
|
|
210
|
-
return os.getenv("ZRB_WEB_HOMEPAGE_INTRO", "Welcome to Zrb Web Interface")
|
|
211
|
-
|
|
212
|
-
@property
|
|
213
|
-
def LLM_MODEL(self) -> str | None:
|
|
214
|
-
return os.getenv("ZRB_LLM_MODEL", None)
|
|
215
|
-
|
|
216
|
-
@property
|
|
217
|
-
def LLM_BASE_URL(self) -> str | None:
|
|
218
|
-
return os.getenv("ZRB_LLM_BASE_URL", None)
|
|
219
|
-
|
|
220
|
-
@property
|
|
221
|
-
def LLM_API_KEY(self) -> str | None:
|
|
222
|
-
return os.getenv("ZRB_LLM_API_KEY", None)
|
|
223
|
-
|
|
224
|
-
@property
|
|
225
|
-
def LLM_SYSTEM_PROMPT(self) -> str | None:
|
|
226
|
-
return os.getenv("ZRB_LLM_SYSTEM_PROMPT", None)
|
|
227
|
-
|
|
228
|
-
@property
|
|
229
|
-
def LLM_PERSONA(self) -> str | None:
|
|
230
|
-
return os.getenv("ZRB_LLM_PERSONA", None)
|
|
231
|
-
|
|
232
|
-
@property
|
|
233
|
-
def LLM_SPECIAL_INSTRUCTION_PROMPT(self) -> str | None:
|
|
234
|
-
return os.getenv("ZRB_LLM_SPECIAL_INSTRUCTION_PROMPT", None)
|
|
235
|
-
|
|
236
|
-
@property
|
|
237
|
-
def LLM_SUMMARIZATION_PROMPT(self) -> str | None:
|
|
238
|
-
return os.getenv("ZRB_LLM_SUMMARIZATION_PROMPT", None)
|
|
239
|
-
|
|
240
|
-
@property
|
|
241
|
-
def LLM_MAX_REQUESTS_PER_MINUTE(self) -> int:
|
|
242
|
-
"""Maximum number of LLM requests allowed per minute."""
|
|
243
|
-
return int(os.getenv("LLM_MAX_REQUESTS_PER_MINUTE", "60"))
|
|
244
|
-
|
|
245
|
-
@property
|
|
246
|
-
def LLM_MAX_TOKENS_PER_MINUTE(self) -> int:
|
|
247
|
-
"""Maximum number of LLM tokens allowed per minute."""
|
|
248
|
-
return int(os.getenv("ZRB_LLM_MAX_TOKENS_PER_MINUTE", "200000"))
|
|
249
|
-
|
|
250
|
-
@property
|
|
251
|
-
def LLM_MAX_TOKENS_PER_REQUEST(self) -> int:
|
|
252
|
-
"""Maximum number of tokens allowed per individual LLM request."""
|
|
253
|
-
return int(os.getenv("ZRB_LLM_MAX_TOKENS_PER_REQUEST", "50000"))
|
|
254
|
-
|
|
255
|
-
@property
|
|
256
|
-
def LLM_THROTTLE_SLEEP(self) -> float:
|
|
257
|
-
"""Number of seconds to sleep when throttling is required."""
|
|
258
|
-
return float(os.getenv("ZRB_LLM_THROTTLE_SLEEP", "1.0"))
|
|
259
|
-
|
|
260
|
-
@property
|
|
261
|
-
def LLM_CONTEXT_ENRICHMENT_PROMPT(self) -> str | None:
|
|
262
|
-
return os.getenv("ZRB_LLM_CONTEXT_ENRICHMENT_PROMPT", None)
|
|
263
|
-
|
|
264
|
-
@property
|
|
265
|
-
def LLM_SUMMARIZE_HISTORY(self) -> bool:
|
|
266
|
-
return to_boolean(os.getenv("ZRB_LLM_SUMMARIZE_HISTORY", "true"))
|
|
267
|
-
|
|
268
|
-
@property
|
|
269
|
-
def LLM_HISTORY_SUMMARIZATION_THRESHOLD(self) -> int:
|
|
270
|
-
return int(os.getenv("ZRB_LLM_HISTORY_SUMMARIZATION_THRESHOLD", "5"))
|
|
271
|
-
|
|
272
|
-
@property
|
|
273
|
-
def LLM_ENRICH_CONTEXT(self) -> bool:
|
|
274
|
-
return to_boolean(os.getenv("ZRB_LLM_ENRICH_CONTEXT", "true"))
|
|
275
|
-
|
|
276
|
-
@property
|
|
277
|
-
def LLM_CONTEXT_ENRICHMENT_THRESHOLD(self) -> int:
|
|
278
|
-
return int(os.getenv("ZRB_LLM_CONTEXT_ENRICHMENT_THRESHOLD", "5"))
|
|
279
|
-
|
|
280
|
-
@property
|
|
281
|
-
def LLM_HISTORY_DIR(self) -> str:
|
|
282
|
-
return os.getenv(
|
|
283
|
-
"ZRB_LLM_HISTORY_DIR",
|
|
284
|
-
os.path.expanduser(os.path.join("~", ".zrb-llm-history")),
|
|
285
|
-
)
|
|
286
|
-
|
|
287
|
-
@property
|
|
288
|
-
def LLM_ALLOW_ACCESS_LOCAL_FILE(self) -> bool:
|
|
289
|
-
return to_boolean(os.getenv("ZRB_LLM_ACCESS_LOCAL_FILE", "1"))
|
|
290
|
-
|
|
291
|
-
@property
|
|
292
|
-
def LLM_ALLOW_ACCESS_SHELL(self) -> bool:
|
|
293
|
-
return to_boolean(os.getenv("ZRB_LLM_ACCESS_SHELL", "1"))
|
|
294
|
-
|
|
295
|
-
@property
|
|
296
|
-
def LLM_ALLOW_ACCESS_INTERNET(self) -> bool:
|
|
297
|
-
return to_boolean(os.getenv("ZRB_LLM_ACCESS_INTERNET", "1"))
|
|
298
|
-
|
|
299
|
-
@property
|
|
300
|
-
def RAG_EMBEDDING_API_KEY(self) -> str:
|
|
301
|
-
return os.getenv("ZRB_RAG_EMBEDDING_API_KEY", None)
|
|
302
|
-
|
|
303
|
-
@property
|
|
304
|
-
def RAG_EMBEDDING_BASE_URL(self) -> str:
|
|
305
|
-
return os.getenv("ZRB_RAG_EMBEDDING_BASE_URL", None)
|
|
306
|
-
|
|
307
|
-
@property
|
|
308
|
-
def RAG_EMBEDDING_MODEL(self) -> str:
|
|
309
|
-
return os.getenv("ZRB_RAG_EMBEDDING_MODEL", "text-embedding-ada-002")
|
|
310
|
-
|
|
311
|
-
@property
|
|
312
|
-
def RAG_CHUNK_SIZE(self) -> int:
|
|
313
|
-
return int(os.getenv("ZRB_RAG_CHUNK_SIZE", "1024"))
|
|
314
|
-
|
|
315
|
-
@property
|
|
316
|
-
def RAG_OVERLAP(self) -> int:
|
|
317
|
-
return int(os.getenv("ZRB_RAG_OVERLAP", "128"))
|
|
318
|
-
|
|
319
|
-
@property
|
|
320
|
-
def RAG_MAX_RESULT_COUNT(self) -> int:
|
|
321
|
-
return int(os.getenv("ZRB_RAG_MAX_RESULT_COUNT", "5"))
|
|
322
|
-
|
|
323
|
-
@property
|
|
324
|
-
def SERPAPI_KEY(self) -> str:
|
|
325
|
-
return os.getenv("SERPAPI_KEY", "")
|
|
326
|
-
|
|
327
|
-
@property
|
|
328
|
-
def BANNER(self) -> str:
|
|
329
|
-
return fstring_format(
|
|
330
|
-
os.getenv("ZRB_BANNER", _DEFAULT_BANNER),
|
|
331
|
-
{"VERSION": self.VERSION},
|
|
332
|
-
)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
CFG = Config()
|