janito 2.0.1__tar.gz → 2.1.1__tar.gz

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 (186) hide show
  1. {janito-2.0.1 → janito-2.1.1}/PKG-INFO +1 -1
  2. {janito-2.0.1 → janito-2.1.1}/janito/__init__.py +1 -1
  3. {janito-2.0.1 → janito-2.1.1}/janito/cli/config.py +0 -1
  4. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/runner.py +12 -9
  5. {janito-2.0.1 → janito-2.1.1}/janito/cli/main_cli.py +8 -0
  6. janito-2.1.1/janito/drivers/azure_openai/driver.py +55 -0
  7. {janito-2.0.1 → janito-2.1.1}/janito/llm/provider.py +9 -0
  8. {janito-2.0.1 → janito-2.1.1}/janito/providers/azure_openai/provider.py +6 -0
  9. {janito-2.0.1 → janito-2.1.1}/janito/providers/deepseek/model_info.py +2 -2
  10. {janito-2.0.1 → janito-2.1.1}/janito/providers/deepseek/provider.py +1 -1
  11. {janito-2.0.1 → janito-2.1.1}/janito/tools/__init__.py +6 -2
  12. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/__init__.py +9 -1
  13. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/adapter.py +5 -1
  14. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/ask_user.py +2 -15
  15. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/open_html_in_browser.py +15 -6
  16. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/python_code_run.py +1 -0
  17. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/python_command_run.py +1 -0
  18. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/python_file_run.py +1 -0
  19. {janito-2.0.1 → janito-2.1.1}/janito/version.py +1 -1
  20. {janito-2.0.1 → janito-2.1.1}/janito.egg-info/PKG-INFO +1 -1
  21. {janito-2.0.1 → janito-2.1.1}/pyproject.toml +1 -1
  22. janito-2.0.1/janito/drivers/azure_openai/driver.py +0 -36
  23. {janito-2.0.1 → janito-2.1.1}/README.md +0 -0
  24. {janito-2.0.1 → janito-2.1.1}/janito/__main__.py +0 -0
  25. {janito-2.0.1 → janito-2.1.1}/janito/agent/setup_agent.py +0 -0
  26. {janito-2.0.1 → janito-2.1.1}/janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +0 -0
  27. {janito-2.0.1 → janito-2.1.1}/janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +0 -0
  28. {janito-2.0.1 → janito-2.1.1}/janito/cli/__init__.py +0 -0
  29. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/bindings.py +0 -0
  30. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/chat_entry.py +0 -0
  31. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/prompt_style.py +0 -0
  32. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/session.py +0 -0
  33. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/autocomplete.py +0 -0
  34. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/__init__.py +0 -0
  35. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/base.py +0 -0
  36. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/clear.py +0 -0
  37. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/conversation_restart.py +0 -0
  38. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/edit.py +0 -0
  39. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/help.py +0 -0
  40. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/history_view.py +0 -0
  41. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/lang.py +0 -0
  42. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/last.py +0 -0
  43. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/livelogs.py +0 -0
  44. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/multi.py +0 -0
  45. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/prompt.py +0 -0
  46. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/role.py +0 -0
  47. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/session.py +0 -0
  48. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/session_control.py +0 -0
  49. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/termweb_log.py +0 -0
  50. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/tools.py +0 -0
  51. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/utility.py +0 -0
  52. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/commands/verbose.py +0 -0
  53. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/input_history.py +0 -0
  54. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/session/__init__.py +0 -0
  55. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/session/history.py +0 -0
  56. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/shell/session/manager.py +0 -0
  57. {janito-2.0.1 → janito-2.1.1}/janito/cli/chat_mode/toolbar.py +0 -0
  58. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/list_models.py +0 -0
  59. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/list_providers.py +0 -0
  60. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/list_tools.py +0 -0
  61. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/model_selection.py +0 -0
  62. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/model_utils.py +0 -0
  63. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/set_api_key.py +0 -0
  64. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/show_config.py +0 -0
  65. {janito-2.0.1 → janito-2.1.1}/janito/cli/cli_commands/show_system_prompt.py +0 -0
  66. {janito-2.0.1 → janito-2.1.1}/janito/cli/console.py +0 -0
  67. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/__init__.py +0 -0
  68. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/event_logger.py +0 -0
  69. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/getters.py +0 -0
  70. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/setters.py +0 -0
  71. {janito-2.0.1 → janito-2.1.1}/janito/cli/core/unsetters.py +0 -0
  72. {janito-2.0.1 → janito-2.1.1}/janito/cli/main.py +0 -0
  73. {janito-2.0.1 → janito-2.1.1}/janito/cli/prompt_core.py +0 -0
  74. {janito-2.0.1 → janito-2.1.1}/janito/cli/prompt_handler.py +0 -0
  75. {janito-2.0.1 → janito-2.1.1}/janito/cli/rich_terminal_reporter.py +0 -0
  76. {janito-2.0.1 → janito-2.1.1}/janito/cli/single_shot_mode/__init__.py +0 -0
  77. {janito-2.0.1 → janito-2.1.1}/janito/cli/single_shot_mode/handler.py +0 -0
  78. {janito-2.0.1 → janito-2.1.1}/janito/cli/termweb_starter.py +0 -0
  79. {janito-2.0.1 → janito-2.1.1}/janito/cli/utils.py +0 -0
  80. {janito-2.0.1 → janito-2.1.1}/janito/cli/verbose_output.py +0 -0
  81. {janito-2.0.1 → janito-2.1.1}/janito/config.py +0 -0
  82. {janito-2.0.1 → janito-2.1.1}/janito/config_manager.py +0 -0
  83. {janito-2.0.1 → janito-2.1.1}/janito/conversation_history.py +0 -0
  84. {janito-2.0.1 → janito-2.1.1}/janito/dir_walk_utils.py +0 -0
  85. {janito-2.0.1 → janito-2.1.1}/janito/driver_events.py +0 -0
  86. {janito-2.0.1 → janito-2.1.1}/janito/drivers/anthropic/driver.py +0 -0
  87. {janito-2.0.1 → janito-2.1.1}/janito/drivers/driver_registry.py +0 -0
  88. {janito-2.0.1 → janito-2.1.1}/janito/drivers/google_genai/driver.py +0 -0
  89. {janito-2.0.1 → janito-2.1.1}/janito/drivers/google_genai/schema_generator.py +0 -0
  90. {janito-2.0.1 → janito-2.1.1}/janito/drivers/mistralai/driver.py +0 -0
  91. {janito-2.0.1 → janito-2.1.1}/janito/drivers/openai/driver.py +0 -0
  92. {janito-2.0.1 → janito-2.1.1}/janito/event_bus/__init__.py +0 -0
  93. {janito-2.0.1 → janito-2.1.1}/janito/event_bus/bus.py +0 -0
  94. {janito-2.0.1 → janito-2.1.1}/janito/event_bus/event.py +0 -0
  95. {janito-2.0.1 → janito-2.1.1}/janito/event_bus/handler.py +0 -0
  96. {janito-2.0.1 → janito-2.1.1}/janito/event_bus/queue_bus.py +0 -0
  97. {janito-2.0.1 → janito-2.1.1}/janito/exceptions.py +0 -0
  98. {janito-2.0.1 → janito-2.1.1}/janito/formatting.py +0 -0
  99. {janito-2.0.1 → janito-2.1.1}/janito/formatting_token.py +0 -0
  100. {janito-2.0.1 → janito-2.1.1}/janito/gitignore_utils.py +0 -0
  101. {janito-2.0.1 → janito-2.1.1}/janito/i18n/__init__.py +0 -0
  102. {janito-2.0.1 → janito-2.1.1}/janito/i18n/messages.py +0 -0
  103. {janito-2.0.1 → janito-2.1.1}/janito/i18n/pt.py +0 -0
  104. {janito-2.0.1 → janito-2.1.1}/janito/llm/__init__.py +0 -0
  105. {janito-2.0.1 → janito-2.1.1}/janito/llm/agent.py +0 -0
  106. {janito-2.0.1 → janito-2.1.1}/janito/llm/auth.py +0 -0
  107. {janito-2.0.1 → janito-2.1.1}/janito/llm/driver.py +0 -0
  108. {janito-2.0.1 → janito-2.1.1}/janito/llm/driver_config.py +0 -0
  109. {janito-2.0.1 → janito-2.1.1}/janito/llm/driver_config_builder.py +0 -0
  110. {janito-2.0.1 → janito-2.1.1}/janito/llm/driver_input.py +0 -0
  111. {janito-2.0.1 → janito-2.1.1}/janito/llm/message_parts.py +0 -0
  112. {janito-2.0.1 → janito-2.1.1}/janito/llm/model.py +0 -0
  113. {janito-2.0.1 → janito-2.1.1}/janito/perf_singleton.py +0 -0
  114. {janito-2.0.1 → janito-2.1.1}/janito/performance_collector.py +0 -0
  115. {janito-2.0.1 → janito-2.1.1}/janito/platform_discovery.py +0 -0
  116. {janito-2.0.1 → janito-2.1.1}/janito/provider_config.py +0 -0
  117. {janito-2.0.1 → janito-2.1.1}/janito/provider_registry.py +0 -0
  118. {janito-2.0.1 → janito-2.1.1}/janito/providers/__init__.py +0 -0
  119. {janito-2.0.1 → janito-2.1.1}/janito/providers/anthropic/model_info.py +0 -0
  120. {janito-2.0.1 → janito-2.1.1}/janito/providers/anthropic/provider.py +0 -0
  121. {janito-2.0.1 → janito-2.1.1}/janito/providers/azure_openai/model_info.py +0 -0
  122. {janito-2.0.1 → janito-2.1.1}/janito/providers/deepseek/__init__.py +0 -0
  123. {janito-2.0.1 → janito-2.1.1}/janito/providers/google/__init__.py +0 -0
  124. {janito-2.0.1 → janito-2.1.1}/janito/providers/google/model_info.py +0 -0
  125. {janito-2.0.1 → janito-2.1.1}/janito/providers/google/provider.py +0 -0
  126. {janito-2.0.1 → janito-2.1.1}/janito/providers/mistralai/model_info.py +0 -0
  127. {janito-2.0.1 → janito-2.1.1}/janito/providers/mistralai/provider.py +0 -0
  128. {janito-2.0.1 → janito-2.1.1}/janito/providers/openai/__init__.py +0 -0
  129. {janito-2.0.1 → janito-2.1.1}/janito/providers/openai/model_info.py +0 -0
  130. {janito-2.0.1 → janito-2.1.1}/janito/providers/openai/provider.py +0 -0
  131. {janito-2.0.1 → janito-2.1.1}/janito/providers/openai/schema_generator.py +0 -0
  132. {janito-2.0.1 → janito-2.1.1}/janito/providers/provider_static_info.py +0 -0
  133. {janito-2.0.1 → janito-2.1.1}/janito/providers/registry.py +0 -0
  134. {janito-2.0.1 → janito-2.1.1}/janito/report_events.py +0 -0
  135. {janito-2.0.1 → janito-2.1.1}/janito/termweb/app.py +0 -0
  136. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/__init__.py +0 -0
  137. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/copy_file.py +0 -0
  138. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/create_directory.py +0 -0
  139. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/create_file.py +0 -0
  140. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/delete_text_in_file.py +0 -0
  141. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/fetch_url.py +0 -0
  142. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/find_files.py +0 -0
  143. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/__init__.py +0 -0
  144. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/core.py +0 -0
  145. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/markdown_outline.py +0 -0
  146. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/python_outline.py +0 -0
  147. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/python_outline_v2.py +0 -0
  148. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/get_file_outline/search_outline.py +0 -0
  149. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/move_file.py +0 -0
  150. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/open_url.py +0 -0
  151. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/remove_directory.py +0 -0
  152. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/remove_file.py +0 -0
  153. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/replace_text_in_file.py +0 -0
  154. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/run_bash_command.py +0 -0
  155. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/run_powershell_command.py +0 -0
  156. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/search_text/__init__.py +0 -0
  157. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/search_text/core.py +0 -0
  158. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/search_text/match_lines.py +0 -0
  159. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/search_text/pattern_utils.py +0 -0
  160. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/search_text/traverse_directory.py +0 -0
  161. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/__init__.py +0 -0
  162. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/core.py +0 -0
  163. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/css_validator.py +0 -0
  164. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/html_validator.py +0 -0
  165. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/js_validator.py +0 -0
  166. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/json_validator.py +0 -0
  167. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/markdown_validator.py +0 -0
  168. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/ps1_validator.py +0 -0
  169. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/python_validator.py +0 -0
  170. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/xml_validator.py +0 -0
  171. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/validate_file_syntax/yaml_validator.py +0 -0
  172. {janito-2.0.1 → janito-2.1.1}/janito/tools/adapters/local/view_file.py +0 -0
  173. {janito-2.0.1 → janito-2.1.1}/janito/tools/inspect_registry.py +0 -0
  174. {janito-2.0.1 → janito-2.1.1}/janito/tools/tool_base.py +0 -0
  175. {janito-2.0.1 → janito-2.1.1}/janito/tools/tool_events.py +0 -0
  176. {janito-2.0.1 → janito-2.1.1}/janito/tools/tool_run_exception.py +0 -0
  177. {janito-2.0.1 → janito-2.1.1}/janito/tools/tool_use_tracker.py +0 -0
  178. {janito-2.0.1 → janito-2.1.1}/janito/tools/tool_utils.py +0 -0
  179. {janito-2.0.1 → janito-2.1.1}/janito/tools/tools_adapter.py +0 -0
  180. {janito-2.0.1 → janito-2.1.1}/janito/tools/tools_schema.py +0 -0
  181. {janito-2.0.1 → janito-2.1.1}/janito/utils.py +0 -0
  182. {janito-2.0.1 → janito-2.1.1}/janito.egg-info/SOURCES.txt +0 -0
  183. {janito-2.0.1 → janito-2.1.1}/janito.egg-info/dependency_links.txt +0 -0
  184. {janito-2.0.1 → janito-2.1.1}/janito.egg-info/entry_points.txt +0 -0
  185. {janito-2.0.1 → janito-2.1.1}/janito.egg-info/top_level.txt +0 -0
  186. {janito-2.0.1 → janito-2.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.0.1
3
+ Version: 2.1.1
4
4
  Summary: A new Python package called janito.
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  Project-URL: Homepage, https://github.com/janito-dev/janito
@@ -3,4 +3,4 @@ janito: A Python package for managing and interacting with Large Language Model
3
3
  Provides a CLI for credential management and an extensible driver system for LLMs.
4
4
  """
5
5
 
6
- __version__ = "2.0.1"
6
+ __version__ = "2.1.1"
@@ -8,7 +8,6 @@ CONFIG_OPTIONS = {
8
8
  "role": "Role description for the Agent Profile (e.g., 'software engineer')",
9
9
  "temperature": "Sampling temperature (float, e.g., 0.0 - 2.0)",
10
10
  "max_tokens": "Maximum tokens for model response (int)",
11
- "use_azure_openai": "Whether to use Azure OpenAI client (default: False)",
12
11
  "template": "Template context dictionary for Agent Profile prompt rendering (nested)",
13
12
  "profile": "Agent Profile name (only 'base' is supported)",
14
13
  }
@@ -66,16 +66,18 @@ def prepare_llm_driver_config(args, modifiers):
66
66
  provider_instance = None
67
67
  try:
68
68
  provider_instance = ProviderRegistry().get_instance(provider)
69
- available_models = [
70
- m["name"]
71
- for m in provider_instance.get_model_info().values()
72
- if isinstance(m, dict) and "name" in m
73
- ]
74
- if model not in available_models:
69
+ if not provider_instance.is_model_available(model):
75
70
  print(
76
71
  f"Error: Model '{model}' is not available for provider '{provider}'."
77
72
  )
78
- print(f"Available models: {', '.join(available_models)}")
73
+ # Optionally, print available models if possible
74
+ if hasattr(provider_instance, 'get_model_info'):
75
+ available_models = [
76
+ m["name"]
77
+ for m in provider_instance.get_model_info().values()
78
+ if isinstance(m, dict) and "name" in m
79
+ ]
80
+ print(f"Available models: {', '.join(available_models)}")
79
81
  return provider, None, None
80
82
  except Exception as e:
81
83
  print(f"Error validating model for provider '{provider}': {e}")
@@ -98,11 +100,12 @@ def handle_runner(args, provider, llm_driver_config, agent_role, verbose_tools=F
98
100
  # Patch: disable execution/run tools if not enabled
99
101
  if not exec_enabled:
100
102
  import janito.tools
101
- adapter = janito.tools.get_local_tools_adapter()
103
+ adapter = janito.tools.get_local_tools_adapter(workdir=getattr(args, "workdir", None))
102
104
  if hasattr(adapter, "disable_execution_tools"):
103
105
  adapter.disable_execution_tools()
104
106
  else:
105
- pass
107
+ import janito.tools
108
+ adapter = janito.tools.get_local_tools_adapter(workdir=getattr(args, "workdir", None))
106
109
 
107
110
  provider_instance = ProviderRegistry().get_instance(provider, llm_driver_config)
108
111
  mode = get_prompt_mode(args)
@@ -13,6 +13,14 @@ from janito.cli.core.event_logger import (
13
13
  )
14
14
 
15
15
  definition = [
16
+ (
17
+ ["-W", "--workdir"],
18
+ {
19
+ "metavar": "WORKDIR",
20
+ "help": "Working directory to chdir to before tool execution",
21
+ "default": None,
22
+ },
23
+ ),
16
24
  (
17
25
  ["--verbose-api"],
18
26
  {
@@ -0,0 +1,55 @@
1
+ from janito.drivers.openai.driver import OpenAIModelDriver
2
+
3
+ # Safe import of AzureOpenAI SDK
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)"
12
+
13
+ from janito.llm.driver_config import LLMDriverConfig
14
+
15
+
16
+ class AzureOpenAIModelDriver(OpenAIModelDriver):
17
+ available = DRIVER_AVAILABLE
18
+ unavailable_reason = DRIVER_UNAVAILABLE_REASON
19
+
20
+ @classmethod
21
+ def is_available(cls):
22
+ return cls.available
23
+
24
+ required_config = {"base_url"} # Update key as used in your config logic
25
+
26
+ def __init__(self, tools_adapter=None):
27
+ if not self.available:
28
+ raise ImportError(
29
+ f"AzureOpenAIModelDriver unavailable: {self.unavailable_reason}"
30
+ )
31
+ # Do NOT call super().__init__ if Azure SDK is not available
32
+ OpenAIModelDriver.__init__(self, tools_adapter=tools_adapter)
33
+ self.azure_endpoint = None
34
+ self.api_version = None
35
+ self.api_key = None
36
+
37
+ def _instantiate_openai_client(self, config):
38
+ try:
39
+ from openai import AzureOpenAI
40
+ api_key_display = str(config.api_key)
41
+ if api_key_display and len(api_key_display) > 8:
42
+ api_key_display = api_key_display[:4] + "..." + api_key_display[-4:]
43
+ client_kwargs = {
44
+ "api_key": config.api_key,
45
+ "azure_endpoint": getattr(config, "base_url", None),
46
+ "api_version": config.extra.get("api_version", "2023-05-15"),
47
+ }
48
+ client = AzureOpenAI(**client_kwargs)
49
+ return client
50
+ except Exception as e:
51
+ print(f"[ERROR] Exception during AzureOpenAI client instantiation: {e}", flush=True)
52
+ import traceback
53
+ print(traceback.format_exc(), flush=True)
54
+ raise
55
+
@@ -93,6 +93,15 @@ class LLMProvider(ABC):
93
93
  def driver(self) -> LLMDriver:
94
94
  pass
95
95
 
96
+ def is_model_available(self, model_name):
97
+ """
98
+ Returns True if the given model is available for this provider.
99
+ Default implementation checks MODEL_SPECS; override for dynamic providers.
100
+ """
101
+ if not hasattr(self, "MODEL_SPECS"):
102
+ return False
103
+ return model_name in self.MODEL_SPECS
104
+
96
105
  def get_model_info(self, model_name=None):
97
106
  """
98
107
  Return the info dict for a given model (driver, params, etc). If model_name is None, return all model info dicts.
@@ -55,6 +55,12 @@ class AzureOpenAIProvider(LLMProvider):
55
55
  def unavailable_reason(self):
56
56
  return unavailable_reason
57
57
 
58
+ def is_model_available(self, model_name):
59
+ """
60
+ Returns True for any model name, since Azure deployments are user-defined and not enumerable in advance.
61
+ """
62
+ return True
63
+
58
64
  def create_agent(self, tools_adapter=None, agent_name: str = None, **kwargs):
59
65
  from janito.llm.agent import LLMAgent
60
66
  from janito.drivers.azure_openai.driver import AzureOpenAIModelDriver
@@ -6,8 +6,8 @@ MODEL_SPECS = {
6
6
  "family": "deepseek",
7
7
  "default": True,
8
8
  },
9
- "deepseek-coder": {
10
- "description": "DeepSeek Coder Model (OpenAI-compatible)",
9
+ "deepseek-reasoner": {
10
+ "description": "DeepSeek Reasoner Model (OpenAI-compatible)",
11
11
  "context_window": 8192,
12
12
  "max_tokens": 4096,
13
13
  "family": "deepseek",
@@ -16,7 +16,7 @@ class DeepseekProvider(LLMProvider):
16
16
  name = "deepseek"
17
17
  maintainer = "Needs maintainer"
18
18
  MODEL_SPECS = MODEL_SPECS
19
- DEFAULT_MODEL = "deepseek-chat" # Options: deepseek-chat, deepseek-coder
19
+ DEFAULT_MODEL = "deepseek-chat" # Options: deepseek-chat, deepseek-reasoner
20
20
 
21
21
  def __init__(
22
22
  self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
@@ -4,9 +4,13 @@ from janito.tools.adapters.local import (
4
4
  )
5
5
 
6
6
 
7
- def get_local_tools_adapter():
8
-
7
+ def get_local_tools_adapter(workdir=None):
9
8
  # Use set_verbose_tools on the returned adapter to set verbosity as needed
9
+ if workdir is not None:
10
+ import os
11
+ if not os.path.exists(workdir):
12
+ os.makedirs(workdir, exist_ok=True)
13
+ return LocalToolsAdapter(workdir=workdir)
10
14
  return _internal_local_tools_adapter
11
15
 
12
16
 
@@ -9,6 +9,7 @@ from .find_files import FindFilesTool
9
9
  from .view_file import ViewFileTool
10
10
  from .move_file import MoveFileTool
11
11
  from .open_url import OpenUrlTool
12
+ from .open_html_in_browser import OpenHtmlInBrowserTool
12
13
  from .python_code_run import PythonCodeRunTool
13
14
  from .python_command_run import PythonCommandRunTool
14
15
  from .python_file_run import PythonFileRunTool
@@ -23,7 +24,12 @@ from .search_text.core import SearchTextTool
23
24
  from .validate_file_syntax.core import ValidateFileSyntaxTool
24
25
 
25
26
  # Singleton tools adapter with all standard tools registered
26
- local_tools_adapter = LocalToolsAdapter()
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())
27
33
 
28
34
  # Register tools
29
35
  for tool_class in [
@@ -36,6 +42,7 @@ for tool_class in [
36
42
  ViewFileTool,
37
43
  MoveFileTool,
38
44
  OpenUrlTool,
45
+ OpenHtmlInBrowserTool,
39
46
  PythonCodeRunTool,
40
47
  PythonCommandRunTool,
41
48
  PythonFileRunTool,
@@ -52,3 +59,4 @@ for tool_class in [
52
59
  local_tools_adapter.register_tool(tool_class)
53
60
 
54
61
  # DEBUG: Print registered tools at startup
62
+
@@ -15,9 +15,13 @@ class LocalToolsAdapter(ToolsAdapter):
15
15
  Handles registration, lookup, enabling/disabling, listing, and now, tool execution (merged from executor).
16
16
  """
17
17
 
18
- def __init__(self, tools=None, event_bus=None, allowed_tools=None):
18
+ def __init__(self, tools=None, event_bus=None, allowed_tools=None, workdir=None):
19
19
  super().__init__(tools=tools, event_bus=event_bus, allowed_tools=allowed_tools)
20
20
  self._tools: Dict[str, Dict[str, Any]] = {}
21
+ self.workdir = workdir
22
+ if self.workdir:
23
+ import os
24
+ os.chdir(self.workdir)
21
25
  if tools:
22
26
  for tool in tools:
23
27
  self.register_tool(tool)
@@ -43,26 +43,13 @@ class AskUserTool(ToolBase):
43
43
  def _(event):
44
44
  pass
45
45
 
46
- # F12 instruction rotation
47
- _f12_instructions = [
48
- tr("proceed"),
49
- tr("go ahead"),
50
- tr("continue"),
51
- tr("next"),
52
- tr("okay"),
53
- ]
54
- _f12_index = {"value": 0}
55
-
56
46
  @bindings.add("f12")
57
47
  def _(event):
58
- """When F12 is pressed, rotate through a set of short instructions."""
59
48
  buf = event.app.current_buffer
60
- idx = _f12_index["value"]
61
- buf.text = _f12_instructions[idx]
49
+ buf.text = "Do It"
62
50
  buf.validate_and_handle()
63
- _f12_index["value"] = (idx + 1) % len(_f12_instructions)
64
51
 
65
- # Use shared CLI styles
52
+ # Use shared CLI styles
66
53
 
67
54
  # prompt_style contains the prompt area and input background
68
55
  # toolbar_style contains the bottom-toolbar styling
@@ -1,5 +1,6 @@
1
1
  from janito.tools.tool_base import ToolBase
2
2
  from janito.tools.adapters.local.adapter import register_local_tool
3
+ from janito.report_events import ReportAction
3
4
  import webbrowser
4
5
  import os
5
6
 
@@ -21,14 +22,22 @@ class OpenHtmlInBrowserTool(ToolBase):
21
22
  tool_name = "open_html_in_browser"
22
23
 
23
24
  def run(self, file_path: str) -> str:
25
+ from janito.i18n import tr
26
+ disp_path = file_path
27
+ self.report_action(tr("📖 Opening HTML file: '{disp_path}'", disp_path=disp_path), ReportAction.EXECUTE)
28
+
24
29
  if not os.path.exists(file_path):
25
- return "⚠️ Error: The specified file does not exist."
26
-
30
+ self.report_error(tr("⚠️ The specified file does not exist: '{disp_path}'", disp_path=disp_path))
31
+ return "⚠️ The specified file does not exist."
32
+
27
33
  if not file_path.lower().endswith('.html'):
28
- return "⚠️ Error: The specified file is not an HTML file."
29
-
34
+ self.report_error(tr("⚠️ The specified file is not an HTML file: '{disp_path}'", disp_path=disp_path))
35
+ return "⚠️ The specified file is not an HTML file."
36
+
30
37
  try:
31
38
  webbrowser.open(f"file://{os.path.abspath(file_path)}")
32
- return "✅ Opened."
39
+ self.report_success(tr("✅ Ok"))
40
+ return "✅ Ok"
33
41
  except Exception as e:
34
- return f"⚠️ Error: {str(e)}"
42
+ self.report_error(tr("⚠️ Failed to open the HTML file: {err}", err=str(e)))
43
+ return f"⚠️ Failed to open the file: {str(e)}"
@@ -32,6 +32,7 @@ class PythonCodeRunTool(ToolBase):
32
32
  tr("⚡ Running: python (stdin mode) ...\n{code}\n", code=code),
33
33
  ReportAction.EXECUTE,
34
34
  )
35
+ self.report_stdout("\n")
35
36
  try:
36
37
  with (
37
38
  tempfile.NamedTemporaryFile(
@@ -31,6 +31,7 @@ class PythonCommandRunTool(ToolBase):
31
31
  self.report_action(
32
32
  tr("🐍 Running: python -c ...\n{code}\n", code=code), ReportAction.EXECUTE
33
33
  )
34
+ self.report_stdout("\n")
34
35
  try:
35
36
  with (
36
37
  tempfile.NamedTemporaryFile(
@@ -29,6 +29,7 @@ class PythonFileRunTool(ToolBase):
29
29
  tr("🚀 Running: python {file_path}", file_path=file_path),
30
30
  ReportAction.EXECUTE,
31
31
  )
32
+ self.report_stdout("\n")
32
33
  try:
33
34
  with (
34
35
  tempfile.NamedTemporaryFile(
@@ -1,4 +1,4 @@
1
1
  # janito/version.py
2
2
  """Single source of truth for the janito package version."""
3
3
 
4
- __version__ = "2.0.1"
4
+ __version__ = "2.1.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.0.1
3
+ Version: 2.1.1
4
4
  Summary: A new Python package called janito.
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  Project-URL: Homepage, https://github.com/janito-dev/janito
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "janito"
7
- version = "2.0.1"
7
+ version = "2.1.1"
8
8
  description = "A new Python package called janito."
9
9
  authors = [
10
10
  { name="Your Name", email="your.email@example.com" }
@@ -1,36 +0,0 @@
1
- from janito.drivers.openai.driver import OpenAIModelDriver
2
-
3
- # Safe import of AzureOpenAI SDK
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)"
12
-
13
- from janito.llm.driver_config import LLMDriverConfig
14
-
15
-
16
- class AzureOpenAIModelDriver(OpenAIModelDriver):
17
- available = DRIVER_AVAILABLE
18
- unavailable_reason = DRIVER_UNAVAILABLE_REASON
19
-
20
- @classmethod
21
- def is_available(cls):
22
- return cls.available
23
-
24
- required_config = {"base_url"} # Update key as used in your config logic
25
-
26
- def __init__(self, tools_adapter=None):
27
- if not self.available:
28
- raise ImportError(
29
- f"AzureOpenAIModelDriver unavailable: {self.unavailable_reason}"
30
- )
31
- super().__init__(tools_adapter=tools_adapter)
32
- self.azure_endpoint = None
33
- self.api_version = None
34
- self.api_key = None
35
-
36
- # ... rest of the implementation ...
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes