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.
- janito/__init__.py +6 -6
- janito/agent/setup_agent.py +14 -5
- janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +3 -1
- janito/cli/chat_mode/bindings.py +6 -0
- janito/cli/chat_mode/session.py +16 -0
- janito/cli/chat_mode/shell/autocomplete.py +21 -21
- janito/cli/chat_mode/shell/commands/__init__.py +3 -2
- janito/cli/chat_mode/shell/commands/clear.py +12 -12
- janito/cli/chat_mode/shell/commands/exec.py +27 -0
- janito/cli/chat_mode/shell/commands/multi.py +51 -51
- janito/cli/chat_mode/shell/commands/tools.py +17 -6
- janito/cli/chat_mode/shell/input_history.py +62 -62
- janito/cli/chat_mode/shell/session/manager.py +1 -0
- janito/cli/chat_mode/toolbar.py +3 -1
- janito/cli/cli_commands/list_models.py +35 -35
- janito/cli/cli_commands/list_providers.py +9 -9
- janito/cli/cli_commands/list_tools.py +53 -53
- janito/cli/cli_commands/model_selection.py +50 -50
- janito/cli/cli_commands/model_utils.py +13 -2
- janito/cli/cli_commands/set_api_key.py +19 -19
- janito/cli/cli_commands/show_config.py +51 -51
- janito/cli/cli_commands/show_system_prompt.py +62 -62
- janito/cli/config.py +2 -1
- janito/cli/core/__init__.py +4 -4
- janito/cli/core/event_logger.py +59 -59
- janito/cli/core/getters.py +3 -1
- janito/cli/core/runner.py +27 -6
- janito/cli/core/setters.py +5 -1
- janito/cli/core/unsetters.py +54 -54
- janito/cli/main_cli.py +12 -1
- janito/cli/prompt_core.py +5 -2
- janito/cli/rich_terminal_reporter.py +22 -3
- janito/cli/single_shot_mode/__init__.py +6 -6
- janito/cli/single_shot_mode/handler.py +11 -1
- janito/cli/verbose_output.py +1 -1
- janito/config.py +5 -5
- janito/config_manager.py +2 -0
- janito/driver_events.py +14 -0
- janito/drivers/anthropic/driver.py +113 -113
- janito/drivers/azure_openai/driver.py +38 -3
- janito/drivers/driver_registry.py +0 -2
- janito/drivers/openai/driver.py +196 -36
- janito/formatting_token.py +54 -54
- janito/i18n/__init__.py +35 -35
- janito/i18n/messages.py +23 -23
- janito/i18n/pt.py +47 -47
- janito/llm/__init__.py +5 -5
- janito/llm/agent.py +443 -443
- janito/llm/auth.py +1 -0
- janito/llm/driver.py +7 -1
- janito/llm/driver_config.py +1 -0
- janito/llm/driver_config_builder.py +34 -34
- janito/llm/driver_input.py +12 -12
- janito/llm/message_parts.py +60 -60
- janito/llm/model.py +38 -38
- janito/llm/provider.py +196 -196
- janito/provider_config.py +7 -3
- janito/provider_registry.py +29 -5
- janito/providers/__init__.py +1 -0
- janito/providers/anthropic/model_info.py +22 -22
- janito/providers/anthropic/provider.py +2 -2
- janito/providers/azure_openai/model_info.py +7 -6
- janito/providers/azure_openai/provider.py +44 -2
- janito/providers/deepseek/__init__.py +1 -1
- janito/providers/deepseek/model_info.py +16 -16
- janito/providers/deepseek/provider.py +91 -91
- janito/providers/google/model_info.py +21 -29
- janito/providers/google/provider.py +49 -38
- janito/providers/mistralai/provider.py +2 -2
- janito/providers/openai/model_info.py +0 -11
- janito/providers/openai/provider.py +1 -1
- janito/providers/provider_static_info.py +2 -3
- janito/providers/registry.py +26 -26
- janito/tools/adapters/__init__.py +1 -1
- janito/tools/adapters/local/__init__.py +62 -62
- janito/tools/adapters/local/adapter.py +33 -11
- janito/tools/adapters/local/ask_user.py +102 -102
- janito/tools/adapters/local/copy_file.py +84 -84
- janito/tools/adapters/local/create_directory.py +69 -69
- janito/tools/adapters/local/create_file.py +82 -82
- janito/tools/adapters/local/delete_text_in_file.py +4 -7
- janito/tools/adapters/local/fetch_url.py +97 -97
- janito/tools/adapters/local/find_files.py +138 -140
- janito/tools/adapters/local/get_file_outline/__init__.py +1 -1
- janito/tools/adapters/local/get_file_outline/core.py +117 -151
- janito/tools/adapters/local/get_file_outline/java_outline.py +40 -0
- janito/tools/adapters/local/get_file_outline/markdown_outline.py +14 -14
- janito/tools/adapters/local/get_file_outline/python_outline.py +303 -303
- janito/tools/adapters/local/get_file_outline/python_outline_v2.py +156 -156
- janito/tools/adapters/local/get_file_outline/search_outline.py +33 -33
- janito/tools/adapters/local/move_file.py +3 -13
- janito/tools/adapters/local/open_html_in_browser.py +24 -29
- janito/tools/adapters/local/open_url.py +3 -2
- janito/tools/adapters/local/python_code_run.py +166 -166
- janito/tools/adapters/local/python_command_run.py +164 -164
- janito/tools/adapters/local/python_file_run.py +163 -163
- janito/tools/adapters/local/remove_directory.py +6 -17
- janito/tools/adapters/local/remove_file.py +9 -15
- janito/tools/adapters/local/replace_text_in_file.py +6 -9
- janito/tools/adapters/local/run_bash_command.py +176 -176
- janito/tools/adapters/local/run_powershell_command.py +219 -219
- janito/tools/adapters/local/search_text/__init__.py +1 -1
- janito/tools/adapters/local/search_text/core.py +201 -201
- janito/tools/adapters/local/search_text/match_lines.py +1 -1
- janito/tools/adapters/local/search_text/pattern_utils.py +73 -73
- janito/tools/adapters/local/search_text/traverse_directory.py +145 -145
- janito/tools/adapters/local/validate_file_syntax/__init__.py +1 -1
- janito/tools/adapters/local/validate_file_syntax/core.py +106 -106
- janito/tools/adapters/local/validate_file_syntax/css_validator.py +35 -35
- janito/tools/adapters/local/validate_file_syntax/html_validator.py +93 -93
- janito/tools/adapters/local/validate_file_syntax/js_validator.py +27 -27
- janito/tools/adapters/local/validate_file_syntax/json_validator.py +6 -6
- janito/tools/adapters/local/validate_file_syntax/markdown_validator.py +109 -109
- janito/tools/adapters/local/validate_file_syntax/ps1_validator.py +32 -32
- janito/tools/adapters/local/validate_file_syntax/python_validator.py +5 -5
- janito/tools/adapters/local/validate_file_syntax/xml_validator.py +11 -11
- janito/tools/adapters/local/validate_file_syntax/yaml_validator.py +6 -6
- janito/tools/adapters/local/view_file.py +167 -167
- janito/tools/inspect_registry.py +17 -17
- janito/tools/tool_base.py +105 -105
- janito/tools/tool_events.py +58 -58
- janito/tools/tool_run_exception.py +12 -12
- janito/tools/tool_use_tracker.py +81 -81
- janito/tools/tool_utils.py +45 -45
- janito/tools/tools_adapter.py +78 -6
- janito/tools/tools_schema.py +104 -104
- janito/version.py +4 -4
- {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/METADATA +388 -232
- janito-2.3.0.dist-info/RECORD +181 -0
- janito-2.3.0.dist-info/licenses/LICENSE +21 -0
- janito/cli/chat_mode/shell/commands/last.py +0 -137
- janito/drivers/google_genai/driver.py +0 -54
- janito/drivers/google_genai/schema_generator.py +0 -67
- janito-2.1.1.dist-info/RECORD +0 -181
- {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/WHEEL +0 -0
- {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/entry_points.txt +0 -0
- {janito-2.1.1.dist-info → janito-2.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
janito/__init__.py,sha256=8MEGY4TmcQVDzG_QEpN3MrRAimTWPVLwdfTpTofOODU,226
|
2
|
+
janito/__main__.py,sha256=lPQ8kAyYfyeS1KopmJ8EVY5g1YswlIqCS615mM_B_rM,70
|
3
|
+
janito/config.py,sha256=v4RWybUr4qy6qRlUQmwf51xzqDGhuclqRXGh3hTW14A,196
|
4
|
+
janito/config_manager.py,sha256=KGYvaL7Iwgxqd_0xfG_KMmi1YDz19k2dxrUpylcA08c,4351
|
5
|
+
janito/conversation_history.py,sha256=GqqEJElTVONzOMRe-9g25WCMcDi0PF7DOnqGWLTrY_8,897
|
6
|
+
janito/dir_walk_utils.py,sha256=ON9EyVH7Aaik8WtCH5z8DQis9ycdoNVkjNvU16HH498,1193
|
7
|
+
janito/driver_events.py,sha256=51ab7KW_W6fVZVeO0ez-HJFY4NbTI327ZlEmEsEkxQc,3405
|
8
|
+
janito/exceptions.py,sha256=l4AepRdWwAuLp5fUygrBBgO9rpwgfV6JvY1afOdq2pw,913
|
9
|
+
janito/formatting.py,sha256=SMvOmL6bst3KGcI7OLa5D4DE127fQYuHZS3oY8OPsn8,2031
|
10
|
+
janito/formatting_token.py,sha256=BzJoAuYxhOlZJixuR2m-e8L7jbV1FhzFvJz9SzXXMFM,1911
|
11
|
+
janito/gitignore_utils.py,sha256=P3iF9fMWAomqULq2xsoqHtI9uNIFSPcagljrxZshmLw,4110
|
12
|
+
janito/perf_singleton.py,sha256=g1h0Sdf4ydzegeEpJlMhQt4H0GQZ2hryXrdYOTL-b30,113
|
13
|
+
janito/performance_collector.py,sha256=RYu4av16Trj3RljJZ8-2Gbn1KlGdJUosrcVFYtwviNI,6285
|
14
|
+
janito/platform_discovery.py,sha256=JN3kC7hkxdvuj-AyrJTlbbDJjtNHke3fdlZDqGi_uz0,4621
|
15
|
+
janito/provider_config.py,sha256=acn2FEgWsEIyi2AxZiuCLoP2rXDd-nXcP5VB4CZHaeE,3189
|
16
|
+
janito/provider_registry.py,sha256=QUDr0KDnlNMOEZnwxpeSjkF9jSxtxXyS1-lNPklfwOA,7587
|
17
|
+
janito/report_events.py,sha256=q4OR_jTZNfcqaQF_fzTjgqo6_VlUIxSGWfhpT4nJWcw,938
|
18
|
+
janito/utils.py,sha256=eXSsMgM69YyzahgCNrJQLcEbB8ssLI1MQqaa20ONxbE,376
|
19
|
+
janito/version.py,sha256=ozLtKoqj7xXtB2iTD9mlIgEedNpXJHto4lwWQpWuFcg,104
|
20
|
+
janito/agent/setup_agent.py,sha256=vPpfkGgO5k7gIDOT_LNnbM1tewM7rhx9VkaAdD57t7Y,5220
|
21
|
+
janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2,sha256=FX8piXbR9XNOEKkOSMt4ieZ2wn5fzQlffeQFf8d7gIc,723
|
22
|
+
janito/agent/templates/profiles/system_prompt_template_main.txt.j2,sha256=npmG2_WU2Rcp1z2n33vX5ShK0y6yKDQqF2zJytgmGpE,2533
|
23
|
+
janito/cli/__init__.py,sha256=xaPDOrWphBbCR63Xpcx_yfpXSJIlCaaICc4j2qpWqrM,194
|
24
|
+
janito/cli/config.py,sha256=Drs0ubwSjrGMjHwkjLUrRA2ezqg07iE1Z0KuDj-cXSw,1148
|
25
|
+
janito/cli/console.py,sha256=gJolqzWL7jEPLxeuH-CwBDRFpXt976KdZOEAB2tdBDs,64
|
26
|
+
janito/cli/main.py,sha256=s5odou0txf8pzTf1ADk2yV7T5m8B6cejJ81e7iu776U,312
|
27
|
+
janito/cli/main_cli.py,sha256=e1AcKYf84vmgVTrRkQkVkvXNNQ7hsr0wC2c_pCIHaTk,11151
|
28
|
+
janito/cli/prompt_core.py,sha256=f1nk_jjrZg9du5mVtWCQGSskJikMevvPnWID5KGlNpk,10671
|
29
|
+
janito/cli/prompt_handler.py,sha256=SnPTlL64noeAMGlI08VBDD5IDD8jlVMIYA4-fS8zVLg,215
|
30
|
+
janito/cli/rich_terminal_reporter.py,sha256=LCUGojAGlvs2SOHs7_qFz8AbAGJW5cyLQhte4OXHIR4,4981
|
31
|
+
janito/cli/termweb_starter.py,sha256=2Gr3yqSVydMWhoHUgNCtd7yviRi8uaatDtcGTpJL1Qc,5033
|
32
|
+
janito/cli/utils.py,sha256=plCQiDKIf3V8mFhhX5H9-MF2W86i-xRdWf8Xi117Z0w,677
|
33
|
+
janito/cli/verbose_output.py,sha256=GVW4ZTqeVlv8BH7lfvSivX4nojXPDiZOYs1UM3wCkrU,7628
|
34
|
+
janito/cli/chat_mode/bindings.py,sha256=l-Uk6ee3SbtYFc8FzR5FQIu2iCmtzebINYo8w9hnmr4,1078
|
35
|
+
janito/cli/chat_mode/chat_entry.py,sha256=Rdaq7-3OHtro2ncUOPHXZOLpOoKPRJnoz7Jqr8_fuDQ,604
|
36
|
+
janito/cli/chat_mode/prompt_style.py,sha256=-viZYJgjGID6kR9toz6HtzIkIxGOCG28xNqiiD2MwX0,640
|
37
|
+
janito/cli/chat_mode/session.py,sha256=23hPQl4uk7P95prjaqY6ZdE5Dm5CGfI54qc61R6v7x4,12448
|
38
|
+
janito/cli/chat_mode/toolbar.py,sha256=WUkyodsVgroHptrvIdX7DfAQMZ8j_Z5oX_4SE4iySQY,3689
|
39
|
+
janito/cli/chat_mode/shell/autocomplete.py,sha256=7jclMfAMOBKfZWrOfaPVhru7ZKx8S64tNKOdK-g6rYI,772
|
40
|
+
janito/cli/chat_mode/shell/input_history.py,sha256=P6qRaBiSxJsUDANjQagJI4YQj1kWdwXgulaew6rBC68,2475
|
41
|
+
janito/cli/chat_mode/shell/commands/__init__.py,sha256=R20AE4KNbt650J0kKu36ubh9_tgcy-qdC6jbhGDI2EQ,2089
|
42
|
+
janito/cli/chat_mode/shell/commands/base.py,sha256=I6-SVOcRd7q4PpoutLdrbhbqeUpJic2oyPhOSMgMihA,288
|
43
|
+
janito/cli/chat_mode/shell/commands/clear.py,sha256=eBC2zqJf95lH-TQrcKzL2eLx658Xpv_W1YDuXHP50kQ,410
|
44
|
+
janito/cli/chat_mode/shell/commands/conversation_restart.py,sha256=2YH_BkU0200liuZAKO6YZULrzB0i15wWWahuA_QODgw,2905
|
45
|
+
janito/cli/chat_mode/shell/commands/edit.py,sha256=OU3BmJEgslTmazCYo23XCIT99hhzscinjoqVMg_VH3E,892
|
46
|
+
janito/cli/chat_mode/shell/commands/exec.py,sha256=oFpRnRUTHmrhicFrSYqDmBxp-rSb_J7VUWgeUeftDwQ,1462
|
47
|
+
janito/cli/chat_mode/shell/commands/help.py,sha256=Oa1oJ-Ea9uR6b57gwv7dVKKNRTFHyupahhOVh-P4rk8,633
|
48
|
+
janito/cli/chat_mode/shell/commands/history_view.py,sha256=9dyxYpDHjT77LEIikjBQA03Ep3P2AmKXUwUnVsG0OQc,3584
|
49
|
+
janito/cli/chat_mode/shell/commands/lang.py,sha256=uIelDs3gPYDZ9X9gw7iDMmiwefT7TiBo32420pq2tW8,837
|
50
|
+
janito/cli/chat_mode/shell/commands/livelogs.py,sha256=uJI14qyubXEz8m0Cajd-vURPYxC__7p_CNCq6PVOHN0,2142
|
51
|
+
janito/cli/chat_mode/shell/commands/multi.py,sha256=odlobZSr3q_6cK0B-tPwS92TEhdIOCP7U8VqgHfu4ho,1934
|
52
|
+
janito/cli/chat_mode/shell/commands/prompt.py,sha256=x9S3mOpplpR5aiy5b8LSIsZEEFGenQtPGK6HxYdwx1Y,2448
|
53
|
+
janito/cli/chat_mode/shell/commands/role.py,sha256=7A2S2wzE6lcv1rg4iLGH8vVy-TnzRE0Tn_wPRhBHLpY,1474
|
54
|
+
janito/cli/chat_mode/shell/commands/session.py,sha256=9wsw5U24-KJgTT70KAwnGuS8MVPyvpxCJfAt_Io76O0,1574
|
55
|
+
janito/cli/chat_mode/shell/commands/session_control.py,sha256=tmMGJ8IvWoBwSIJu7T6GPnFYFrmXWIG2Gr9tTni4y3U,1307
|
56
|
+
janito/cli/chat_mode/shell/commands/termweb_log.py,sha256=W2586JMBwMKNlsgdgACQYIy_1oTOxjjckzRQwJBreXM,3853
|
57
|
+
janito/cli/chat_mode/shell/commands/tools.py,sha256=je0ePuQTeSdPNOlyZIH1tBFedobJJCeCQHIIwTQufmU,2156
|
58
|
+
janito/cli/chat_mode/shell/commands/utility.py,sha256=K982P-UwgPLzpEvSuSBGwiQ3zC34S_6T2ork_djweQw,847
|
59
|
+
janito/cli/chat_mode/shell/commands/verbose.py,sha256=HDTe0NhdcjBuhh-eJSW8iLPDeeBO95K5iSDAMAljxa4,953
|
60
|
+
janito/cli/chat_mode/shell/session/__init__.py,sha256=uTYE_QpZFEn7v9QE5o1LdulpCWa9vmk0OsefbBGWg_c,37
|
61
|
+
janito/cli/chat_mode/shell/session/history.py,sha256=tYav6GgjAZkvWhlI_rfG6OArNqW6Wn2DTv39Hb20QYc,1262
|
62
|
+
janito/cli/chat_mode/shell/session/manager.py,sha256=SL9BCdlCPdoo-5BPAIC1eaJuXv7hH4d5VGqMF6T7MEI,3333
|
63
|
+
janito/cli/cli_commands/list_models.py,sha256=R6b_3LNljd_L4MpQWllUMlRzfCLIGR73BWYG3Em7VLI,1081
|
64
|
+
janito/cli/cli_commands/list_providers.py,sha256=fe9JuXSy6zv-XXAabgxXqErjsraj37KfCA35D4XF-JI,164
|
65
|
+
janito/cli/cli_commands/list_tools.py,sha256=7QyEfBOmi7ftFlRse4PILLD_RM2jhGjEBbsS4C9fxdE,2133
|
66
|
+
janito/cli/cli_commands/model_selection.py,sha256=Pd9Z9zjLKCym-SMK51yf7KEdv00FEM-1SIKRMnR0HbY,1593
|
67
|
+
janito/cli/cli_commands/model_utils.py,sha256=ZGIExsv7WMHL_pqh4yeUXIfFGlu0vZE08PF0bCIIIK4,2864
|
68
|
+
janito/cli/cli_commands/set_api_key.py,sha256=7QXKzQ2sxAEKQlX9X8ywL2LjDacDQumkDJT4k-GBIls,586
|
69
|
+
janito/cli/cli_commands/show_config.py,sha256=NvBWvGhYi8VklKwpcHVMpx3P0UzSIy_M99meZmsh5f4,1973
|
70
|
+
janito/cli/cli_commands/show_system_prompt.py,sha256=-BIvjByRXyLWBeAZLYaxZntCmacmdggsFjSQsP5GZQA,2384
|
71
|
+
janito/cli/core/__init__.py,sha256=Z7-HaIYAQiHm4e9GrL3Bx3wISmtXlHY6EH5Tk9R10vY,192
|
72
|
+
janito/cli/core/event_logger.py,sha256=dqd2dAXzOsbphiSbic11W7keujx1vURglSagkhVtSPs,1949
|
73
|
+
janito/cli/core/getters.py,sha256=Znw6aF6QUHGu6UWqQHQYu7LvNPPIjOO4SD4yyYaIGnw,1467
|
74
|
+
janito/cli/core/runner.py,sha256=z-YSAuS1uOI9JkDIU3n4ItCIsSTSXPqiPDm2HnLXGUA,7105
|
75
|
+
janito/cli/core/setters.py,sha256=U-Tp-NlHTLHteLchUdTXvA_v2gaXb7M98oolMvXEuvw,6883
|
76
|
+
janito/cli/core/unsetters.py,sha256=FGgxVkN69AnUjvWEKukz8dFZvFkcndpLla7ugA7QFTo,1958
|
77
|
+
janito/cli/single_shot_mode/__init__.py,sha256=K5QHkJBnNlZNBzabc2tMe8MaWHC8Jn7Xpv8NLJXg8aA,109
|
78
|
+
janito/cli/single_shot_mode/handler.py,sha256=pqs4r0EZc28-9d1qpo8mj_-x3QVDAxMCkTkd0GCdRa0,6250
|
79
|
+
janito/drivers/driver_registry.py,sha256=c_nezPfjPHaAZjCZhU80JN_YRCKYBJhomQNYZCu-Ug4,1007
|
80
|
+
janito/drivers/anthropic/driver.py,sha256=bFjMTDIFXCBZlq_7SdUAfRsOM5RdAg18CIVh5B9WmYE,3824
|
81
|
+
janito/drivers/azure_openai/driver.py,sha256=zQc9xH-RD409okDCfTRwb1QXXb9WzR2bsBfRyrZ5HYc,3936
|
82
|
+
janito/drivers/mistralai/driver.py,sha256=r7iMMAG5V7OmzrtQhVCuK3ueAEzgbgS1qcPDKHTNKoo,1208
|
83
|
+
janito/drivers/openai/driver.py,sha256=50Ic_w6HR7xqp2rZ9RYM4Ylbhn4MKAuhyRNTHYozhVQ,21812
|
84
|
+
janito/event_bus/__init__.py,sha256=VG6GOhKMBh0O_92D-zW8a3YitJPKDajGgPiFezTXlNE,77
|
85
|
+
janito/event_bus/bus.py,sha256=LokZbAdwcWhWOyKSp7H3Ism57x4EZhxlRPjl3NE4UKU,2847
|
86
|
+
janito/event_bus/event.py,sha256=TMWZ4ccv1vGIsBQpeKDsDOBGgw9Pk_ltYWd6dMUJp6Q,398
|
87
|
+
janito/event_bus/handler.py,sha256=RhBtT1E48VEM2-k8u3HYsESw7VX5qAgiB8ZTJeKXhHc,1322
|
88
|
+
janito/event_bus/queue_bus.py,sha256=l4phun3pxXxi8ZlIq8ChYaiYDVO1PZeXoOzyi3vyu20,1558
|
89
|
+
janito/i18n/__init__.py,sha256=j7hL6NWK6HiTd3Wql-XhQtQviPytB1BPbGloe78MoCk,959
|
90
|
+
janito/i18n/messages.py,sha256=F5-sRB6gOE2sIaG_r93ibQwbrazaP8X4pSMB95be_jA,1828
|
91
|
+
janito/i18n/pt.py,sha256=sRea0nKmbyONhFDXoHg9OsY9__RzplskHlWa6mRCEvA,4241
|
92
|
+
janito/llm/__init__.py,sha256=NibzrlIQcFCKo5MZsPfhy4yJ2rKWrMC9HZRIeg9T0hQ,129
|
93
|
+
janito/llm/agent.py,sha256=Y-AVySMpZDRlHOgBzSXiyY1T-szwWgGBiKMsLIMglbc,17964
|
94
|
+
janito/llm/auth.py,sha256=8Dl_orUEPhn2X6XjkO2Nr-j1HFT2YDxk1qJl9hSFI88,2286
|
95
|
+
janito/llm/driver.py,sha256=EURz04w3CWwxJ2VOZ5bUcNCneQqRS6-mrqKetDjZ7cs,9816
|
96
|
+
janito/llm/driver_config.py,sha256=OW0ae49EfgKDqaThuDjZBiaN78voNzwiZ6szERMqJos,1406
|
97
|
+
janito/llm/driver_config_builder.py,sha256=KWAQ9OFz5Bo-jtgUCLZS-COGV1YZComx2BNzwZNGrvo,1367
|
98
|
+
janito/llm/driver_input.py,sha256=BpO8EpUyZIoJ4l-LWed5wrAfHeT0vFynl3zw-DLBIvg,377
|
99
|
+
janito/llm/message_parts.py,sha256=x805963skJSdNQOeM-I3QW6MOV9-oSOfNapxi4rVpR4,1305
|
100
|
+
janito/llm/model.py,sha256=1PeK0uLcT361OaYkPEOWVxwvwoFr7ZnCyrYqUCnpiQA,1093
|
101
|
+
janito/llm/provider.py,sha256=zKhVkNvjKmHNr3B8hQyxcf7lcY3VF2l6HBWxIzIYhAo,7782
|
102
|
+
janito/providers/__init__.py,sha256=Q9zTiZlDuAsdI6y4tAcqLlZ6LCKyRaOsoQ2iBAGq0O4,367
|
103
|
+
janito/providers/provider_static_info.py,sha256=Lwbcb-AOEmo9v5Ma4SqM51uSXGwWYFewMJSDl1rOd8M,568
|
104
|
+
janito/providers/registry.py,sha256=u8nWy4JtVM4mibLTnGYNs6QrN64A4dBB-hTCYfLSnWo,704
|
105
|
+
janito/providers/anthropic/model_info.py,sha256=oNcYrZXehG83FOPJhaIknmXiiqJYzjfvRtepU-xWrRg,619
|
106
|
+
janito/providers/anthropic/provider.py,sha256=t3HPy7x9-2LKtWBOjRIxCa2v9QenHYOrEfUFVRnTvzA,2360
|
107
|
+
janito/providers/azure_openai/model_info.py,sha256=TMSqEpQROIIYUGAyulYJ5xGhj7CbLoaKL_JXeLbXaG0,689
|
108
|
+
janito/providers/azure_openai/provider.py,sha256=ePbC_FQZEyp2b7WIE7vl9N3-5LqEomkW0e5zigcSv1U,4925
|
109
|
+
janito/providers/deepseek/__init__.py,sha256=6yMBq7WwqyUuwKmYoiaWlqcXyDW-qx5mBOdMpwU8qHE,35
|
110
|
+
janito/providers/deepseek/model_info.py,sha256=bnAz_vV3VTs326Ws3veKeQ-tdR4BHhmsi_ESiCUS_Zc,449
|
111
|
+
janito/providers/deepseek/provider.py,sha256=jn8cUSl9M-DoN-spYErOClEb232IRqabe0I4I27ZvOg,3568
|
112
|
+
janito/providers/google/__init__.py,sha256=hE3OGJvLEhvNLhIK_XmCGIdrIj8MKlyGgdOLJ4mdess,38
|
113
|
+
janito/providers/google/model_info.py,sha256=Yt6UffgCmPDvXzegmzy2FVo7pNblwUOl7oC6bSRYOaI,1106
|
114
|
+
janito/providers/google/provider.py,sha256=SkB2d5vvXBri0L3X-UMtXjyvOtVdCbECAEoj1TodFDQ,3109
|
115
|
+
janito/providers/mistralai/model_info.py,sha256=Kh0S_3O76fcPGYW-ywmsF4Hhd8011wLpORPLRu3zdlQ,1026
|
116
|
+
janito/providers/mistralai/provider.py,sha256=s_bnklPEh52TEijzAPaLYnk19mcg3SnA6vQ-PGyrpoc,2526
|
117
|
+
janito/providers/openai/__init__.py,sha256=f0m16-sIqScjL9Mp4A0CQBZx6H3PTEy0cnE08jeaB5U,38
|
118
|
+
janito/providers/openai/model_info.py,sha256=cz08O26Ychm-aP3T8guJRqpR96Im9Cwtgl2iMgM7tJs,3384
|
119
|
+
janito/providers/openai/provider.py,sha256=d2MsSuaR8GhE966FKhY8cX2jSFv5EPAVTf36-ZJwC7I,4481
|
120
|
+
janito/providers/openai/schema_generator.py,sha256=hTqeLcPTR8jeKn5DUUpo7b-EZ-V-g1WwXiX7MbHnFzE,2234
|
121
|
+
janito/termweb/app.py,sha256=lOZqNf5TEvijryLXaa2CDx722PqBR_DH32A44V1Lfz0,3305
|
122
|
+
janito/tools/__init__.py,sha256=Xk6i_b2VTfrSGt_iBGAe61uSZGyrztv_WzbGlxQVNrU,566
|
123
|
+
janito/tools/inspect_registry.py,sha256=FiSdjqOVrQR4_ddnLDTubUMrR4IIQR0ZNZWui4YRwQY,521
|
124
|
+
janito/tools/tool_base.py,sha256=A6mpNlinw23-QC_SveLa0COFJsriu8OuwVG-wwi7tUM,3265
|
125
|
+
janito/tools/tool_events.py,sha256=9upnEbDxNXzj2L_Ki-Lnb5jV7YsQsg7pZR5rJesdnT4,1469
|
126
|
+
janito/tools/tool_run_exception.py,sha256=ILoizPiLpa3ICjl1tvRkPYp4ROUAoocP1sfFNWv_0Sg,513
|
127
|
+
janito/tools/tool_use_tracker.py,sha256=x0bYUsqcnhAVTDza57qo9HmEUt2JoqgtdO5QmzY6Mb8,2724
|
128
|
+
janito/tools/tool_utils.py,sha256=qfApGMGHUeddnMuEImAanx9ikqz0ClSrfe0Smoz8sKw,1318
|
129
|
+
janito/tools/tools_adapter.py,sha256=vhSs9fxUdkVAxKtFYyhXXR82UctTathCN9sKU1QONkY,11385
|
130
|
+
janito/tools/tools_schema.py,sha256=wZQXN2JX9xPGYS7yiueTbaT8StVwQ2dpbBGEoKTcYjw,4311
|
131
|
+
janito/tools/adapters/__init__.py,sha256=wC_jc71wYppdZgLhZvFY0URCNdimiBk9NuIJwvnydK4,91
|
132
|
+
janito/tools/adapters/local/__init__.py,sha256=WPTSOMrZpRg7ioNqCp3fYmnMaF3HnzymGzVpvH0Mp5w,1941
|
133
|
+
janito/tools/adapters/local/adapter.py,sha256=y-vaTbBelFovELApRt2cI17g8ercqPlM8hwkgmVlU4I,4654
|
134
|
+
janito/tools/adapters/local/ask_user.py,sha256=vY3F7ZoQbgNj1f_JsJKCaYAxV7DZ2OrOK5976RBYhUw,3329
|
135
|
+
janito/tools/adapters/local/copy_file.py,sha256=4IF80UBL_fbdHedXkl9A9vTn9hnSwfCfMbA5vhvxWn8,3423
|
136
|
+
janito/tools/adapters/local/create_directory.py,sha256=zcWA_6ZFZChOVegPeHSaw2f3c-tAdMqgsYP58PZLn3A,2482
|
137
|
+
janito/tools/adapters/local/create_file.py,sha256=pArWDm1_fy_pi777hR8LqukPX7WgITGeLXf0APdN198,3381
|
138
|
+
janito/tools/adapters/local/delete_text_in_file.py,sha256=OvJqmusOSYH5CYKpjodoOl5onqQLcoYduZQIuoFoWTc,5101
|
139
|
+
janito/tools/adapters/local/fetch_url.py,sha256=dm4s4aXeoegLPucpjDyKRf0xH3HaA3ZbsdqpIsaIlHs,3709
|
140
|
+
janito/tools/adapters/local/find_files.py,sha256=hOzRiIhHcr7UUwryz5WjaTgfPoX2OlBKP4YffNq1zYU,5826
|
141
|
+
janito/tools/adapters/local/move_file.py,sha256=Ng6T4xEqo1WhB8AZfQ6U64nd5ntXunli3PwABHPqhuM,4541
|
142
|
+
janito/tools/adapters/local/open_html_in_browser.py,sha256=ankH5hFjhZ7IUym2qUgmwtOSdhvnBSj9SLwirIJNCQM,1925
|
143
|
+
janito/tools/adapters/local/open_url.py,sha256=40qPXTyq2SINHQgEnqfCEfBnGAQOJB4uZlQoe-R2sNU,1339
|
144
|
+
janito/tools/adapters/local/python_code_run.py,sha256=X_a6GXyTUhIXsnTW8Ahu0u0QmYWIDWiWFS8T6gVWX5c,6484
|
145
|
+
janito/tools/adapters/local/python_command_run.py,sha256=D0JwQKxNnOtAMJHBgmaPw_6xCQnaC-v90nhSuUX4fYY,6426
|
146
|
+
janito/tools/adapters/local/python_file_run.py,sha256=8MRRK_5e1sEbjmHHByRRYKmHQN0aKXa8tNXVMiMMYtg,6302
|
147
|
+
janito/tools/adapters/local/remove_directory.py,sha256=8VXcMPfLAXhScpkb22VfAETNeWjTmgm8hFTGWRq7TtY,1791
|
148
|
+
janito/tools/adapters/local/remove_file.py,sha256=NaZTvuIRtGurp1rLZIjQZ6_kkGcmXc8oQkk9gDc5W3s,2051
|
149
|
+
janito/tools/adapters/local/replace_text_in_file.py,sha256=5DNOEivKcT083lspjoi0eCaTn0Qd3YfrX1yrSNTY4_E,10814
|
150
|
+
janito/tools/adapters/local/run_bash_command.py,sha256=jNAHAoRPuAaLV0QM2DPw076yBMa0Ps8HnH_4ilzee2g,7415
|
151
|
+
janito/tools/adapters/local/run_powershell_command.py,sha256=yOEC6WnJsl_t2GqgOhgad642Z7C2kLih5btPd_U7vOI,9010
|
152
|
+
janito/tools/adapters/local/view_file.py,sha256=B1kyYTc1xfF8nAmo4erau1_laL2Iy4BxEjthob5MbfU,6967
|
153
|
+
janito/tools/adapters/local/get_file_outline/__init__.py,sha256=py8Dj0yWlyG3MJN-uX9rF_IMrykHrJ3Wtmbu9uQP_hs,36
|
154
|
+
janito/tools/adapters/local/get_file_outline/core.py,sha256=KgNEiNIVpDgAQFi7BTSoBi3VxbH1QRXFBJrRjHzqTL4,4218
|
155
|
+
janito/tools/adapters/local/get_file_outline/java_outline.py,sha256=Ovasg7hrlDJd8yyazi-zQ1ODwBq9mVYlRUycrOIA5ig,1645
|
156
|
+
janito/tools/adapters/local/get_file_outline/markdown_outline.py,sha256=iD7gA8px_5nZlmCjEMXXToERoPTwNeGAEcNogPMcBBU,420
|
157
|
+
janito/tools/adapters/local/get_file_outline/python_outline.py,sha256=254ahYEG2Mlhggg_5OLq09OFn6CKCjR-9J7ElJWkOeo,10023
|
158
|
+
janito/tools/adapters/local/get_file_outline/python_outline_v2.py,sha256=uhKyWXZVnwGA_9pta40PFBJ27wCt425V3AGEBBXe3Ng,5297
|
159
|
+
janito/tools/adapters/local/get_file_outline/search_outline.py,sha256=VwSxi2ssosV-8aA2g96XtIwa8qErmkHIrP0akLJiffc,1131
|
160
|
+
janito/tools/adapters/local/search_text/__init__.py,sha256=o6bLR4giJJr2Akx_TZtYkmsgdbnRfTmlijtYmDA7P8o,33
|
161
|
+
janito/tools/adapters/local/search_text/core.py,sha256=2alZUpAOhfYmUMqJIJwwEtVDwaFw8Efn3ANQdRBIuws,7439
|
162
|
+
janito/tools/adapters/local/search_text/match_lines.py,sha256=2l0r8_1l5gnmu9vJSdkxu0JwbPNHx7m84Ei2s4V0hcQ,2141
|
163
|
+
janito/tools/adapters/local/search_text/pattern_utils.py,sha256=hGSPOfZtyUHyF6UQV7Xz5VxAWCAwtoHk-k3LXoOh0I0,2301
|
164
|
+
janito/tools/adapters/local/search_text/traverse_directory.py,sha256=0Ez8uMVaYFDwPIGnkUEnujQPQ0JmLUknf0mQJlTaNYM,3919
|
165
|
+
janito/tools/adapters/local/validate_file_syntax/__init__.py,sha256=Fd0aL49X9jBEyHCq0SfdFfQYKSrD6O02bLE7t49ANZg,28
|
166
|
+
janito/tools/adapters/local/validate_file_syntax/core.py,sha256=oyGk1KMJUgGSdLCVS_A5Jlx2LSmcf-uuQHLEzdsYg5c,3231
|
167
|
+
janito/tools/adapters/local/validate_file_syntax/css_validator.py,sha256=JihhHjp-LJ0bsP7y_Y8ElzT2IN7V0N9oFgQYcphqfUM,1326
|
168
|
+
janito/tools/adapters/local/validate_file_syntax/html_validator.py,sha256=2wQCS_r-fWxYXH_T3I_XpWJAkrPNHceCOBBLuzNiEbA,2971
|
169
|
+
janito/tools/adapters/local/validate_file_syntax/js_validator.py,sha256=vHxnpXiAbp5_PDroveMJiA1svsvgcfAEGnXUh8ellDY,981
|
170
|
+
janito/tools/adapters/local/validate_file_syntax/json_validator.py,sha256=G0nooPKL3B0X9j-S-lttNetljrV13TwLMGer4x5D_TI,154
|
171
|
+
janito/tools/adapters/local/validate_file_syntax/markdown_validator.py,sha256=HhaRiT1VPE0xxpQJkjN_vSDICzVUJU4Gyw-dvN-6sHg,3412
|
172
|
+
janito/tools/adapters/local/validate_file_syntax/ps1_validator.py,sha256=oAFZApxonawuWtXpmZ2vZ6qfHSJi-UAUkqoXlQqvrzY,1130
|
173
|
+
janito/tools/adapters/local/validate_file_syntax/python_validator.py,sha256=5GfpKsdqnma860pMjD4sjx0uFieAtLOFWqnFCH6K4Q8,135
|
174
|
+
janito/tools/adapters/local/validate_file_syntax/xml_validator.py,sha256=_w7UK32GNliZ9IfKqNm15UAiB-6OQfSmcFAaspIDKs4,283
|
175
|
+
janito/tools/adapters/local/validate_file_syntax/yaml_validator.py,sha256=L4b0yikiKaxHPfflPzndTUMsk20N0hwAjgYLWpNHkt4,159
|
176
|
+
janito-2.3.0.dist-info/licenses/LICENSE,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
|
177
|
+
janito-2.3.0.dist-info/METADATA,sha256=3MDvo-E-jjYsRr3gelf96nNtzcVlZhZFOs6_4lpzKpY,15081
|
178
|
+
janito-2.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
179
|
+
janito-2.3.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
|
180
|
+
janito-2.3.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
|
181
|
+
janito-2.3.0.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) [year] [fullname]
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -1,137 +0,0 @@
|
|
1
|
-
from janito.performance_collector import PerformanceCollector
|
2
|
-
from rich.tree import Tree
|
3
|
-
from rich.console import Console
|
4
|
-
from rich import print as rprint
|
5
|
-
import datetime
|
6
|
-
|
7
|
-
# TODO: Replace this with your actual collector instance retrieval
|
8
|
-
# For example, if you have a global or singleton:
|
9
|
-
# from janito.app_context import performance_collector as collector
|
10
|
-
from janito.perf_singleton import performance_collector as collector
|
11
|
-
from janito.cli.chat_mode.shell.commands.base import ShellCmdHandler
|
12
|
-
from janito.cli.console import shared_console
|
13
|
-
|
14
|
-
|
15
|
-
def _event_timestamp(event):
|
16
|
-
if hasattr(event, "timestamp"):
|
17
|
-
try:
|
18
|
-
ts = float(getattr(event, "timestamp", 0))
|
19
|
-
return f" [dim]{datetime.datetime.fromtimestamp(ts)}[/dim]"
|
20
|
-
except Exception:
|
21
|
-
return ""
|
22
|
-
return ""
|
23
|
-
|
24
|
-
|
25
|
-
def _event_tool_name(event):
|
26
|
-
return (
|
27
|
-
f" [cyan]{getattr(event, 'tool_name', '')}[/cyan]"
|
28
|
-
if hasattr(event, "tool_name")
|
29
|
-
else ""
|
30
|
-
)
|
31
|
-
|
32
|
-
|
33
|
-
def _event_params(event):
|
34
|
-
return (
|
35
|
-
f" Params: {getattr(event, 'params', '')}" if hasattr(event, "params") else ""
|
36
|
-
)
|
37
|
-
|
38
|
-
|
39
|
-
def _event_result(event):
|
40
|
-
return (
|
41
|
-
f" Result: {getattr(event, 'result', '')}" if hasattr(event, "result") else ""
|
42
|
-
)
|
43
|
-
|
44
|
-
|
45
|
-
def _event_error(event):
|
46
|
-
return (
|
47
|
-
f" [red]Error: {getattr(event, 'error')}[/red]"
|
48
|
-
if hasattr(event, "error") and getattr(event, "error", None)
|
49
|
-
else ""
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
def _event_message(event):
|
54
|
-
return (
|
55
|
-
f" [yellow]Message: {getattr(event, 'message')}[/yellow]"
|
56
|
-
if hasattr(event, "message")
|
57
|
-
else ""
|
58
|
-
)
|
59
|
-
|
60
|
-
|
61
|
-
def _event_subtype(event):
|
62
|
-
return (
|
63
|
-
f" [magenta]Subtype: {getattr(event, 'subtype')}[/magenta]"
|
64
|
-
if hasattr(event, "subtype")
|
65
|
-
else ""
|
66
|
-
)
|
67
|
-
|
68
|
-
|
69
|
-
def _event_status(event):
|
70
|
-
return (
|
71
|
-
f" [blue]Status: {getattr(event, 'status')}[/blue]"
|
72
|
-
if hasattr(event, "status")
|
73
|
-
else ""
|
74
|
-
)
|
75
|
-
|
76
|
-
|
77
|
-
def _event_duration(event):
|
78
|
-
return (
|
79
|
-
f" [green]Duration: {getattr(event, 'duration')}[/green]"
|
80
|
-
if hasattr(event, "duration")
|
81
|
-
else ""
|
82
|
-
)
|
83
|
-
|
84
|
-
|
85
|
-
def format_event(event_tuple, parent_tree=None):
|
86
|
-
event_type, event = event_tuple
|
87
|
-
desc = f"[bold]{event_type}[/bold]"
|
88
|
-
# Modular logic for each possible component
|
89
|
-
desc += _event_timestamp(event)
|
90
|
-
desc += _event_tool_name(event)
|
91
|
-
desc += _event_params(event)
|
92
|
-
desc += _event_result(event)
|
93
|
-
desc += _event_error(event)
|
94
|
-
desc += _event_message(event)
|
95
|
-
desc += _event_subtype(event)
|
96
|
-
desc += _event_status(event)
|
97
|
-
desc += _event_duration(event)
|
98
|
-
if parent_tree is not None:
|
99
|
-
node = parent_tree.add(desc)
|
100
|
-
else:
|
101
|
-
node = Tree(desc)
|
102
|
-
return node
|
103
|
-
|
104
|
-
|
105
|
-
def drill_down_last_generation():
|
106
|
-
events = collector.get_all_events()
|
107
|
-
# Find the last RequestStarted
|
108
|
-
last_gen_start = None
|
109
|
-
for i in range(len(events) - 1, -1, -1):
|
110
|
-
if events[i][0] == "RequestStarted":
|
111
|
-
last_gen_start = i
|
112
|
-
break
|
113
|
-
if last_gen_start is None:
|
114
|
-
rprint("[red]No generations found.[/red]")
|
115
|
-
return
|
116
|
-
# Find the next GenerationFinished after last_gen_start
|
117
|
-
for j in range(last_gen_start + 1, len(events)):
|
118
|
-
if events[j][0] == "GenerationFinished":
|
119
|
-
last_gen_end = j
|
120
|
-
break
|
121
|
-
else:
|
122
|
-
last_gen_end = len(events) - 1
|
123
|
-
gen_events = events[last_gen_start : last_gen_end + 1]
|
124
|
-
tree = Tree("[bold green]Last Generation Details[/bold green]")
|
125
|
-
for evt in gen_events:
|
126
|
-
format_event(evt, tree)
|
127
|
-
console = Console()
|
128
|
-
console.print(tree)
|
129
|
-
|
130
|
-
|
131
|
-
class LastShellHandler(ShellCmdHandler):
|
132
|
-
help_text = (
|
133
|
-
"Show details of the last generation, with drill-down of tool executions."
|
134
|
-
)
|
135
|
-
|
136
|
-
def run(self):
|
137
|
-
drill_down_last_generation()
|
@@ -1,54 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Google Gemini LLM driver.
|
3
|
-
|
4
|
-
This driver handles interaction with the Google Gemini API, including support for tool/function calls and event publishing.
|
5
|
-
"""
|
6
|
-
|
7
|
-
import json
|
8
|
-
import time
|
9
|
-
import uuid
|
10
|
-
import traceback
|
11
|
-
from typing import Optional, List, Dict, Any, Union
|
12
|
-
from janito.llm.driver import LLMDriver
|
13
|
-
from janito.drivers.google_genai.schema_generator import generate_tool_declarations
|
14
|
-
from janito.driver_events import (
|
15
|
-
GenerationStarted,
|
16
|
-
GenerationFinished,
|
17
|
-
RequestStarted,
|
18
|
-
RequestFinished,
|
19
|
-
ResponseReceived,
|
20
|
-
RequestStatus,
|
21
|
-
)
|
22
|
-
from janito.tools.adapters.local.adapter import LocalToolsAdapter
|
23
|
-
from janito.llm.message_parts import TextMessagePart, FunctionCallMessagePart
|
24
|
-
from janito.llm.driver_config import LLMDriverConfig
|
25
|
-
|
26
|
-
|
27
|
-
def extract_usage_metadata_native(usage_obj):
|
28
|
-
if usage_obj is None:
|
29
|
-
return {}
|
30
|
-
result = {}
|
31
|
-
for attr in dir(usage_obj):
|
32
|
-
if attr.startswith("_") or attr == "__class__":
|
33
|
-
continue
|
34
|
-
value = getattr(usage_obj, attr)
|
35
|
-
if isinstance(value, (str, int, float, bool, type(None))):
|
36
|
-
result[attr] = value
|
37
|
-
elif isinstance(value, list):
|
38
|
-
if all(isinstance(i, (str, int, float, bool, type(None))) for i in value):
|
39
|
-
result[attr] = value
|
40
|
-
return result
|
41
|
-
|
42
|
-
|
43
|
-
class GoogleGenaiModelDriver(LLMDriver):
|
44
|
-
available = False
|
45
|
-
unavailable_reason = "GoogleGenaiModelDriver is not implemented yet."
|
46
|
-
|
47
|
-
@classmethod
|
48
|
-
def is_available(cls):
|
49
|
-
return cls.available
|
50
|
-
|
51
|
-
name = "google_genai"
|
52
|
-
|
53
|
-
def __init__(self, tools_adapter=None):
|
54
|
-
raise ImportError(self.unavailable_reason)
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import inspect
|
2
|
-
import typing
|
3
|
-
from janito.tools.tools_schema import ToolSchemaBase
|
4
|
-
|
5
|
-
try:
|
6
|
-
from google.genai import types as genai_types
|
7
|
-
except ImportError:
|
8
|
-
genai_types = None
|
9
|
-
|
10
|
-
|
11
|
-
class GeminiSchemaGenerator(ToolSchemaBase):
|
12
|
-
PYTHON_TYPE_TO_GENAI_TYPE = {
|
13
|
-
str: "STRING",
|
14
|
-
int: "INTEGER",
|
15
|
-
float: "NUMBER",
|
16
|
-
bool: "BOOLEAN",
|
17
|
-
list: "ARRAY",
|
18
|
-
dict: "OBJECT",
|
19
|
-
}
|
20
|
-
|
21
|
-
def type_to_genai_schema(self, annotation, description=None):
|
22
|
-
if hasattr(annotation, "__origin__"):
|
23
|
-
if annotation.__origin__ is list or annotation.__origin__ is typing.List:
|
24
|
-
return genai_types.Schema(
|
25
|
-
type="ARRAY",
|
26
|
-
items=self.type_to_genai_schema(annotation.__args__[0]),
|
27
|
-
description=description,
|
28
|
-
)
|
29
|
-
if annotation.__origin__ is dict or annotation.__origin__ is typing.Dict:
|
30
|
-
return genai_types.Schema(type="OBJECT", description=description)
|
31
|
-
return genai_types.Schema(
|
32
|
-
type=self.PYTHON_TYPE_TO_GENAI_TYPE.get(annotation, "STRING"),
|
33
|
-
description=description,
|
34
|
-
)
|
35
|
-
|
36
|
-
def generate_declaration(self, tool_class):
|
37
|
-
func, tool_name, sig, summary, param_descs, return_desc, description = (
|
38
|
-
self.validate_tool_class(tool_class)
|
39
|
-
)
|
40
|
-
properties = {}
|
41
|
-
required = []
|
42
|
-
# Removed tool_call_reason from properties and required
|
43
|
-
for name, param in sig.parameters.items():
|
44
|
-
if name == "self":
|
45
|
-
continue
|
46
|
-
annotation = param.annotation
|
47
|
-
pdesc = param_descs.get(name, "")
|
48
|
-
schema = self.type_to_genai_schema(annotation, description=pdesc)
|
49
|
-
properties[name] = schema
|
50
|
-
if param.default == inspect._empty:
|
51
|
-
required.append(name)
|
52
|
-
parameters_schema = genai_types.Schema(
|
53
|
-
type="OBJECT", properties=properties, required=required
|
54
|
-
)
|
55
|
-
return genai_types.FunctionDeclaration(
|
56
|
-
name=tool_name, description=description, parameters=parameters_schema
|
57
|
-
)
|
58
|
-
|
59
|
-
|
60
|
-
def generate_tool_declarations(tool_classes: list):
|
61
|
-
if genai_types is None:
|
62
|
-
raise ImportError("google-genai package is not installed.")
|
63
|
-
generator = GeminiSchemaGenerator()
|
64
|
-
function_declarations = [
|
65
|
-
generator.generate_declaration(tool_class) for tool_class in tool_classes
|
66
|
-
]
|
67
|
-
return [genai_types.Tool(function_declarations=function_declarations)]
|