janito 2.6.1__py3-none-any.whl → 2.8.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.
- janito/__init__.py +6 -7
- janito/__main__.py +4 -5
- janito/_version.py +55 -58
- janito/agent/setup_agent.py +308 -241
- janito/agent/templates/profiles/{system_prompt_template_software developer.txt.j2 → system_prompt_template_Developer_with_Python_Tools.txt.j2} +43 -39
- janito/agent/templates/profiles/system_prompt_template_developer.txt.j2 +3 -12
- janito/cli/__init__.py +9 -10
- janito/cli/chat_mode/bindings.py +38 -38
- janito/cli/chat_mode/chat_entry.py +21 -23
- janito/cli/chat_mode/prompt_style.py +22 -25
- janito/cli/chat_mode/script_runner.py +158 -154
- janito/cli/chat_mode/session.py +80 -35
- janito/cli/chat_mode/session_profile_select.py +61 -52
- janito/cli/chat_mode/shell/commands/__init__.py +1 -5
- janito/cli/chat_mode/shell/commands/_priv_check.py +1 -0
- janito/cli/chat_mode/shell/commands/bang.py +10 -3
- janito/cli/chat_mode/shell/commands/conversation_restart.py +24 -7
- janito/cli/chat_mode/shell/commands/execute.py +22 -7
- janito/cli/chat_mode/shell/commands/help.py +4 -1
- janito/cli/chat_mode/shell/commands/model.py +13 -5
- janito/cli/chat_mode/shell/commands/privileges.py +21 -0
- janito/cli/chat_mode/shell/commands/prompt.py +0 -2
- janito/cli/chat_mode/shell/commands/read.py +22 -5
- janito/cli/chat_mode/shell/commands/tools.py +15 -4
- janito/cli/chat_mode/shell/commands/write.py +22 -5
- janito/cli/chat_mode/shell/input_history.py +3 -1
- janito/cli/chat_mode/shell/session/manager.py +0 -2
- janito/cli/chat_mode/toolbar.py +25 -19
- janito/cli/cli_commands/list_models.py +1 -1
- janito/cli/cli_commands/list_providers.py +1 -0
- janito/cli/cli_commands/list_tools.py +35 -7
- janito/cli/cli_commands/model_utils.py +5 -3
- janito/cli/cli_commands/show_config.py +12 -0
- janito/cli/cli_commands/show_system_prompt.py +23 -9
- janito/cli/config.py +0 -13
- janito/cli/core/getters.py +2 -0
- janito/cli/core/runner.py +25 -8
- janito/cli/core/setters.py +13 -76
- janito/cli/main_cli.py +9 -25
- janito/cli/prompt_core.py +19 -18
- janito/cli/prompt_setup.py +6 -3
- janito/cli/rich_terminal_reporter.py +19 -5
- janito/cli/single_shot_mode/handler.py +104 -95
- janito/cli/verbose_output.py +5 -1
- janito/config_manager.py +4 -0
- janito/drivers/azure_openai/driver.py +27 -30
- janito/drivers/driver_registry.py +27 -27
- janito/drivers/openai/driver.py +452 -436
- janito/formatting_token.py +12 -4
- janito/llm/agent.py +15 -6
- janito/llm/driver.py +1 -0
- janito/provider_registry.py +139 -178
- janito/providers/__init__.py +2 -0
- janito/providers/anthropic/model_info.py +40 -41
- janito/providers/anthropic/provider.py +75 -80
- janito/providers/azure_openai/provider.py +9 -4
- janito/providers/deepseek/provider.py +5 -4
- janito/providers/google/model_info.py +4 -2
- janito/providers/google/provider.py +11 -5
- janito/providers/groq/__init__.py +1 -0
- janito/providers/groq/model_info.py +46 -0
- janito/providers/groq/provider.py +76 -0
- janito/providers/moonshotai/__init__.py +1 -0
- janito/providers/moonshotai/model_info.py +15 -0
- janito/providers/moonshotai/provider.py +89 -0
- janito/providers/openai/provider.py +6 -7
- janito/tools/__init__.py +2 -0
- janito/tools/adapters/local/__init__.py +67 -66
- janito/tools/adapters/local/adapter.py +21 -4
- janito/tools/adapters/local/ask_user.py +1 -0
- janito/tools/adapters/local/copy_file.py +1 -0
- janito/tools/adapters/local/create_directory.py +1 -0
- janito/tools/adapters/local/create_file.py +1 -0
- janito/tools/adapters/local/delete_text_in_file.py +2 -1
- janito/tools/adapters/local/fetch_url.py +1 -0
- janito/tools/adapters/local/find_files.py +7 -6
- janito/tools/adapters/local/get_file_outline/core.py +1 -0
- janito/tools/adapters/local/get_file_outline/java_outline.py +22 -15
- janito/tools/adapters/local/get_file_outline/search_outline.py +1 -0
- janito/tools/adapters/local/move_file.py +4 -3
- janito/tools/adapters/local/open_html_in_browser.py +15 -5
- janito/tools/adapters/local/open_url.py +1 -0
- janito/tools/adapters/local/python_code_run.py +1 -0
- janito/tools/adapters/local/python_command_run.py +1 -0
- janito/tools/adapters/local/python_file_run.py +1 -0
- janito/tools/adapters/local/read_files.py +55 -40
- janito/tools/adapters/local/remove_directory.py +1 -0
- janito/tools/adapters/local/remove_file.py +1 -0
- janito/tools/adapters/local/replace_text_in_file.py +4 -3
- janito/tools/adapters/local/run_bash_command.py +1 -0
- janito/tools/adapters/local/run_powershell_command.py +1 -0
- janito/tools/adapters/local/search_text/core.py +18 -17
- janito/tools/adapters/local/search_text/match_lines.py +5 -5
- janito/tools/adapters/local/search_text/pattern_utils.py +1 -1
- janito/tools/adapters/local/search_text/traverse_directory.py +7 -7
- janito/tools/adapters/local/validate_file_syntax/core.py +1 -1
- janito/tools/adapters/local/validate_file_syntax/html_validator.py +8 -1
- janito/tools/disabled_tools.py +68 -0
- janito/tools/path_security.py +18 -11
- janito/tools/permissions.py +6 -0
- janito/tools/permissions_parse.py +4 -3
- janito/tools/tool_base.py +11 -5
- janito/tools/tool_use_tracker.py +1 -4
- janito/tools/tool_utils.py +1 -1
- janito/tools/tools_adapter.py +57 -25
- {janito-2.6.1.dist-info → janito-2.8.0.dist-info}/METADATA +411 -417
- janito-2.8.0.dist-info/RECORD +202 -0
- janito/cli/chat_mode/shell/commands/livelogs.py +0 -49
- janito/drivers/mistralai/driver.py +0 -41
- janito/providers/mistralai/model_info.py +0 -37
- janito/providers/mistralai/provider.py +0 -72
- janito/providers/provider_static_info.py +0 -18
- janito-2.6.1.dist-info/RECORD +0 -199
- /janito/agent/templates/profiles/{system_prompt_template_assistant.txt.j2 → system_prompt_template_model_conversation_without_tools_or_context.txt.j2} +0 -0
- {janito-2.6.1.dist-info → janito-2.8.0.dist-info}/WHEEL +0 -0
- {janito-2.6.1.dist-info → janito-2.8.0.dist-info}/entry_points.txt +0 -0
- {janito-2.6.1.dist-info → janito-2.8.0.dist-info}/licenses/LICENSE +0 -0
- {janito-2.6.1.dist-info → janito-2.8.0.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,6 @@
|
|
1
1
|
from janito.drivers.openai.driver import OpenAIModelDriver
|
2
2
|
|
3
|
-
|
4
|
-
try:
|
5
|
-
from openai import AzureOpenAI
|
6
|
-
|
7
|
-
DRIVER_AVAILABLE = True
|
8
|
-
DRIVER_UNAVAILABLE_REASON = None
|
9
|
-
except ImportError:
|
10
|
-
DRIVER_AVAILABLE = False
|
11
|
-
DRIVER_UNAVAILABLE_REASON = "Missing dependency: openai (pip install openai)"
|
3
|
+
from openai import AzureOpenAI
|
12
4
|
|
13
5
|
from janito.llm.driver_config import LLMDriverConfig
|
14
6
|
|
@@ -16,30 +8,22 @@ from janito.llm.driver_config import LLMDriverConfig
|
|
16
8
|
class AzureOpenAIModelDriver(OpenAIModelDriver):
|
17
9
|
def start(self, *args, **kwargs):
|
18
10
|
# Ensure azure_deployment_name is set before starting
|
19
|
-
config = getattr(self,
|
11
|
+
config = getattr(self, "config", None)
|
20
12
|
deployment_name = None
|
21
|
-
if config and hasattr(config,
|
22
|
-
deployment_name = config.extra.get(
|
13
|
+
if config and hasattr(config, "extra"):
|
14
|
+
deployment_name = config.extra.get("azure_deployment_name")
|
23
15
|
if not deployment_name:
|
24
|
-
raise RuntimeError(
|
16
|
+
raise RuntimeError(
|
17
|
+
"AzureOpenAIModelDriver requires 'azure_deployment_name' to be set in config.extra['azure_deployment_name'] before starting."
|
18
|
+
)
|
25
19
|
# Call parent start if exists
|
26
|
-
if hasattr(super(),
|
20
|
+
if hasattr(super(), "start"):
|
27
21
|
return super().start(*args, **kwargs)
|
28
22
|
|
29
|
-
available = DRIVER_AVAILABLE
|
30
|
-
unavailable_reason = DRIVER_UNAVAILABLE_REASON
|
31
|
-
|
32
|
-
@classmethod
|
33
|
-
def is_available(cls):
|
34
|
-
return cls.available
|
35
|
-
|
36
23
|
required_config = {"base_url"} # Update key as used in your config logic
|
37
24
|
|
38
25
|
def __init__(self, tools_adapter=None, provider_name=None):
|
39
|
-
|
40
|
-
raise ImportError(
|
41
|
-
f"AzureOpenAIModelDriver unavailable: {self.unavailable_reason}"
|
42
|
-
)
|
26
|
+
|
43
27
|
# Ensure proper parent initialization
|
44
28
|
super().__init__(tools_adapter=tools_adapter, provider_name=provider_name)
|
45
29
|
self.azure_endpoint = None
|
@@ -52,25 +36,35 @@ class AzureOpenAIModelDriver(OpenAIModelDriver):
|
|
52
36
|
Also ensures tool schemas are included if tools_adapter is present.
|
53
37
|
"""
|
54
38
|
api_kwargs = super()._prepare_api_kwargs(config, conversation)
|
55
|
-
deployment_name =
|
39
|
+
deployment_name = (
|
40
|
+
config.extra.get("azure_deployment_name")
|
41
|
+
if hasattr(config, "extra")
|
42
|
+
else None
|
43
|
+
)
|
56
44
|
if deployment_name:
|
57
45
|
api_kwargs["model"] = deployment_name
|
58
46
|
# Patch: Ensure tools are included for Azure as for OpenAI
|
59
47
|
if self.tools_adapter:
|
60
48
|
try:
|
61
|
-
from janito.providers.openai.schema_generator import
|
49
|
+
from janito.providers.openai.schema_generator import (
|
50
|
+
generate_tool_schemas,
|
51
|
+
)
|
52
|
+
|
62
53
|
tool_classes = self.tools_adapter.get_tool_classes()
|
63
54
|
tool_schemas = generate_tool_schemas(tool_classes)
|
64
55
|
api_kwargs["tools"] = tool_schemas
|
65
56
|
except Exception as e:
|
66
57
|
api_kwargs["tools"] = []
|
67
58
|
if hasattr(config, "verbose_api") and config.verbose_api:
|
68
|
-
print(
|
59
|
+
print(
|
60
|
+
f"[AzureOpenAIModelDriver] Tool schema generation failed: {e}"
|
61
|
+
)
|
69
62
|
return api_kwargs
|
70
63
|
|
71
64
|
def _instantiate_openai_client(self, config):
|
72
65
|
try:
|
73
66
|
from openai import AzureOpenAI
|
67
|
+
|
74
68
|
api_key_display = str(config.api_key)
|
75
69
|
if api_key_display and len(api_key_display) > 8:
|
76
70
|
api_key_display = api_key_display[:4] + "..." + api_key_display[-4:]
|
@@ -83,8 +77,11 @@ class AzureOpenAIModelDriver(OpenAIModelDriver):
|
|
83
77
|
client = AzureOpenAI(**client_kwargs)
|
84
78
|
return client
|
85
79
|
except Exception as e:
|
86
|
-
print(
|
80
|
+
print(
|
81
|
+
f"[ERROR] Exception during AzureOpenAI client instantiation: {e}",
|
82
|
+
flush=True,
|
83
|
+
)
|
87
84
|
import traceback
|
85
|
+
|
88
86
|
print(traceback.format_exc(), flush=True)
|
89
87
|
raise
|
90
|
-
|
@@ -1,27 +1,27 @@
|
|
1
|
-
# janito/drivers/driver_registry.py
|
2
|
-
"""
|
3
|
-
DriverRegistry: Maps driver string names to class objects for use by providers.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import Dict, Type
|
7
|
-
|
8
|
-
# --- Import driver classes ---
|
9
|
-
from janito.drivers.azure_openai.driver import AzureOpenAIModelDriver
|
10
|
-
from janito.drivers.openai.driver import OpenAIModelDriver
|
11
|
-
|
12
|
-
_DRIVER_REGISTRY: Dict[str, Type] = {
|
13
|
-
"AzureOpenAIModelDriver": AzureOpenAIModelDriver,
|
14
|
-
"OpenAIModelDriver": OpenAIModelDriver,
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
def get_driver_class(name: str):
|
19
|
-
"""Get the driver class by string name."""
|
20
|
-
try:
|
21
|
-
return _DRIVER_REGISTRY[name]
|
22
|
-
except KeyError:
|
23
|
-
raise ValueError(f"No driver found for name: {name}")
|
24
|
-
|
25
|
-
|
26
|
-
def register_driver(name: str, cls: type):
|
27
|
-
_DRIVER_REGISTRY[name] = cls
|
1
|
+
# janito/drivers/driver_registry.py
|
2
|
+
"""
|
3
|
+
DriverRegistry: Maps driver string names to class objects for use by providers.
|
4
|
+
"""
|
5
|
+
|
6
|
+
from typing import Dict, Type
|
7
|
+
|
8
|
+
# --- Import driver classes ---
|
9
|
+
from janito.drivers.azure_openai.driver import AzureOpenAIModelDriver
|
10
|
+
from janito.drivers.openai.driver import OpenAIModelDriver
|
11
|
+
|
12
|
+
_DRIVER_REGISTRY: Dict[str, Type] = {
|
13
|
+
"AzureOpenAIModelDriver": AzureOpenAIModelDriver,
|
14
|
+
"OpenAIModelDriver": OpenAIModelDriver,
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
def get_driver_class(name: str):
|
19
|
+
"""Get the driver class by string name."""
|
20
|
+
try:
|
21
|
+
return _DRIVER_REGISTRY[name]
|
22
|
+
except KeyError:
|
23
|
+
raise ValueError(f"No driver found for name: {name}")
|
24
|
+
|
25
|
+
|
26
|
+
def register_driver(name: str, cls: type):
|
27
|
+
_DRIVER_REGISTRY[name] = cls
|