janito 2.1.1__py3-none-any.whl → 2.3.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.
Files changed (137) hide show
  1. janito/__init__.py +6 -6
  2. janito/agent/setup_agent.py +14 -5
  3. janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +3 -1
  4. janito/cli/chat_mode/bindings.py +6 -0
  5. janito/cli/chat_mode/session.py +16 -0
  6. janito/cli/chat_mode/shell/autocomplete.py +21 -21
  7. janito/cli/chat_mode/shell/commands/__init__.py +3 -2
  8. janito/cli/chat_mode/shell/commands/clear.py +12 -12
  9. janito/cli/chat_mode/shell/commands/exec.py +27 -0
  10. janito/cli/chat_mode/shell/commands/multi.py +51 -51
  11. janito/cli/chat_mode/shell/commands/tools.py +17 -6
  12. janito/cli/chat_mode/shell/input_history.py +62 -62
  13. janito/cli/chat_mode/shell/session/manager.py +1 -0
  14. janito/cli/chat_mode/toolbar.py +3 -1
  15. janito/cli/cli_commands/list_models.py +35 -35
  16. janito/cli/cli_commands/list_providers.py +9 -9
  17. janito/cli/cli_commands/list_tools.py +53 -53
  18. janito/cli/cli_commands/model_selection.py +50 -50
  19. janito/cli/cli_commands/model_utils.py +13 -2
  20. janito/cli/cli_commands/set_api_key.py +19 -19
  21. janito/cli/cli_commands/show_config.py +51 -51
  22. janito/cli/cli_commands/show_system_prompt.py +62 -62
  23. janito/cli/config.py +2 -1
  24. janito/cli/core/__init__.py +4 -4
  25. janito/cli/core/event_logger.py +59 -59
  26. janito/cli/core/getters.py +3 -1
  27. janito/cli/core/runner.py +27 -6
  28. janito/cli/core/setters.py +5 -1
  29. janito/cli/core/unsetters.py +54 -54
  30. janito/cli/main_cli.py +12 -1
  31. janito/cli/prompt_core.py +5 -2
  32. janito/cli/rich_terminal_reporter.py +22 -3
  33. janito/cli/single_shot_mode/__init__.py +6 -6
  34. janito/cli/single_shot_mode/handler.py +11 -1
  35. janito/cli/verbose_output.py +1 -1
  36. janito/config.py +5 -5
  37. janito/config_manager.py +2 -0
  38. janito/driver_events.py +14 -0
  39. janito/drivers/anthropic/driver.py +113 -113
  40. janito/drivers/azure_openai/driver.py +38 -3
  41. janito/drivers/driver_registry.py +0 -2
  42. janito/drivers/openai/driver.py +196 -36
  43. janito/formatting_token.py +54 -54
  44. janito/i18n/__init__.py +35 -35
  45. janito/i18n/messages.py +23 -23
  46. janito/i18n/pt.py +47 -47
  47. janito/llm/__init__.py +5 -5
  48. janito/llm/agent.py +443 -443
  49. janito/llm/auth.py +1 -0
  50. janito/llm/driver.py +7 -1
  51. janito/llm/driver_config.py +1 -0
  52. janito/llm/driver_config_builder.py +34 -34
  53. janito/llm/driver_input.py +12 -12
  54. janito/llm/message_parts.py +60 -60
  55. janito/llm/model.py +38 -38
  56. janito/llm/provider.py +196 -196
  57. janito/provider_config.py +7 -3
  58. janito/provider_registry.py +29 -5
  59. janito/providers/__init__.py +1 -0
  60. janito/providers/anthropic/model_info.py +22 -22
  61. janito/providers/anthropic/provider.py +2 -2
  62. janito/providers/azure_openai/model_info.py +7 -6
  63. janito/providers/azure_openai/provider.py +44 -2
  64. janito/providers/deepseek/__init__.py +1 -1
  65. janito/providers/deepseek/model_info.py +16 -16
  66. janito/providers/deepseek/provider.py +91 -91
  67. janito/providers/google/model_info.py +21 -29
  68. janito/providers/google/provider.py +49 -38
  69. janito/providers/mistralai/provider.py +2 -2
  70. janito/providers/openai/model_info.py +0 -11
  71. janito/providers/openai/provider.py +1 -1
  72. janito/providers/provider_static_info.py +2 -3
  73. janito/providers/registry.py +26 -26
  74. janito/tools/adapters/__init__.py +1 -1
  75. janito/tools/adapters/local/__init__.py +62 -62
  76. janito/tools/adapters/local/adapter.py +33 -11
  77. janito/tools/adapters/local/ask_user.py +102 -102
  78. janito/tools/adapters/local/copy_file.py +84 -84
  79. janito/tools/adapters/local/create_directory.py +69 -69
  80. janito/tools/adapters/local/create_file.py +82 -82
  81. janito/tools/adapters/local/delete_text_in_file.py +4 -7
  82. janito/tools/adapters/local/fetch_url.py +97 -97
  83. janito/tools/adapters/local/find_files.py +138 -140
  84. janito/tools/adapters/local/get_file_outline/__init__.py +1 -1
  85. janito/tools/adapters/local/get_file_outline/core.py +117 -151
  86. janito/tools/adapters/local/get_file_outline/java_outline.py +40 -0
  87. janito/tools/adapters/local/get_file_outline/markdown_outline.py +14 -14
  88. janito/tools/adapters/local/get_file_outline/python_outline.py +303 -303
  89. janito/tools/adapters/local/get_file_outline/python_outline_v2.py +156 -156
  90. janito/tools/adapters/local/get_file_outline/search_outline.py +33 -33
  91. janito/tools/adapters/local/move_file.py +3 -13
  92. janito/tools/adapters/local/open_html_in_browser.py +24 -29
  93. janito/tools/adapters/local/open_url.py +3 -2
  94. janito/tools/adapters/local/python_code_run.py +166 -166
  95. janito/tools/adapters/local/python_command_run.py +164 -164
  96. janito/tools/adapters/local/python_file_run.py +163 -163
  97. janito/tools/adapters/local/remove_directory.py +6 -17
  98. janito/tools/adapters/local/remove_file.py +9 -15
  99. janito/tools/adapters/local/replace_text_in_file.py +6 -9
  100. janito/tools/adapters/local/run_bash_command.py +176 -176
  101. janito/tools/adapters/local/run_powershell_command.py +219 -219
  102. janito/tools/adapters/local/search_text/__init__.py +1 -1
  103. janito/tools/adapters/local/search_text/core.py +201 -201
  104. janito/tools/adapters/local/search_text/match_lines.py +1 -1
  105. janito/tools/adapters/local/search_text/pattern_utils.py +73 -73
  106. janito/tools/adapters/local/search_text/traverse_directory.py +145 -145
  107. janito/tools/adapters/local/validate_file_syntax/__init__.py +1 -1
  108. janito/tools/adapters/local/validate_file_syntax/core.py +106 -106
  109. janito/tools/adapters/local/validate_file_syntax/css_validator.py +35 -35
  110. janito/tools/adapters/local/validate_file_syntax/html_validator.py +93 -93
  111. janito/tools/adapters/local/validate_file_syntax/js_validator.py +27 -27
  112. janito/tools/adapters/local/validate_file_syntax/json_validator.py +6 -6
  113. janito/tools/adapters/local/validate_file_syntax/markdown_validator.py +109 -109
  114. janito/tools/adapters/local/validate_file_syntax/ps1_validator.py +32 -32
  115. janito/tools/adapters/local/validate_file_syntax/python_validator.py +5 -5
  116. janito/tools/adapters/local/validate_file_syntax/xml_validator.py +11 -11
  117. janito/tools/adapters/local/validate_file_syntax/yaml_validator.py +6 -6
  118. janito/tools/adapters/local/view_file.py +167 -167
  119. janito/tools/inspect_registry.py +17 -17
  120. janito/tools/tool_base.py +105 -105
  121. janito/tools/tool_events.py +58 -58
  122. janito/tools/tool_run_exception.py +12 -12
  123. janito/tools/tool_use_tracker.py +81 -81
  124. janito/tools/tool_utils.py +45 -45
  125. janito/tools/tools_adapter.py +78 -6
  126. janito/tools/tools_schema.py +104 -104
  127. janito/version.py +4 -4
  128. {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/METADATA +388 -232
  129. janito-2.3.0.dist-info/RECORD +181 -0
  130. janito-2.3.0.dist-info/licenses/LICENSE +21 -0
  131. janito/cli/chat_mode/shell/commands/last.py +0 -137
  132. janito/drivers/google_genai/driver.py +0 -54
  133. janito/drivers/google_genai/schema_generator.py +0 -67
  134. janito-2.1.1.dist-info/RECORD +0 -181
  135. {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/WHEEL +0 -0
  136. {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/entry_points.txt +0 -0
  137. {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/top_level.txt +0 -0
@@ -1,54 +1,54 @@
1
- """
2
- Token summary formatter for rich and pt markup.
3
- - Used to display token/message counters after completions.
4
- """
5
-
6
- from janito.perf_singleton import performance_collector
7
-
8
- from rich.rule import Rule
9
-
10
-
11
- def format_tokens(n, tag=None, use_rich=False):
12
- if n is None:
13
- return "?"
14
- if n < 1000:
15
- val = str(n)
16
- elif n < 1000000:
17
- val = f"{n/1000:.1f}k"
18
- else:
19
- val = f"{n/1000000:.1f}M"
20
- if tag:
21
- if use_rich:
22
- return f"[{tag}]{val}[/{tag}]"
23
- else:
24
- return f"<{tag}>{val}</{tag}>"
25
- return val
26
-
27
-
28
- def format_token_message_summary(msg_count, usage, width=96, use_rich=False):
29
- """
30
- Returns a string (rich or pt markup) summarizing message count and last token usage.
31
- """
32
- left = f" Messages: {'[' if use_rich else '<'}msg_count{']' if use_rich else '>'}{msg_count}{'[/msg_count]' if use_rich else '</msg_count>'}"
33
- tokens_part = ""
34
- if usage:
35
- prompt_tokens = usage.get("prompt_tokens")
36
- completion_tokens = usage.get("completion_tokens")
37
- total_tokens = usage.get("total_tokens")
38
- tokens_part = (
39
- f" | Tokens - Prompt: {format_tokens(prompt_tokens, 'tokens_in', use_rich)}, "
40
- f"Completion: {format_tokens(completion_tokens, 'tokens_out', use_rich)}, "
41
- f"Total: {format_tokens(total_tokens, 'tokens_total', use_rich)}"
42
- )
43
- return f"{left}{tokens_part}"
44
-
45
-
46
- def print_token_message_summary(console, msg_count=None, usage=None, width=96):
47
- """Prints the summary using rich markup, using defaults from perf_singleton if not given."""
48
- if usage is None:
49
- usage = performance_collector.get_last_request_usage()
50
- if msg_count is None:
51
- msg_count = performance_collector.get_total_turns() or 0
52
- line = format_token_message_summary(msg_count, usage, width, use_rich=True)
53
- if line.strip():
54
- console.print(Rule(line))
1
+ """
2
+ Token summary formatter for rich and pt markup.
3
+ - Used to display token/message counters after completions.
4
+ """
5
+
6
+ from janito.perf_singleton import performance_collector
7
+
8
+ from rich.rule import Rule
9
+
10
+
11
+ def format_tokens(n, tag=None, use_rich=False):
12
+ if n is None:
13
+ return "?"
14
+ if n < 1000:
15
+ val = str(n)
16
+ elif n < 1000000:
17
+ val = f"{n/1000:.1f}k"
18
+ else:
19
+ val = f"{n/1000000:.1f}M"
20
+ if tag:
21
+ if use_rich:
22
+ return f"[{tag}]{val}[/{tag}]"
23
+ else:
24
+ return f"<{tag}>{val}</{tag}>"
25
+ return val
26
+
27
+
28
+ def format_token_message_summary(msg_count, usage, width=96, use_rich=False):
29
+ """
30
+ Returns a string (rich or pt markup) summarizing message count and last token usage.
31
+ """
32
+ left = f" Messages: {'[' if use_rich else '<'}msg_count{']' if use_rich else '>'}{msg_count}{'[/msg_count]' if use_rich else '</msg_count>'}"
33
+ tokens_part = ""
34
+ if usage:
35
+ prompt_tokens = usage.get("prompt_tokens")
36
+ completion_tokens = usage.get("completion_tokens")
37
+ total_tokens = usage.get("total_tokens")
38
+ tokens_part = (
39
+ f" | Tokens - Prompt: {format_tokens(prompt_tokens, 'tokens_in', use_rich)}, "
40
+ f"Completion: {format_tokens(completion_tokens, 'tokens_out', use_rich)}, "
41
+ f"Total: {format_tokens(total_tokens, 'tokens_total', use_rich)}"
42
+ )
43
+ return f"{left}{tokens_part}"
44
+
45
+
46
+ def print_token_message_summary(console, msg_count=None, usage=None, width=96):
47
+ """Prints the summary using rich markup, using defaults from perf_singleton if not given."""
48
+ if usage is None:
49
+ usage = performance_collector.get_last_request_usage()
50
+ if msg_count is None:
51
+ msg_count = performance_collector.get_total_turns() or 0
52
+ line = format_token_message_summary(msg_count, usage, width, use_rich=True)
53
+ if line.strip():
54
+ console.print(Rule(line))
janito/i18n/__init__.py CHANGED
@@ -1,35 +1,35 @@
1
- import importlib
2
- import threading
3
- import hashlib
4
-
5
- _current_locale = "en"
6
- _translations = {}
7
- _lock = threading.Lock()
8
-
9
-
10
- def set_locale(locale):
11
- global _current_locale, _translations
12
- with _lock:
13
- _current_locale = locale
14
- if locale == "en":
15
- _translations = {}
16
- else:
17
- try:
18
- mod = importlib.import_module(f"janito.i18n.{locale}")
19
- _translations = getattr(mod, "translations", {})
20
- except ImportError:
21
- _translations = {}
22
-
23
-
24
- def tr(msg, **kwargs):
25
- """Translate message to current locale, usando hash SHA-1 da mensagem como chave."""
26
- msg_hash = hashlib.sha1(msg.encode("utf-8", errors="surrogatepass")).hexdigest()
27
- template = _translations.get(msg_hash, msg)
28
- try:
29
- return template.format(**kwargs)
30
- except Exception:
31
- return template # fallback if formatting fails
32
-
33
-
34
- # Inicializa com o idioma padrão (en)
35
- set_locale("en")
1
+ import importlib
2
+ import threading
3
+ import hashlib
4
+
5
+ _current_locale = "en"
6
+ _translations = {}
7
+ _lock = threading.Lock()
8
+
9
+
10
+ def set_locale(locale):
11
+ global _current_locale, _translations
12
+ with _lock:
13
+ _current_locale = locale
14
+ if locale == "en":
15
+ _translations = {}
16
+ else:
17
+ try:
18
+ mod = importlib.import_module(f"janito.i18n.{locale}")
19
+ _translations = getattr(mod, "translations", {})
20
+ except ImportError:
21
+ _translations = {}
22
+
23
+
24
+ def tr(msg, **kwargs):
25
+ """Translate message to current locale, usando hash SHA-1 da mensagem como chave."""
26
+ msg_hash = hashlib.sha1(msg.encode("utf-8", errors="surrogatepass")).hexdigest()
27
+ template = _translations.get(msg_hash, msg)
28
+ try:
29
+ return template.format(**kwargs)
30
+ except Exception:
31
+ return template # fallback if formatting fails
32
+
33
+
34
+ # Inicializa com o idioma padrão (en)
35
+ set_locale("en")
janito/i18n/messages.py CHANGED
@@ -1,23 +1,23 @@
1
- # Arquivo base de mensagens para i18n
2
- # Chave = SHA-1 da string original em inglês
3
-
4
- MESSAGES = {
5
- # create_directory.py
6
- "e3d8e1e5e0b3e4a2a7a5e2e1e4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Successfully created the directory at '{path}'.",
7
- "f2b7e4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Cannot create directory: '{path}' already exists.",
8
- "d3e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Path '{path}' exists and is not a directory.",
9
- "b1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Error creating directory '{path}': {error}",
10
- # create_file.py
11
- "a2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "File already exists at '{path}'. Use overwrite=True to overwrite.",
12
- "c3e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Created file ({lines} lines).",
13
- "d4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Updated file ({lines} lines, backup at {backup_path}).",
14
- # remove_file.py
15
- "e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "File '{path}' does not exist.",
16
- "f6e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Path '{path}' is not a file.",
17
- "a7e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Successfully removed the file at '{path}'.",
18
- "b8e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Error removing file: {error}",
19
- # replace_text_in_file.py (exemplo)
20
- "c9e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Text replaced in {file_path} (backup at {backup_path}). {details}",
21
- "d0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "No changes made. {warning_detail}",
22
- "e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Error replacing text: {error}",
23
- }
1
+ # Arquivo base de mensagens para i18n
2
+ # Chave = SHA-1 da string original em inglês
3
+
4
+ MESSAGES = {
5
+ # create_directory.py
6
+ "e3d8e1e5e0b3e4a2a7a5e2e1e4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Successfully created the directory at '{path}'.",
7
+ "f2b7e4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Cannot create directory: '{path}' already exists.",
8
+ "d3e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Path '{path}' exists and is not a directory.",
9
+ "b1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Error creating directory '{path}': {error}",
10
+ # create_file.py
11
+ "a2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "File already exists at '{path}'. Use overwrite=True to overwrite.",
12
+ "c3e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Created file ({lines} lines).",
13
+ "d4e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Updated file ({lines} lines, backup at {backup_path}).",
14
+ # remove_file.py
15
+ "e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "File '{path}' does not exist.",
16
+ "f6e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Path '{path}' is not a file.",
17
+ "a7e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Successfully removed the file at '{path}'.",
18
+ "b8e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "Error removing file: {error}",
19
+ # replace_text_in_file.py (exemplo)
20
+ "c9e2e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5": "Text replaced in {file_path} (backup at {backup_path}). {details}",
21
+ "d0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0": "No changes made. {warning_detail}",
22
+ "e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1e5e0e1": "Error replacing text: {error}",
23
+ }
janito/i18n/pt.py CHANGED
@@ -1,47 +1,47 @@
1
- # pragma: allowlist secret
2
- translations = {
3
- "36107ed78ab25f6fb12ad8ce13018cd1ce6735d1": "Iniciando servidor web...",
4
- "70a0d194687568a47aa617fd85036ace1e69a982": "Deseja realmente sair? (s/n): ",
5
- "5c9ebcbbd7632ecb328bd52958b17158afaa32c6": "F12 = Ação Rápida (segue a ação recomendada)",
6
- "e4034394acca752c021b2ab50f60da8273e3c314": "TermWeb iniciado... Disponível em http://localhost:{selected_port}",
7
- "fe21121e2934234b68d19b2757532117d440c1e3": "Chave de API não encontrada. Por favor, configure 'api_key' no seu arquivo de configuração.",
8
- "c9e3759b1756eba35b381ce2b72cd659e132b01f": "Olá, {name}!",
9
- "ca1fee2f55baabdc2e4b0e9529c89ee024e62079": "Nenhum prompt fornecido nas mensagens",
10
- "f7449d23d0c500ae2a0b31e04f92b47a4d8ae845": "max_tokens deve ser um inteiro, recebido: {resolved_max_tokens!r}",
11
- "70a9ed8edb6da12e208431a31aa16ba54419b26f": "Resposta inválida/malformada do OpenAI (tentativa {attempt}/{max_retries}). Tentando novamente em {wait_time} segundos...",
12
- "a873085e3b06184fb5d27e842f97b06b6190976d": "Número máximo de tentativas para resposta inválida atingido. Gerando erro.",
13
- "66a34568bbe846bb1bde3619eb4d6dfa10211104": "A API não suporta o uso de ferramentas.",
14
- "09b81476b75586da4116b83f8be70d77b174cec3": "Limit de taxa da API OpenAI (429) (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
15
- "5717a35dd2a1533fb7e15edc8c9329cb69f3410b": "Erro do servidor da API OpenAI (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
16
- "02e760ba15ed863176c1290ac8a9b923963103cd": "Erro do client da API OpenAI {status_code}: {e}. Não será feita nova tentativa.",
17
- "2e52b0bbc8f16226b70e3e20f95c9245d2bcdb47": "Erro da API OpenAI (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
18
- "012cc970e039fdd79c452fc676202c814ffc76ae": "Número máximo de tentativas para erro da API OpenAI atingido. Gerando erro.",
19
- "d0438e45667d31e0022b2497b5901cd4300f084b": "QueuedMessageHandler.handle_message espera um dicionário com 'type' e 'message', recebido {msg_type}: {msg!r}",
20
- "9d3460187ffa19c7c8a4020157072b1087e1bd2f": "[QueuedMessageHandler] {msg_type}: {msg}",
21
- "3813833343430e8afa8fce33385c5e39fb24dd60": "[QueuedMessageHandler] {msg_type}: {message}",
22
- "0be9a22226e16a40797010d23a0f581542dca40e": "[ToolExecutor] {tool_name} chamado com arguments: {args}",
23
- "42c68edcb25442f518b1af77c6a2ddc07461aae0": "[ToolExecutor] Motivo da chamada: {tool_call_reason}",
24
- "002ff598115d84595ffeee6219cb5c03d3a1d4a6": "Pergunta",
25
- "35747d13dcd91e8e8790c7f767d5ed764f541b9e": "prosseguir",
26
- "33dde3a1afbc418768a69fa53168d9b0638fe1aa": "avançar",
27
- "eee0bbba4ff92adbeb038a77df0466d660f15716": "continuar",
28
- "edee9402d198b04ac77dcf5dc9cc3dac44573782": "próximo",
29
- "8fdb7e2fa84f4faf0d9b92f466df424ec47a165b": "ok",
30
- "5f8f924671cda79b5205a6bf1b776f347c4a7a07": "Opções de configuração disponíveis:\n",
31
- "cef780a309cd234750764d42697882c24168ddab": "{key:15} {desc} (padrão: {default})",
32
- "68c2cc7f0ceaa3e499ecb4db331feb4debbbcc23": "Modelo",
33
- "c3f104d1365744b538bfde9f4adb6a6df4b80355": "Função",
34
- "99a0efc6cfd85d8ff2732a6718140f822cb90472": "Estilo",
35
- "f1702b4686278becffc88baabe6f4b7a8355532c": "Mensagens",
36
- "c38c6c1f3a2743f8626703abb302e403d20ff81c": "Tokens",
37
- "a817d7eb8e0f1dab755ab5203a082e5c3c094fce": "Prompt",
38
- "2ff255684a2277f806fcebf3fe338ed27857f350": "Conclusão",
39
- "b25928c69902557b0ef0a628490a3a1768d7b82f": "Total",
40
- "76e63d65c883ed50df40ac3aeef0c2d6a1c4ad60": "Ação Rápida",
41
- "5397e0583f14f6c88de06b1ef28f460a1fb5b0ae": "Sim",
42
- "816c52fd2bdd94a63cd0944823a6c0aa9384c103": "Não",
43
- "c47ae15370cfe1ed2781eedc1dc2547d12d9e972": "Ajuda",
44
- "cc3dbd47e1cf9003a55d3366b3adbcd72275e525": "Nova Tarefa",
45
- "efa5a8b84e1afe65c81ecfce28c398c48f19ddc2": "Bem-vindo ao Janito{version_str}! Entrando no modo de chat. Digite /exit para sair.",
46
- "b314d6e1460f86e0f21abc5aceb7935a2a0667e8": "Bem-vindo ao Janito{version_str} no [white on magenta]MODO VANILLA[/white on magenta]! Ferramentas, prompt do sistema e temperatura estão desativados, a menos que sejam substituídos.",
47
- }
1
+ # pragma: allowlist secret
2
+ translations = {
3
+ "36107ed78ab25f6fb12ad8ce13018cd1ce6735d1": "Iniciando servidor web...",
4
+ "70a0d194687568a47aa617fd85036ace1e69a982": "Deseja realmente sair? (s/n): ",
5
+ "5c9ebcbbd7632ecb328bd52958b17158afaa32c6": "F12 = Ação Rápida (segue a ação recomendada)",
6
+ "e4034394acca752c021b2ab50f60da8273e3c314": "TermWeb iniciado... Disponível em http://localhost:{selected_port}",
7
+ "fe21121e2934234b68d19b2757532117d440c1e3": "Chave de API não encontrada. Por favor, configure 'api_key' no seu arquivo de configuração.",
8
+ "c9e3759b1756eba35b381ce2b72cd659e132b01f": "Olá, {name}!",
9
+ "ca1fee2f55baabdc2e4b0e9529c89ee024e62079": "Nenhum prompt fornecido nas mensagens",
10
+ "f7449d23d0c500ae2a0b31e04f92b47a4d8ae845": "max_tokens deve ser um inteiro, recebido: {resolved_max_tokens!r}",
11
+ "70a9ed8edb6da12e208431a31aa16ba54419b26f": "Resposta inválida/malformada do OpenAI (tentativa {attempt}/{max_retries}). Tentando novamente em {wait_time} segundos...",
12
+ "a873085e3b06184fb5d27e842f97b06b6190976d": "Número máximo de tentativas para resposta inválida atingido. Gerando erro.",
13
+ "66a34568bbe846bb1bde3619eb4d6dfa10211104": "A API não suporta o uso de ferramentas.",
14
+ "09b81476b75586da4116b83f8be70d77b174cec3": "Limit de taxa da API OpenAI (429) (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
15
+ "5717a35dd2a1533fb7e15edc8c9329cb69f3410b": "Erro do servidor da API OpenAI (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
16
+ "02e760ba15ed863176c1290ac8a9b923963103cd": "Erro do client da API OpenAI {status_code}: {e}. Não será feita nova tentativa.",
17
+ "2e52b0bbc8f16226b70e3e20f95c9245d2bcdb47": "Erro da API OpenAI (tentativa {attempt}/{max_retries}): {e}. Tentando novamente em {wait_time} segundos...",
18
+ "012cc970e039fdd79c452fc676202c814ffc76ae": "Número máximo de tentativas para erro da API OpenAI atingido. Gerando erro.",
19
+ "d0438e45667d31e0022b2497b5901cd4300f084b": "QueuedMessageHandler.handle_message espera um dicionário com 'type' e 'message', recebido {msg_type}: {msg!r}",
20
+ "9d3460187ffa19c7c8a4020157072b1087e1bd2f": "[QueuedMessageHandler] {msg_type}: {msg}",
21
+ "3813833343430e8afa8fce33385c5e39fb24dd60": "[QueuedMessageHandler] {msg_type}: {message}",
22
+ "0be9a22226e16a40797010d23a0f581542dca40e": "[ToolExecutor] {tool_name} chamado com arguments: {args}",
23
+ "42c68edcb25442f518b1af77c6a2ddc07461aae0": "[ToolExecutor] Motivo da chamada: {tool_call_reason}",
24
+ "002ff598115d84595ffeee6219cb5c03d3a1d4a6": "Pergunta",
25
+ "35747d13dcd91e8e8790c7f767d5ed764f541b9e": "prosseguir",
26
+ "33dde3a1afbc418768a69fa53168d9b0638fe1aa": "avançar",
27
+ "eee0bbba4ff92adbeb038a77df0466d660f15716": "continuar",
28
+ "edee9402d198b04ac77dcf5dc9cc3dac44573782": "próximo",
29
+ "8fdb7e2fa84f4faf0d9b92f466df424ec47a165b": "ok",
30
+ "5f8f924671cda79b5205a6bf1b776f347c4a7a07": "Opções de configuração disponíveis:\n",
31
+ "cef780a309cd234750764d42697882c24168ddab": "{key:15} {desc} (padrão: {default})",
32
+ "68c2cc7f0ceaa3e499ecb4db331feb4debbbcc23": "Modelo",
33
+ "c3f104d1365744b538bfde9f4adb6a6df4b80355": "Função",
34
+ "99a0efc6cfd85d8ff2732a6718140f822cb90472": "Estilo",
35
+ "f1702b4686278becffc88baabe6f4b7a8355532c": "Mensagens",
36
+ "c38c6c1f3a2743f8626703abb302e403d20ff81c": "Tokens",
37
+ "a817d7eb8e0f1dab755ab5203a082e5c3c094fce": "Prompt",
38
+ "2ff255684a2277f806fcebf3fe338ed27857f350": "Conclusão",
39
+ "b25928c69902557b0ef0a628490a3a1768d7b82f": "Total",
40
+ "76e63d65c883ed50df40ac3aeef0c2d6a1c4ad60": "Ação Rápida",
41
+ "5397e0583f14f6c88de06b1ef28f460a1fb5b0ae": "Sim",
42
+ "816c52fd2bdd94a63cd0944823a6c0aa9384c103": "Não",
43
+ "c47ae15370cfe1ed2781eedc1dc2547d12d9e972": "Ajuda",
44
+ "cc3dbd47e1cf9003a55d3366b3adbcd72275e525": "Nova Tarefa",
45
+ "efa5a8b84e1afe65c81ecfce28c398c48f19ddc2": "Bem-vindo ao Janito{version_str}! Entrando no modo de chat. Digite /exit para sair.",
46
+ "b314d6e1460f86e0f21abc5aceb7935a2a0667e8": "Bem-vindo ao Janito{version_str} no [white on magenta]MODO VANILLA[/white on magenta]! Ferramentas, prompt do sistema e temperatura estão desativados, a menos que sejam substituídos.",
47
+ }
janito/llm/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
- # janito.llm package
2
-
3
- from .driver import LLMDriver
4
- from .provider import LLMProvider
5
- from .driver_config import LLMDriverConfig
1
+ # janito.llm package
2
+
3
+ from .driver import LLMDriver
4
+ from .provider import LLMProvider
5
+ from .driver_config import LLMDriverConfig