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,16 +1,16 @@
1
- MODEL_SPECS = {
2
- "deepseek-chat": {
3
- "description": "DeepSeek Chat Model (OpenAI-compatible)",
4
- "context_window": 8192,
5
- "max_tokens": 4096,
6
- "family": "deepseek",
7
- "default": True,
8
- },
9
- "deepseek-reasoner": {
10
- "description": "DeepSeek Reasoner Model (OpenAI-compatible)",
11
- "context_window": 8192,
12
- "max_tokens": 4096,
13
- "family": "deepseek",
14
- "default": False,
15
- },
16
- }
1
+ MODEL_SPECS = {
2
+ "deepseek-chat": {
3
+ "description": "DeepSeek Chat Model (OpenAI-compatible)",
4
+ "context_window": 8192,
5
+ "max_tokens": 4096,
6
+ "family": "deepseek",
7
+ "default": True,
8
+ },
9
+ "deepseek-reasoner": {
10
+ "description": "DeepSeek Reasoner Model (OpenAI-compatible)",
11
+ "context_window": 8192,
12
+ "max_tokens": 4096,
13
+ "family": "deepseek",
14
+ "default": False,
15
+ },
16
+ }
@@ -1,91 +1,91 @@
1
- from janito.llm.provider import LLMProvider
2
- from janito.llm.model import LLMModelInfo
3
- from janito.llm.auth import LLMAuthManager
4
- from janito.llm.driver_config import LLMDriverConfig
5
- from janito.drivers.openai.driver import OpenAIModelDriver
6
- from janito.tools import get_local_tools_adapter
7
- from janito.providers.registry import LLMProviderRegistry
8
- from .model_info import MODEL_SPECS
9
- from queue import Queue
10
-
11
- available = OpenAIModelDriver.available
12
- unavailable_reason = OpenAIModelDriver.unavailable_reason
13
-
14
-
15
- class DeepseekProvider(LLMProvider):
16
- name = "deepseek"
17
- maintainer = "Needs maintainer"
18
- MODEL_SPECS = MODEL_SPECS
19
- DEFAULT_MODEL = "deepseek-chat" # Options: deepseek-chat, deepseek-reasoner
20
-
21
- def __init__(
22
- self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
23
- ):
24
- if not self.available:
25
- self._driver = None
26
- else:
27
- self.auth_manager = auth_manager or LLMAuthManager()
28
- self._api_key = self.auth_manager.get_credentials(type(self).name)
29
- self._tools_adapter = get_local_tools_adapter()
30
- self._driver_config = config or LLMDriverConfig(model=None)
31
- if not self._driver_config.model:
32
- self._driver_config.model = self.DEFAULT_MODEL
33
- if not self._driver_config.api_key:
34
- self._driver_config.api_key = self._api_key
35
- # Set DeepSeek public endpoint as default base_url if not provided
36
- if not getattr(self._driver_config, "base_url", None):
37
- self._driver_config.base_url = "https://api.deepseek.com/v1"
38
- self.fill_missing_device_info(self._driver_config)
39
- self._driver = None # to be provided by factory/agent
40
-
41
- @property
42
- def driver(self) -> OpenAIModelDriver:
43
- if not self.available:
44
- raise ImportError(f"OpenAIProvider unavailable: {self.unavailable_reason}")
45
- return self._driver
46
-
47
- @property
48
- def available(self):
49
- return available
50
-
51
- @property
52
- def unavailable_reason(self):
53
- return unavailable_reason
54
-
55
- def create_driver(self):
56
- """
57
- Creates and returns a new OpenAIModelDriver instance with input/output queues.
58
- """
59
- driver = OpenAIModelDriver(
60
- tools_adapter=self._tools_adapter, provider_name=self.name
61
- )
62
- driver.config = self._driver_config
63
- # NOTE: The caller is responsible for calling driver.start() if background processing is needed.
64
- return driver
65
-
66
- def create_agent(self, tools_adapter=None, agent_name: str = None, **kwargs):
67
- from janito.llm.agent import LLMAgent
68
-
69
- # Always create a new driver with the passed-in tools_adapter
70
- if tools_adapter is None:
71
- tools_adapter = get_local_tools_adapter()
72
- # Should use new-style driver construction via queues/factory (handled elsewhere)
73
- raise NotImplementedError(
74
- "create_agent must be constructed via new factory using input/output queues and config."
75
- )
76
-
77
- @property
78
- def model_name(self):
79
- return self._driver_config.model
80
-
81
- @property
82
- def driver_config(self):
83
- """Public, read-only access to the provider's LLMDriverConfig object."""
84
- return self._driver_config
85
-
86
- def execute_tool(self, tool_name: str, event_bus, *args, **kwargs):
87
- self._tools_adapter.event_bus = event_bus
88
- return self._tools_adapter.execute_by_name(tool_name, *args, **kwargs)
89
-
90
-
91
- LLMProviderRegistry.register(DeepseekProvider.name, DeepseekProvider)
1
+ from janito.llm.provider import LLMProvider
2
+ from janito.llm.model import LLMModelInfo
3
+ from janito.llm.auth import LLMAuthManager
4
+ from janito.llm.driver_config import LLMDriverConfig
5
+ from janito.drivers.openai.driver import OpenAIModelDriver
6
+ from janito.tools import get_local_tools_adapter
7
+ from janito.providers.registry import LLMProviderRegistry
8
+ from .model_info import MODEL_SPECS
9
+ from queue import Queue
10
+
11
+ available = OpenAIModelDriver.available
12
+ unavailable_reason = OpenAIModelDriver.unavailable_reason
13
+
14
+
15
+ class DeepseekProvider(LLMProvider):
16
+ name = "deepseek"
17
+ maintainer = "Needs maintainer"
18
+ MODEL_SPECS = MODEL_SPECS
19
+ DEFAULT_MODEL = "deepseek-chat" # Options: deepseek-chat, deepseek-reasoner
20
+
21
+ def __init__(
22
+ self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
23
+ ):
24
+ if not self.available:
25
+ self._driver = None
26
+ else:
27
+ self.auth_manager = auth_manager or LLMAuthManager()
28
+ self._api_key = self.auth_manager.get_credentials(type(self).name)
29
+ self._tools_adapter = get_local_tools_adapter()
30
+ self._driver_config = config or LLMDriverConfig(model=None)
31
+ if not self._driver_config.model:
32
+ self._driver_config.model = self.DEFAULT_MODEL
33
+ if not self._driver_config.api_key:
34
+ self._driver_config.api_key = self._api_key
35
+ # Set DeepSeek public endpoint as default base_url if not provided
36
+ if not getattr(self._driver_config, "base_url", None):
37
+ self._driver_config.base_url = "https://api.deepseek.com/v1"
38
+ self.fill_missing_device_info(self._driver_config)
39
+ self._driver = None # to be provided by factory/agent
40
+
41
+ @property
42
+ def driver(self) -> OpenAIModelDriver:
43
+ if not self.available:
44
+ raise ImportError(f"OpenAIProvider unavailable: {self.unavailable_reason}")
45
+ return self._driver
46
+
47
+ @property
48
+ def available(self):
49
+ return available
50
+
51
+ @property
52
+ def unavailable_reason(self):
53
+ return unavailable_reason
54
+
55
+ def create_driver(self):
56
+ """
57
+ Creates and returns a new OpenAIModelDriver instance with input/output queues.
58
+ """
59
+ driver = OpenAIModelDriver(
60
+ tools_adapter=self._tools_adapter, provider_name=self.name
61
+ )
62
+ driver.config = self._driver_config
63
+ # NOTE: The caller is responsible for calling driver.start() if background processing is needed.
64
+ return driver
65
+
66
+ def create_agent(self, tools_adapter=None, agent_name: str = None, **kwargs):
67
+ from janito.llm.agent import LLMAgent
68
+
69
+ # Always create a new driver with the passed-in tools_adapter
70
+ if tools_adapter is None:
71
+ tools_adapter = get_local_tools_adapter()
72
+ # Should use new-style driver construction via queues/factory (handled elsewhere)
73
+ raise NotImplementedError(
74
+ "create_agent must be constructed via new factory using input/output queues and config."
75
+ )
76
+
77
+ @property
78
+ def model_name(self):
79
+ return self._driver_config.model
80
+
81
+ @property
82
+ def driver_config(self):
83
+ """Public, read-only access to the provider's LLMDriverConfig object."""
84
+ return self._driver_config
85
+
86
+ def execute_tool(self, tool_name: str, event_bus, *args, **kwargs):
87
+ self._tools_adapter.event_bus = event_bus
88
+ return self._tools_adapter.execute_by_name(tool_name, *args, **kwargs)
89
+
90
+
91
+ LLMProviderRegistry.register(DeepseekProvider.name, DeepseekProvider)
@@ -1,40 +1,32 @@
1
1
  from janito.llm.model import LLMModelInfo
2
2
 
3
3
  MODEL_SPECS = {
4
- "gemini-2.5-pro-preview-05-06": LLMModelInfo(
5
- name="gemini-2.5-pro-preview-05-06",
6
- context=131072,
7
- max_input=131072,
8
- max_cot="N/A",
9
- max_response=32768,
10
- thinking_supported=True,
11
- default_temp=0.2,
4
+ "gemini-2.5-flash": LLMModelInfo(
5
+ name="gemini-2.5-flash",
6
+ other={"description": "Google Gemini 2.5 Flash (OpenAI-compatible endpoint)"},
12
7
  open="google",
13
- driver="GoogleGenaiModelDriver",
14
- other={"preview": True},
15
- ),
16
- "gemini-2.5-flash-preview-05-20": LLMModelInfo(
17
- name="gemini-2.5-flash-preview-05-20",
18
- context=1000000,
19
- max_input=1000000,
20
- max_cot="N/A",
21
- max_response=65536,
8
+ driver="OpenAIModelDriver",
9
+ max_response=8192,
10
+ max_cot=24576,
22
11
  thinking_supported=True,
23
- default_temp=0.2,
24
- open="google",
25
- driver="GoogleGenaiModelDriver",
26
- other={"preview": True, "flash": True},
27
12
  ),
28
- "gemini-2.5-flash-preview-04-17": LLMModelInfo(
29
- name="gemini-2.5-flash-preview-04-17",
30
- context=1000000,
31
- max_input=1000000,
32
- max_cot="N/A",
13
+ "gemini-2.5-pro": LLMModelInfo(
14
+ name="gemini-2.5-pro",
15
+ other={"description": "Google Gemini 2.5 Pro (OpenAI-compatible endpoint)"},
16
+ open="google",
17
+ driver="OpenAIModelDriver",
33
18
  max_response=65536,
19
+ max_cot=196608,
34
20
  thinking_supported=True,
35
- default_temp=0.2,
21
+ ),
22
+ "gemini-2.5-flash-lite-preview-06-17": LLMModelInfo(
23
+ name="gemini-2.5-flash-lite-preview-06-17",
24
+ other={"description": "Google Gemini 2.5 Flash-Lite Preview (OpenAI-compatible endpoint)"},
36
25
  open="google",
37
- driver="GoogleGenaiModelDriver",
38
- other={"preview": True, "flash": True},
26
+ driver="OpenAIModelDriver",
27
+ max_response=64000,
28
+ max_cot=192000,
29
+ thinking_supported=True,
39
30
  ),
31
+ # Add more Gemini models as needed
40
32
  }
@@ -2,64 +2,75 @@ from janito.llm.provider import LLMProvider
2
2
  from janito.llm.model import LLMModelInfo
3
3
  from janito.llm.auth import LLMAuthManager
4
4
  from janito.llm.driver_config import LLMDriverConfig
5
- from janito.drivers.google_genai.driver import GoogleGenaiModelDriver
6
- from janito.tools.adapters.local.adapter import LocalToolsAdapter
5
+ from janito.drivers.openai.driver import OpenAIModelDriver
6
+ from janito.tools import get_local_tools_adapter
7
7
  from janito.providers.registry import LLMProviderRegistry
8
+ from queue import Queue
8
9
 
9
- from .model_info import MODEL_SPECS
10
-
11
- from janito.drivers.google_genai.driver import GoogleGenaiModelDriver
12
-
13
- available = GoogleGenaiModelDriver.available
14
- unavailable_reason = GoogleGenaiModelDriver.unavailable_reason
15
- maintainer = "Needs maintainer"
16
-
10
+ # Import Google Gemini model specs (to be created or imported as needed)
11
+ try:
12
+ from .model_info import MODEL_SPECS
13
+ except ImportError:
14
+ MODEL_SPECS = {}
17
15
 
18
16
  class GoogleProvider(LLMProvider):
19
- MODEL_SPECS = MODEL_SPECS
20
- maintainer = "Needs maintainer"
21
- """
22
- Provider for Google LLMs via google-google.
23
- Default model: 'gemini-2.5-pro-preview-05-06'.
24
- """
25
17
  name = "google"
26
- DEFAULT_MODEL = "gemini-2.5-flash-preview-04-17"
18
+ maintainer = "João Pinto <lamego.pinto@gmail.com>"
19
+ MODEL_SPECS = MODEL_SPECS
20
+ DEFAULT_MODEL = "gemini-2.5-flash" # Default Gemini model
27
21
 
28
- def __init__(self, config: LLMDriverConfig = None):
22
+ def __init__(
23
+ self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
24
+ ):
29
25
  if not self.available:
30
26
  self._driver = None
31
- return
32
- self._auth_manager = LLMAuthManager()
33
- self._api_key = self._auth_manager.get_credentials(type(self).name)
34
- self._tools_adapter = LocalToolsAdapter()
35
- self._info = config or LLMDriverConfig(model=None)
36
- if not self._info.model:
37
- self._info.model = self.DEFAULT_MODEL
38
- if not self._info.api_key:
39
- self._info.api_key = self._api_key
40
- self.fill_missing_device_info(self._info)
41
- self._driver = GoogleGenaiModelDriver(tools_adapter=self._tools_adapter)
27
+ else:
28
+ self.auth_manager = auth_manager or LLMAuthManager()
29
+ self._api_key = self.auth_manager.get_credentials(type(self).name)
30
+ self._tools_adapter = get_local_tools_adapter()
31
+ self._driver_config = config or LLMDriverConfig(model=None)
32
+ # Only set default if model is not set by CLI/config
33
+ if not getattr(self._driver_config, 'model', None):
34
+ self._driver_config.model = self.DEFAULT_MODEL
35
+ if not self._driver_config.api_key:
36
+ self._driver_config.api_key = self._api_key
37
+ # Set the Gemini API endpoint for OpenAI compatibility
38
+ self._driver_config.base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
39
+ self.fill_missing_device_info(self._driver_config)
40
+ self._driver = None # to be provided by factory/agent
42
41
 
43
42
  @property
44
- def driver(self) -> GoogleGenaiModelDriver:
43
+ def driver(self) -> OpenAIModelDriver:
45
44
  if not self.available:
46
- raise ImportError(f"GoogleProvider unavailable: {self.unavailable_reason}")
45
+ raise ImportError(f"GoogleOpenAIProvider unavailable: {self.unavailable_reason}")
47
46
  return self._driver
48
47
 
49
48
  @property
50
49
  def available(self):
51
- return available
50
+ return OpenAIModelDriver.available
52
51
 
53
52
  @property
54
53
  def unavailable_reason(self):
55
- return unavailable_reason
54
+ return OpenAIModelDriver.unavailable_reason
55
+
56
+ def create_driver(self):
57
+ """
58
+ Creates and returns a new OpenAIModelDriver instance configured for Gemini API.
59
+ """
60
+ driver = OpenAIModelDriver(
61
+ tools_adapter=self._tools_adapter, provider_name=self.name
62
+ )
63
+ driver.config = self._driver_config
64
+ return driver
56
65
 
57
- def create_agent(self, tools_adapter=None, agent_name: str = None, **kwargs):
58
- from janito.llm.agent import LLMAgent
66
+ @property
67
+ def model_name(self):
68
+ return self._driver_config.model
59
69
 
60
- # Always create a new driver with the passed-in tools_adapter
61
- driver = GoogleGenaiModelDriver(tools_adapter=tools_adapter)
62
- return LLMAgent(self, tools_adapter, agent_name=agent_name, **kwargs)
70
+ @property
71
+ def driver_config(self):
72
+ """Public, read-only access to the provider's LLMDriverConfig object."""
73
+ return self._driver_config
63
74
 
64
75
  def execute_tool(self, tool_name: str, event_bus, *args, **kwargs):
65
76
  self._tools_adapter.event_bus = event_bus
@@ -3,7 +3,7 @@ from janito.llm.model import LLMModelInfo
3
3
  from janito.llm.auth import LLMAuthManager
4
4
  from janito.llm.driver_config import LLMDriverConfig
5
5
  from janito.drivers.mistralai.driver import MistralAIModelDriver
6
- from janito.tools.adapters.local.adapter import LocalToolsAdapter
6
+ from janito.tools import get_local_tools_adapter
7
7
  from janito.providers.registry import LLMProviderRegistry
8
8
 
9
9
  from .model_info import MODEL_SPECS
@@ -29,7 +29,7 @@ class MistralAIProvider(LLMProvider):
29
29
  return
30
30
  self.auth_manager = auth_manager or LLMAuthManager()
31
31
  self._api_key = self.auth_manager.get_credentials(type(self).name)
32
- self._tools_adapter = LocalToolsAdapter()
32
+ self._tools_adapter = get_local_tools_adapter()
33
33
  self._info = config or LLMDriverConfig(model=None)
34
34
  if not self._info.model:
35
35
  self._info.model = self.DEFAULT_MODEL
@@ -111,17 +111,6 @@ MODEL_SPECS = {
111
111
  open="openai",
112
112
  driver="OpenAIModelDriver",
113
113
  ),
114
- "o4-mini-high": LLMModelInfo(
115
- name="o4-mini-high",
116
- context=200000,
117
- max_input=100000,
118
- max_cot="N/A",
119
- max_response=100000,
120
- thinking_supported=True,
121
- default_temp=0.2,
122
- open="openai",
123
- driver="OpenAIModelDriver",
124
- ),
125
114
  # duplicated gpt-4-turbo with minimal properties for distinction
126
115
  "gpt-4-turbo-alt": LLMModelInfo(
127
116
  name="gpt-4-turbo",
@@ -17,7 +17,7 @@ class OpenAIProvider(LLMProvider):
17
17
  maintainer = "João Pinto <lamego.pinto@gmail.com>"
18
18
  MODEL_SPECS = MODEL_SPECS
19
19
  DEFAULT_MODEL = (
20
- "gpt-4.1" # Options: gpt-4.1, gpt-4o, o3-mini, o4-mini, o4-mini-high
20
+ "gpt-4.1" # Options: gpt-4.1, gpt-4o, o3-mini, o4-mini,
21
21
  )
22
22
 
23
23
  def __init__(
@@ -1,14 +1,13 @@
1
1
  # Provider static metadata registry for listing purposes (name, maintainer, and future fields)
2
2
  STATIC_PROVIDER_METADATA = {
3
3
  "openai": {
4
+ },
5
+ "google": {
4
6
  "maintainer": "João Pinto <lamego.pinto@gmail.com>",
5
7
  },
6
8
  "azure_openai": {
7
9
  "maintainer": "João Pinto <lamego.pinto@gmail.com>",
8
10
  },
9
- "google": {
10
- "maintainer": "Needs maintainer",
11
- },
12
11
  "mistralai": {
13
12
  "maintainer": "Needs maintainer",
14
13
  },
@@ -1,26 +1,26 @@
1
- from typing import Type, Dict
2
- from janito.llm.provider import LLMProvider
3
-
4
-
5
- class LLMProviderRegistry:
6
- """
7
- Registry for LLM provider classes.
8
- """
9
-
10
- _providers: Dict[str, Type[LLMProvider]] = {}
11
-
12
- @classmethod
13
- def register(cls, name: str, provider_cls: Type[LLMProvider]):
14
- if name in cls._providers:
15
- raise ValueError(f"Provider '{name}' is already registered.")
16
- cls._providers[name] = provider_cls
17
-
18
- @classmethod
19
- def get(cls, name: str) -> Type[LLMProvider]:
20
- if name not in cls._providers:
21
- raise KeyError(f"Provider '{name}' is not registered.")
22
- return cls._providers[name]
23
-
24
- @classmethod
25
- def list_providers(cls):
26
- return list(cls._providers.keys())
1
+ from typing import Type, Dict
2
+ from janito.llm.provider import LLMProvider
3
+
4
+
5
+ class LLMProviderRegistry:
6
+ """
7
+ Registry for LLM provider classes.
8
+ """
9
+
10
+ _providers: Dict[str, Type[LLMProvider]] = {}
11
+
12
+ @classmethod
13
+ def register(cls, name: str, provider_cls: Type[LLMProvider]):
14
+ if name in cls._providers:
15
+ raise ValueError(f"Provider '{name}' is already registered.")
16
+ cls._providers[name] = provider_cls
17
+
18
+ @classmethod
19
+ def get(cls, name: str) -> Type[LLMProvider]:
20
+ if name not in cls._providers:
21
+ return None
22
+ return cls._providers[name]
23
+
24
+ @classmethod
25
+ def list_providers(cls):
26
+ return list(cls._providers.keys())
@@ -1 +1 @@
1
- # Tools providers package: for plug-and-play tool collections, integrations, and adapters.
1
+ # Tools providers package: for plug-and-play tool collections, integrations, and adapters.
@@ -1,62 +1,62 @@
1
- from .adapter import LocalToolsAdapter
2
-
3
- from .ask_user import AskUserTool
4
- from .copy_file import CopyFileTool
5
- from .create_directory import CreateDirectoryTool
6
- from .create_file import CreateFileTool
7
- from .fetch_url import FetchUrlTool
8
- from .find_files import FindFilesTool
9
- from .view_file import ViewFileTool
10
- from .move_file import MoveFileTool
11
- from .open_url import OpenUrlTool
12
- from .open_html_in_browser import OpenHtmlInBrowserTool
13
- from .python_code_run import PythonCodeRunTool
14
- from .python_command_run import PythonCommandRunTool
15
- from .python_file_run import PythonFileRunTool
16
- from .remove_directory import RemoveDirectoryTool
17
- from .remove_file import RemoveFileTool
18
- from .replace_text_in_file import ReplaceTextInFileTool
19
- from .run_bash_command import RunBashCommandTool
20
- from .run_powershell_command import RunPowershellCommandTool
21
- from .get_file_outline.core import GetFileOutlineTool
22
- from .get_file_outline.search_outline import SearchOutlineTool
23
- from .search_text.core import SearchTextTool
24
- from .validate_file_syntax.core import ValidateFileSyntaxTool
25
-
26
- # Singleton tools adapter with all standard tools registered
27
- import os
28
- local_tools_adapter = LocalToolsAdapter(workdir=os.getcwd())
29
-
30
- def get_local_tools_adapter(workdir=None):
31
- import os
32
- return LocalToolsAdapter(workdir=workdir or os.getcwd())
33
-
34
- # Register tools
35
- for tool_class in [
36
- AskUserTool,
37
- CopyFileTool,
38
- CreateDirectoryTool,
39
- CreateFileTool,
40
- FetchUrlTool,
41
- FindFilesTool,
42
- ViewFileTool,
43
- MoveFileTool,
44
- OpenUrlTool,
45
- OpenHtmlInBrowserTool,
46
- PythonCodeRunTool,
47
- PythonCommandRunTool,
48
- PythonFileRunTool,
49
- RemoveDirectoryTool,
50
- RemoveFileTool,
51
- ReplaceTextInFileTool,
52
- RunBashCommandTool,
53
- RunPowershellCommandTool,
54
- GetFileOutlineTool,
55
- SearchOutlineTool,
56
- SearchTextTool,
57
- ValidateFileSyntaxTool,
58
- ]:
59
- local_tools_adapter.register_tool(tool_class)
60
-
61
- # DEBUG: Print registered tools at startup
62
-
1
+ from .adapter import LocalToolsAdapter
2
+
3
+ from .ask_user import AskUserTool
4
+ from .copy_file import CopyFileTool
5
+ from .create_directory import CreateDirectoryTool
6
+ from .create_file import CreateFileTool
7
+ from .fetch_url import FetchUrlTool
8
+ from .find_files import FindFilesTool
9
+ from .view_file import ViewFileTool
10
+ from .move_file import MoveFileTool
11
+ from .open_url import OpenUrlTool
12
+ from .open_html_in_browser import OpenHtmlInBrowserTool
13
+ from .python_code_run import PythonCodeRunTool
14
+ from .python_command_run import PythonCommandRunTool
15
+ from .python_file_run import PythonFileRunTool
16
+ from .remove_directory import RemoveDirectoryTool
17
+ from .remove_file import RemoveFileTool
18
+ from .replace_text_in_file import ReplaceTextInFileTool
19
+ from .run_bash_command import RunBashCommandTool
20
+ from .run_powershell_command import RunPowershellCommandTool
21
+ from .get_file_outline.core import GetFileOutlineTool
22
+ from .get_file_outline.search_outline import SearchOutlineTool
23
+ from .search_text.core import SearchTextTool
24
+ from .validate_file_syntax.core import ValidateFileSyntaxTool
25
+
26
+ # Singleton tools adapter with all standard tools registered
27
+ import os
28
+ local_tools_adapter = LocalToolsAdapter(workdir=os.getcwd())
29
+
30
+ def get_local_tools_adapter(workdir=None):
31
+ import os
32
+ return LocalToolsAdapter(workdir=workdir or os.getcwd())
33
+
34
+ # Register tools
35
+ for tool_class in [
36
+ AskUserTool,
37
+ CopyFileTool,
38
+ CreateDirectoryTool,
39
+ CreateFileTool,
40
+ FetchUrlTool,
41
+ FindFilesTool,
42
+ ViewFileTool,
43
+ MoveFileTool,
44
+ OpenUrlTool,
45
+ OpenHtmlInBrowserTool,
46
+ PythonCodeRunTool,
47
+ PythonCommandRunTool,
48
+ PythonFileRunTool,
49
+ RemoveDirectoryTool,
50
+ RemoveFileTool,
51
+ ReplaceTextInFileTool,
52
+ RunBashCommandTool,
53
+ RunPowershellCommandTool,
54
+ GetFileOutlineTool,
55
+ SearchOutlineTool,
56
+ SearchTextTool,
57
+ ValidateFileSyntaxTool,
58
+ ]:
59
+ local_tools_adapter.register_tool(tool_class)
60
+
61
+ # DEBUG: Print registered tools at startup
62
+