janito 2.10.0__py3-none-any.whl → 2.14.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/agent/setup_agent.py +1 -1
- janito/cli/chat_mode/session.py +9 -0
- janito/cli/cli_commands/list_drivers.py +137 -0
- janito/cli/core/getters.py +6 -1
- janito/cli/core/model_guesser.py +51 -0
- janito/cli/core/runner.py +13 -1
- janito/cli/main_cli.py +15 -10
- janito/drivers/openai/driver.py +3 -2
- janito/drivers/zai/__init__.py +1 -0
- janito/drivers/zai/driver.py +476 -0
- janito/mkdocs.yml +1 -1
- janito/providers/__init__.py +1 -0
- janito/providers/alibaba/model_info.py +7 -0
- janito/providers/alibaba/provider.py +1 -1
- janito/providers/zai/__init__.py +1 -0
- janito/providers/zai/model_info.py +38 -0
- janito/providers/zai/provider.py +131 -0
- janito/providers/zai/schema_generator.py +135 -0
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/METADATA +1 -1
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/RECORD +24 -18
- janito/docs/PROVIDERS.md +0 -224
- janito/drivers/driver_registry.py +0 -27
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/WHEEL +0 -0
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/entry_points.txt +0 -0
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/licenses/LICENSE +0 -0
- {janito-2.10.0.dist-info → janito-2.14.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
"""
|
2
|
+
Generate OpenAI-compatible tool schemas for Z.AI API.
|
3
|
+
"""
|
4
|
+
|
5
|
+
import inspect
|
6
|
+
from typing import get_type_hints, Dict, Any, Optional, List, Union
|
7
|
+
from janito.tools.tool_base import ToolBase
|
8
|
+
|
9
|
+
|
10
|
+
def generate_tool_schemas(tool_classes):
|
11
|
+
"""
|
12
|
+
Generate OpenAI-compatible tool schemas from tool classes.
|
13
|
+
|
14
|
+
Args:
|
15
|
+
tool_classes: List of Tool classes to generate schemas for
|
16
|
+
|
17
|
+
Returns:
|
18
|
+
List of OpenAI-compatible tool schemas
|
19
|
+
"""
|
20
|
+
schemas = []
|
21
|
+
for tool_class in tool_classes:
|
22
|
+
schema = generate_tool_schema(tool_class)
|
23
|
+
if schema:
|
24
|
+
schemas.append(schema)
|
25
|
+
return schemas
|
26
|
+
|
27
|
+
|
28
|
+
def generate_tool_schema(tool_class):
|
29
|
+
"""
|
30
|
+
Generate an OpenAI-compatible tool schema from a Tool class.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
tool_class: Tool class to generate schema for
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
OpenAI-compatible tool schema dict
|
37
|
+
"""
|
38
|
+
if not issubclass(tool_class, ToolBase):
|
39
|
+
return None
|
40
|
+
|
41
|
+
tool_instance = tool_class()
|
42
|
+
|
43
|
+
# Get the execute or run method
|
44
|
+
execute_method = getattr(tool_class, "execute", None)
|
45
|
+
if execute_method is None:
|
46
|
+
execute_method = getattr(tool_class, "run", None)
|
47
|
+
if execute_method is None:
|
48
|
+
return None
|
49
|
+
|
50
|
+
# Get method signature and type hints
|
51
|
+
try:
|
52
|
+
sig = inspect.signature(execute_method)
|
53
|
+
type_hints = get_type_hints(execute_method)
|
54
|
+
except (ValueError, TypeError):
|
55
|
+
return None
|
56
|
+
|
57
|
+
# Build parameters schema
|
58
|
+
properties = {}
|
59
|
+
required = []
|
60
|
+
|
61
|
+
for param_name, param in sig.parameters.items():
|
62
|
+
if param_name == "self":
|
63
|
+
continue
|
64
|
+
|
65
|
+
param_type = type_hints.get(param_name, str)
|
66
|
+
param_schema = python_type_to_json_schema(param_type)
|
67
|
+
|
68
|
+
# Add description if available
|
69
|
+
if hasattr(tool_instance, "get_parameter_description"):
|
70
|
+
desc = tool_instance.get_parameter_description(param_name)
|
71
|
+
if desc:
|
72
|
+
param_schema["description"] = desc
|
73
|
+
|
74
|
+
properties[param_name] = param_schema
|
75
|
+
|
76
|
+
# Check if required
|
77
|
+
if param.default == inspect.Parameter.empty:
|
78
|
+
required.append(param_name)
|
79
|
+
|
80
|
+
schema = {
|
81
|
+
"type": "function",
|
82
|
+
"function": {
|
83
|
+
"name": getattr(tool_instance, "tool_name", tool_class.__name__),
|
84
|
+
"description": getattr(
|
85
|
+
tool_instance, "description", f"Execute {tool_class.__name__}"
|
86
|
+
),
|
87
|
+
"parameters": {
|
88
|
+
"type": "object",
|
89
|
+
"properties": properties,
|
90
|
+
"required": required,
|
91
|
+
"additionalProperties": False,
|
92
|
+
},
|
93
|
+
},
|
94
|
+
}
|
95
|
+
|
96
|
+
return schema
|
97
|
+
|
98
|
+
|
99
|
+
def python_type_to_json_schema(python_type):
|
100
|
+
"""
|
101
|
+
Convert Python type hints to JSON schema types.
|
102
|
+
|
103
|
+
Args:
|
104
|
+
python_type: Python type hint
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
JSON schema dict
|
108
|
+
"""
|
109
|
+
if python_type == str:
|
110
|
+
return {"type": "string"}
|
111
|
+
elif python_type == int:
|
112
|
+
return {"type": "integer"}
|
113
|
+
elif python_type == float:
|
114
|
+
return {"type": "number"}
|
115
|
+
elif python_type == bool:
|
116
|
+
return {"type": "boolean"}
|
117
|
+
elif hasattr(python_type, "__origin__"):
|
118
|
+
# Handle generic types
|
119
|
+
origin = python_type.__origin__
|
120
|
+
if origin == list or origin == List:
|
121
|
+
args = getattr(python_type, "__args__", (str,))
|
122
|
+
item_type = args[0] if args else str
|
123
|
+
return {"type": "array", "items": python_type_to_json_schema(item_type)}
|
124
|
+
elif origin == dict or origin == Dict:
|
125
|
+
return {"type": "object"}
|
126
|
+
elif origin == Union:
|
127
|
+
args = getattr(python_type, "__args__", ())
|
128
|
+
# Handle Optional types (Union with None)
|
129
|
+
if len(args) == 2 and type(None) in args:
|
130
|
+
non_none_type = args[0] if args[1] is type(None) else args[1]
|
131
|
+
schema = python_type_to_json_schema(non_none_type)
|
132
|
+
return schema
|
133
|
+
|
134
|
+
# Default fallback
|
135
|
+
return {"type": "string"}
|
@@ -11,7 +11,7 @@ janito/exceptions.py,sha256=l4AepRdWwAuLp5fUygrBBgO9rpwgfV6JvY1afOdq2pw,913
|
|
11
11
|
janito/formatting.py,sha256=SMvOmL6bst3KGcI7OLa5D4DE127fQYuHZS3oY8OPsn8,2031
|
12
12
|
janito/formatting_token.py,sha256=9Pz0svhV0pyNuGRXSmVkGDaQC8N-koTkf50AJR_gtSo,2217
|
13
13
|
janito/gitignore_utils.py,sha256=P3iF9fMWAomqULq2xsoqHtI9uNIFSPcagljrxZshmLw,4110
|
14
|
-
janito/mkdocs.yml,sha256=
|
14
|
+
janito/mkdocs.yml,sha256=hceV1mnCuj5Eo42jJQHSAhqHC4emiMExgnISiiwqSow,925
|
15
15
|
janito/perf_singleton.py,sha256=g1h0Sdf4ydzegeEpJlMhQt4H0GQZ2hryXrdYOTL-b30,113
|
16
16
|
janito/performance_collector.py,sha256=RYu4av16Trj3RljJZ8-2Gbn1KlGdJUosrcVFYtwviNI,6285
|
17
17
|
janito/platform_discovery.py,sha256=JN3kC7hkxdvuj-AyrJTlbbDJjtNHke3fdlZDqGi_uz0,4621
|
@@ -20,7 +20,7 @@ janito/provider_registry.py,sha256=l0jJZ74KIebOSYXPiy7uqH8d48pckR_WTyAO4iQF98o,6
|
|
20
20
|
janito/report_events.py,sha256=q4OR_jTZNfcqaQF_fzTjgqo6_VlUIxSGWfhpT4nJWcw,938
|
21
21
|
janito/shell.bak.zip,sha256=hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU,22
|
22
22
|
janito/utils.py,sha256=eXSsMgM69YyzahgCNrJQLcEbB8ssLI1MQqaa20ONxbE,376
|
23
|
-
janito/agent/setup_agent.py,sha256=
|
23
|
+
janito/agent/setup_agent.py,sha256=ibi1oHyAFkf0FHgN6QCHXF8tz8IfM79ugAMlVKttWYw,11605
|
24
24
|
janito/agent/templates/profiles/system_prompt_template_Developer_with_Python_Tools.txt.j2,sha256=28TITVITH4RTdOwPpNZFSygm6OSpFb_Jr4mHprrLBhc,2584
|
25
25
|
janito/agent/templates/profiles/system_prompt_template_developer.txt.j2,sha256=zj0ZA17iYt-6c0usgjUw_cLKnb5qDuixpxS9et5ECyw,2272
|
26
26
|
janito/agent/templates/profiles/system_prompt_template_model_conversation_without_tools_or_context.txt.j2,sha256=dTV9aF8ji2r9dzi-l4b9r95kHrbKmjvnRxk5cVpopN4,28
|
@@ -28,7 +28,7 @@ janito/cli/__init__.py,sha256=xaPDOrWphBbCR63Xpcx_yfpXSJIlCaaICc4j2qpWqrM,194
|
|
28
28
|
janito/cli/config.py,sha256=HkZ14701HzIqrvaNyDcDhGlVHfpX_uHlLp2rHmhRm_k,872
|
29
29
|
janito/cli/console.py,sha256=gJolqzWL7jEPLxeuH-CwBDRFpXt976KdZOEAB2tdBDs,64
|
30
30
|
janito/cli/main.py,sha256=s5odou0txf8pzTf1ADk2yV7T5m8B6cejJ81e7iu776U,312
|
31
|
-
janito/cli/main_cli.py,sha256=
|
31
|
+
janito/cli/main_cli.py,sha256=figOoRlmegu6fyl-bmDbnYY5EQIcOEdJ6h2K6Qe1E7Q,14273
|
32
32
|
janito/cli/prompt_core.py,sha256=F68J4Xl6jZMYFN4oBBYZFj15Jp-HTYoLub4bw2XpNRU,11648
|
33
33
|
janito/cli/prompt_handler.py,sha256=SnPTlL64noeAMGlI08VBDD5IDD8jlVMIYA4-fS8zVLg,215
|
34
34
|
janito/cli/prompt_setup.py,sha256=1s5yccFaWMgDkUjkvnTYGEWJAFPJ6hIiqwbrLfzWxMI,2038
|
@@ -39,7 +39,7 @@ janito/cli/chat_mode/bindings.py,sha256=odjc5_-YW1t2FRhBUNRNoBMoQIg5sMz3ktV7xG0A
|
|
39
39
|
janito/cli/chat_mode/chat_entry.py,sha256=RFdPd23jsA2DMHRacpjAdwI_1dFBaWrtnwyQEgb2fHA,475
|
40
40
|
janito/cli/chat_mode/prompt_style.py,sha256=vsqQ9xxmrYjj1pWuVe9CayQf39fo2EIXrkKPkflSVn4,805
|
41
41
|
janito/cli/chat_mode/script_runner.py,sha256=wOwEn4bgmjqHqjTqtfyaSOnRPsGf4ZVW-YAWhEeqxXU,6507
|
42
|
-
janito/cli/chat_mode/session.py,sha256=
|
42
|
+
janito/cli/chat_mode/session.py,sha256=o-Eh3oGAMpSdOj38xTubVi8_z3Pz3HUfGd-ZyeDlejw,13262
|
43
43
|
janito/cli/chat_mode/session_profile_select.py,sha256=CJ2g3VbPGWfBNrNkYYX57oIJZJ-hIZBNGB-zcdjC9vk,5379
|
44
44
|
janito/cli/chat_mode/toolbar.py,sha256=bJ9jPaTInp2gB3yjSVJp8mpNEFiOslzNhVaiqpXJhKc,3025
|
45
45
|
janito/cli/chat_mode/shell/autocomplete.py,sha256=lE68MaVaodbA2VfUM0_YLqQVLBJAE_BJsd5cMtwuD-g,793
|
@@ -73,6 +73,7 @@ janito/cli/chat_mode/shell/session/__init__.py,sha256=uTYE_QpZFEn7v9QE5o1LdulpCW
|
|
73
73
|
janito/cli/chat_mode/shell/session/history.py,sha256=tYav6GgjAZkvWhlI_rfG6OArNqW6Wn2DTv39Hb20QYc,1262
|
74
74
|
janito/cli/chat_mode/shell/session/manager.py,sha256=MwD9reHsRaly0CyRB-S1JJ0wPKz2g8Xdj2VvlU35Hgc,1001
|
75
75
|
janito/cli/cli_commands/list_config.py,sha256=oiQEGaGPjwjG-PrOcakpNMbbqISTsBEs7rkGH3ceQsI,1179
|
76
|
+
janito/cli/cli_commands/list_drivers.py,sha256=u7o0xk4V5iScC4iPM_a5rFIiRqHtCNZse4ilszAZ1B0,4715
|
76
77
|
janito/cli/cli_commands/list_models.py,sha256=_rqHz89GsNLcH0GGkFqPue7ah4ZbN9YHm0lEP30Aa-A,1111
|
77
78
|
janito/cli/cli_commands/list_profiles.py,sha256=9-HV2EbtP2AdubbMoakjbu7Oq4Ss9UDyO7Eb6CC52wI,2681
|
78
79
|
janito/cli/cli_commands/list_providers.py,sha256=v8OQ8ULnuzNuvgkeKqGXGj69eOiavAlPGhzfR0zavhg,185
|
@@ -84,20 +85,21 @@ janito/cli/cli_commands/show_config.py,sha256=eYMcuvU-d7mvvuctbQacZFERqcKHEnxaRR
|
|
84
85
|
janito/cli/cli_commands/show_system_prompt.py,sha256=9ZJGW7lIGJ9LX2JZiWVEm4AbaD0qEQO7LF89jPgk52I,5232
|
85
86
|
janito/cli/core/__init__.py,sha256=YH95fhgY9yBX8RgqX9dSrEkl4exjV0T4rbmJ6xUpG-Y,196
|
86
87
|
janito/cli/core/event_logger.py,sha256=1X6lR0Ax7AgF8HlPWFoY5Ystuu7Bh4ooTo78vXzeGB0,2008
|
87
|
-
janito/cli/core/getters.py,sha256=
|
88
|
-
janito/cli/core/
|
88
|
+
janito/cli/core/getters.py,sha256=glUtg8K_q0vMAaLG91J9JRq5f26nJLGbDVghSNx9s28,2050
|
89
|
+
janito/cli/core/model_guesser.py,sha256=jzkkiQ-J2buT2Omh6jYZHa8-zCJxqKQBL08Z58pe1_o,1741
|
90
|
+
janito/cli/core/runner.py,sha256=3vP92XEUzzHeOWbMHg82iISsXVUAM7y8YKWGNSIMyA8,8337
|
89
91
|
janito/cli/core/setters.py,sha256=PD3aT1y1q8XWQVtRNfrU0dtlW4JGdn6BMJyP7FCQWhc,4623
|
90
92
|
janito/cli/core/unsetters.py,sha256=FEw9gCt0vRvoCt0kRSNfVB2tzi_TqppJIx2nHPP59-k,2012
|
91
93
|
janito/cli/single_shot_mode/__init__.py,sha256=Ct99pKe9tINzVW6oedZJfzfZQKWpXz-weSSCn0hrwHY,115
|
92
94
|
janito/cli/single_shot_mode/handler.py,sha256=U70X7c9MHbmj1vQlTI-Ao2JvRprpLbPh9wL5gAMbEhs,3790
|
93
95
|
janito/docs/GETTING_STARTED.md,sha256=EbXV7B3XxjSy1E0XQJFOVITVbTmZBVB7pjth2Mb4_rg,2835
|
94
|
-
janito/docs/PROVIDERS.md,sha256=ZJK6A2j7uA651K5ypDnm-UQsnorCZvcU4qUrBPxpf0Y,4775
|
95
96
|
janito/drivers/dashscope.bak.zip,sha256=9Pv4Xyciju8jO1lEMFVgYXexoZkxmDO3Ig6vw3ODfL8,4936
|
96
|
-
janito/drivers/driver_registry.py,sha256=sbij7R71JJqJVeMfmaU-FKsEuZVO8oEn6Qp8020hdZw,773
|
97
97
|
janito/drivers/openai_responses.bak.zip,sha256=E43eDCHGa2tCtdjzj_pMnWDdnsOZzj8BJTR5tJp8wcM,13352
|
98
98
|
janito/drivers/azure_openai/driver.py,sha256=rec2D4DDuMjdnbGNIsrnB0oiwuxL_zBykJeUGa-PffI,4074
|
99
99
|
janito/drivers/openai/README.md,sha256=bgPdaYX0pyotCoJ9t3cJbYM-teQ_YM1DAFEKLCMP32Q,666
|
100
|
-
janito/drivers/openai/driver.py,sha256=
|
100
|
+
janito/drivers/openai/driver.py,sha256=O0AAp-aF3TKQLp_FSsRWm_QDG_mKliLlpDjf09fWzl4,19061
|
101
|
+
janito/drivers/zai/__init__.py,sha256=rleES3ZJEslJ8M02TdTPyxHKXxA4-e2fDJa6yjuzY8s,22
|
102
|
+
janito/drivers/zai/driver.py,sha256=YqdOBMltsjWq8nFttW61wSVpppS-YQh_F-nhVdIvZ_o,19245
|
101
103
|
janito/event_bus/__init__.py,sha256=VG6GOhKMBh0O_92D-zW8a3YitJPKDajGgPiFezTXlNE,77
|
102
104
|
janito/event_bus/bus.py,sha256=LokZbAdwcWhWOyKSp7H3Ism57x4EZhxlRPjl3NE4UKU,2847
|
103
105
|
janito/event_bus/event.py,sha256=MtgcBPD7cvCuubiLIyo-BWcsNSO-941HLk6bScHTJtQ,427
|
@@ -117,12 +119,12 @@ janito/llm/driver_input.py,sha256=Zq7IO4KdQPUraeIo6XoOaRy1IdQAyYY15RQw4JU30uA,38
|
|
117
119
|
janito/llm/message_parts.py,sha256=QY_0kDjaxdoErDgKPRPv1dNkkYJuXIBmHWNLiOEKAH4,1365
|
118
120
|
janito/llm/model.py,sha256=42hjcffZDTuzjAJoVhDcDqwIXm6rUmmi5UwTOYopf5w,1131
|
119
121
|
janito/llm/provider.py,sha256=3FbhQPrWBSEoIdIi-5DWIh0DD_CM570EFf1NcuGyGko,7961
|
120
|
-
janito/providers/__init__.py,sha256
|
122
|
+
janito/providers/__init__.py,sha256=P2r90SUduTqn0CumjpJ9yojx2BUKDVy136xdbA8I6VU,407
|
121
123
|
janito/providers/dashscope.bak.zip,sha256=BwXxRmZreEivvRtmqbr5BR62IFVlNjAf4y6DrF2BVJo,5998
|
122
124
|
janito/providers/registry.py,sha256=Ygwv9eVrTXOKhv0EKxSWQXO5WMHvajWE2Q_Lc3p7dKo,730
|
123
125
|
janito/providers/alibaba/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
|
-
janito/providers/alibaba/model_info.py,sha256=
|
125
|
-
janito/providers/alibaba/provider.py,sha256=
|
126
|
+
janito/providers/alibaba/model_info.py,sha256=evAW2CZUX9qgRAzDhZTp47ZNj4G1T7W66gkV60Nfan8,1264
|
127
|
+
janito/providers/alibaba/provider.py,sha256=JOkR0pKCpuG1z5KQ35TaEw6Egfp7g1gU7XiT8aeZp-0,4304
|
126
128
|
janito/providers/anthropic/model_info.py,sha256=m6pBh0Ia8_xC1KZ7ke_4HeHIFw7nWjnYVItnRpkCSWc,1206
|
127
129
|
janito/providers/anthropic/provider.py,sha256=JS74pDs7gSpwvG0jY-MDO5rljO0JJOffSjaL1LK1YlE,3165
|
128
130
|
janito/providers/azure_openai/model_info.py,sha256=TMSqEpQROIIYUGAyulYJ5xGhj7CbLoaKL_JXeLbXaG0,689
|
@@ -140,6 +142,10 @@ janito/providers/openai/__init__.py,sha256=f0m16-sIqScjL9Mp4A0CQBZx6H3PTEy0cnE08
|
|
140
142
|
janito/providers/openai/model_info.py,sha256=cz08O26Ychm-aP3T8guJRqpR96Im9Cwtgl2iMgM7tJs,3384
|
141
143
|
janito/providers/openai/provider.py,sha256=U9Bp9g2KQ58J6-B5vDgsXM05xASsgaWQOofewC7hiXs,5145
|
142
144
|
janito/providers/openai/schema_generator.py,sha256=hTqeLcPTR8jeKn5DUUpo7b-EZ-V-g1WwXiX7MbHnFzE,2234
|
145
|
+
janito/providers/zai/__init__.py,sha256=qtIr9_QBFaXG8xB6cRDGhS7se6ir11CWseI9azLMRBo,24
|
146
|
+
janito/providers/zai/model_info.py,sha256=ldwD8enpxXv1G-YsDw4YJn31YsVueQ4vj5HgoYvnPxo,1183
|
147
|
+
janito/providers/zai/provider.py,sha256=9RLVchSUzUlcsugd6fKEB1jZbWvJsAjKsb5XaxM5Tdo,5417
|
148
|
+
janito/providers/zai/schema_generator.py,sha256=0kuxbrWfNKGO9fzxFStqOpTT09ldyI6vYxeDxFN4ku8,4091
|
143
149
|
janito/tools/DOCSTRING_STANDARD.txt,sha256=VLPwNgjxRVD_xZSSVvUZ4H-4bBwM-VKh_RyfzYQsYSs,1735
|
144
150
|
janito/tools/README.md,sha256=5HkLpF5k4PENJER7SlDPRXj0yo9mpHvAHW4uuzhq4ak,115
|
145
151
|
janito/tools/__init__.py,sha256=W1B39PztC2UF7PS2WyLH6el32MFOETMlN1-LurOROCg,1171
|
@@ -201,9 +207,9 @@ janito/tools/adapters/local/validate_file_syntax/ps1_validator.py,sha256=TeIkPt0
|
|
201
207
|
janito/tools/adapters/local/validate_file_syntax/python_validator.py,sha256=BfCO_K18qy92m-2ZVvHsbEU5e11OPo1pO9Vz4G4616E,130
|
202
208
|
janito/tools/adapters/local/validate_file_syntax/xml_validator.py,sha256=AijlsP_PgNuC8ZbGsC5vOTt3Jur76otQzkd_7qR0QFY,284
|
203
209
|
janito/tools/adapters/local/validate_file_syntax/yaml_validator.py,sha256=TgyI0HRL6ug_gBcWEm5TGJJuA4E34ZXcIzMpAbv3oJs,155
|
204
|
-
janito-2.
|
205
|
-
janito-2.
|
206
|
-
janito-2.
|
207
|
-
janito-2.
|
208
|
-
janito-2.
|
209
|
-
janito-2.
|
210
|
+
janito-2.14.0.dist-info/licenses/LICENSE,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
|
211
|
+
janito-2.14.0.dist-info/METADATA,sha256=l3vlitZrrayIG-WdOza2JqsTeOBEgtH_Md1FZXz_GSw,16365
|
212
|
+
janito-2.14.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
213
|
+
janito-2.14.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
|
214
|
+
janito-2.14.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
|
215
|
+
janito-2.14.0.dist-info/RECORD,,
|
janito/docs/PROVIDERS.md
DELETED
@@ -1,224 +0,0 @@
|
|
1
|
-
# Provider Configuration Guide
|
2
|
-
|
3
|
-
This guide covers how to configure and use different LLM providers with Janito.
|
4
|
-
|
5
|
-
## MoonshotAI (Recommended)
|
6
|
-
|
7
|
-
**MoonshotAI** is the recommended default provider for Janito, offering excellent performance and competitive pricing.
|
8
|
-
|
9
|
-
### Setup
|
10
|
-
```bash
|
11
|
-
# Set API key
|
12
|
-
janito --set-api-key YOUR_API_KEY -p moonshotai
|
13
|
-
|
14
|
-
# Set as default provider
|
15
|
-
janito --set provider=moonshotai
|
16
|
-
janito --set model=kimi-k1-8k
|
17
|
-
```
|
18
|
-
|
19
|
-
### Available Models
|
20
|
-
|
21
|
-
- **kimi-k1-8k**: Fast, general-purpose model (8k context)
|
22
|
-
- **kimi-k1-32k**: Extended context model (32k context)
|
23
|
-
- **kimi-k1-128k**: Long context model (128k context)
|
24
|
-
- **kimi-k2-turbo-preview**: Latest enhanced model
|
25
|
-
|
26
|
-
### Environment Variables
|
27
|
-
```bash
|
28
|
-
export MOONSHOTAI_API_KEY=your_key_here
|
29
|
-
```
|
30
|
-
|
31
|
-
## OpenAI
|
32
|
-
|
33
|
-
### Setup
|
34
|
-
```bash
|
35
|
-
# Set API key
|
36
|
-
janito --set-api-key YOUR_API_KEY -p openai
|
37
|
-
|
38
|
-
# Use specific model
|
39
|
-
janito -p openai -m gpt-4 "Your prompt"
|
40
|
-
```
|
41
|
-
|
42
|
-
### Available Models
|
43
|
-
|
44
|
-
- **gpt-4**: Most capable model
|
45
|
-
- **gpt-4-turbo**: Faster, more efficient
|
46
|
-
- **gpt-3.5-turbo**: Cost-effective option
|
47
|
-
|
48
|
-
### Environment Variables
|
49
|
-
```bash
|
50
|
-
export OPENAI_API_KEY=your_key_here
|
51
|
-
```
|
52
|
-
|
53
|
-
## Anthropic
|
54
|
-
|
55
|
-
### Setup
|
56
|
-
```bash
|
57
|
-
# Set API key
|
58
|
-
janito --set-api-key YOUR_API_KEY -p anthropic
|
59
|
-
|
60
|
-
# Use Claude models
|
61
|
-
janito -p anthropic -m claude-3-5-sonnet-20241022 "Your prompt"
|
62
|
-
```
|
63
|
-
|
64
|
-
### Available Models
|
65
|
-
|
66
|
-
- **claude-3-5-sonnet-20241022**: Most capable
|
67
|
-
- **claude-3-opus-20240229**: High performance
|
68
|
-
- **claude-3-haiku-20240307**: Fast and cost-effective
|
69
|
-
|
70
|
-
### Environment Variables
|
71
|
-
```bash
|
72
|
-
export ANTHROPIC_API_KEY=your_key_here
|
73
|
-
```
|
74
|
-
|
75
|
-
## Google
|
76
|
-
|
77
|
-
### Setup
|
78
|
-
```bash
|
79
|
-
# Set API key
|
80
|
-
janito --set-api-key YOUR_API_KEY -p google
|
81
|
-
|
82
|
-
# Use Gemini models
|
83
|
-
janito -p google -m gemini-2.0-flash-exp "Your prompt"
|
84
|
-
```
|
85
|
-
|
86
|
-
### Available Models
|
87
|
-
|
88
|
-
- **gemini-2.0-flash-exp**: Latest experimental model
|
89
|
-
- **gemini-1.5-pro**: Production-ready
|
90
|
-
- **gemini-1.5-flash**: Fast and efficient
|
91
|
-
|
92
|
-
### Environment Variables
|
93
|
-
```bash
|
94
|
-
export GOOGLE_API_KEY=your_key_here
|
95
|
-
```
|
96
|
-
|
97
|
-
## Azure OpenAI
|
98
|
-
|
99
|
-
### Setup
|
100
|
-
```bash
|
101
|
-
# Set configuration
|
102
|
-
janito --set-api-key YOUR_API_KEY -p azure-openai
|
103
|
-
janito --set azure_deployment_name=your_deployment_name -p azure-openai
|
104
|
-
```
|
105
|
-
|
106
|
-
### Configuration
|
107
|
-
|
108
|
-
Requires both API key and deployment name:
|
109
|
-
|
110
|
-
- **API Key**: Your Azure OpenAI key
|
111
|
-
- **Deployment Name**: Your Azure deployment name
|
112
|
-
- **Base URL**: Your Azure endpoint URL
|
113
|
-
|
114
|
-
### Environment Variables
|
115
|
-
```bash
|
116
|
-
export AZURE_OPENAI_API_KEY=your_key_here
|
117
|
-
export AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
|
118
|
-
```
|
119
|
-
|
120
|
-
## Other Providers
|
121
|
-
|
122
|
-
Janito also supports these providers through OpenAI-compatible APIs:
|
123
|
-
|
124
|
-
### Alibaba Cloud
|
125
|
-
```bash
|
126
|
-
janito --set-api-key YOUR_KEY -p alibaba
|
127
|
-
```
|
128
|
-
|
129
|
-
### DeepSeek
|
130
|
-
```bash
|
131
|
-
janito --set-api-key YOUR_KEY -p deepseek
|
132
|
-
```
|
133
|
-
|
134
|
-
### Groq
|
135
|
-
```bash
|
136
|
-
janito --set-api-key YOUR_KEY -p groq
|
137
|
-
```
|
138
|
-
|
139
|
-
### Mistral
|
140
|
-
```bash
|
141
|
-
janito --set-api-key YOUR_KEY -p mistral
|
142
|
-
```
|
143
|
-
|
144
|
-
## Configuration Management
|
145
|
-
|
146
|
-
### Check Current Configuration
|
147
|
-
```bash
|
148
|
-
janito --show-config
|
149
|
-
```
|
150
|
-
|
151
|
-
### List All Providers
|
152
|
-
```bash
|
153
|
-
janito --list-providers
|
154
|
-
```
|
155
|
-
|
156
|
-
### List Models for a Provider
|
157
|
-
```bash
|
158
|
-
janito -p moonshotai --list-models
|
159
|
-
janito -p openai --list-models
|
160
|
-
```
|
161
|
-
|
162
|
-
### Switch Providers
|
163
|
-
```bash
|
164
|
-
# Temporarily for one command
|
165
|
-
janito -p openai -m gpt-4 "Your prompt"
|
166
|
-
|
167
|
-
# Permanently as default
|
168
|
-
janito --set provider=openai
|
169
|
-
janito --set model=gpt-4
|
170
|
-
```
|
171
|
-
|
172
|
-
## Advanced Configuration
|
173
|
-
|
174
|
-
### Custom Base URLs
|
175
|
-
For OpenAI-compatible providers, you can set custom base URLs:
|
176
|
-
|
177
|
-
```bash
|
178
|
-
janito --set base_url=https://your-custom-endpoint.com -p openai
|
179
|
-
```
|
180
|
-
|
181
|
-
### Provider-Specific Settings
|
182
|
-
Each provider can have custom settings:
|
183
|
-
|
184
|
-
```bash
|
185
|
-
# Set temperature for a specific provider/model
|
186
|
-
janito --set temperature=0.7 -p moonshotai -m kimi-k1-8k
|
187
|
-
|
188
|
-
# Set max tokens
|
189
|
-
janito --set max_tokens=2000 -p openai -m gpt-4
|
190
|
-
```
|
191
|
-
|
192
|
-
## Troubleshooting
|
193
|
-
|
194
|
-
### Provider Not Found
|
195
|
-
```bash
|
196
|
-
# Check if provider is registered
|
197
|
-
janito --list-providers
|
198
|
-
|
199
|
-
# Re-register provider
|
200
|
-
janito --set-api-key YOUR_KEY -p PROVIDER_NAME
|
201
|
-
```
|
202
|
-
|
203
|
-
### API Key Issues
|
204
|
-
```bash
|
205
|
-
# Check current API key
|
206
|
-
janito --show-config
|
207
|
-
|
208
|
-
# Reset API key
|
209
|
-
janito --set-api-key NEW_KEY -p PROVIDER_NAME
|
210
|
-
```
|
211
|
-
|
212
|
-
### Model Not Available
|
213
|
-
```bash
|
214
|
-
# List available models for provider
|
215
|
-
janito -p PROVIDER_NAME --list-models
|
216
|
-
```
|
217
|
-
|
218
|
-
## Best Practices
|
219
|
-
|
220
|
-
1. **Start with MoonshotAI**: It's the recommended default for good reason
|
221
|
-
2. **Use environment variables**: For CI/CD and containerized environments
|
222
|
-
3. **Test different models**: Each has different strengths and pricing
|
223
|
-
4. **Monitor usage**: Keep track of API costs and rate limits
|
224
|
-
5. **Use profiles**: Set up different configurations for different use cases
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# janito/drivers/driver_registry.py
|
2
|
-
"""
|
3
|
-
DriverRegistry: Maps driver string names to class objects for use by providers.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import Dict, Type
|
7
|
-
|
8
|
-
# --- Import driver classes ---
|
9
|
-
from janito.drivers.azure_openai.driver import AzureOpenAIModelDriver
|
10
|
-
from janito.drivers.openai.driver import OpenAIModelDriver
|
11
|
-
|
12
|
-
_DRIVER_REGISTRY: Dict[str, Type] = {
|
13
|
-
"AzureOpenAIModelDriver": AzureOpenAIModelDriver,
|
14
|
-
"OpenAIModelDriver": OpenAIModelDriver,
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
def get_driver_class(name: str):
|
19
|
-
"""Get the driver class by string name."""
|
20
|
-
try:
|
21
|
-
return _DRIVER_REGISTRY[name]
|
22
|
-
except KeyError:
|
23
|
-
raise ValueError(f"No driver found for name: {name}")
|
24
|
-
|
25
|
-
|
26
|
-
def register_driver(name: str, cls: type):
|
27
|
-
_DRIVER_REGISTRY[name] = cls
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|