lionagi 0.17.11__py3-none-any.whl → 0.18.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.
- lionagi/libs/schema/minimal_yaml.py +98 -0
- lionagi/ln/types.py +32 -5
- lionagi/models/field_model.py +9 -0
- lionagi/operations/ReAct/ReAct.py +474 -237
- lionagi/operations/ReAct/utils.py +3 -0
- lionagi/operations/act/act.py +206 -0
- lionagi/operations/chat/chat.py +130 -114
- lionagi/operations/communicate/communicate.py +101 -42
- lionagi/operations/flow.py +4 -4
- lionagi/operations/interpret/interpret.py +65 -20
- lionagi/operations/operate/operate.py +212 -106
- lionagi/operations/parse/parse.py +170 -142
- lionagi/operations/select/select.py +78 -17
- lionagi/operations/select/utils.py +1 -1
- lionagi/operations/types.py +119 -23
- lionagi/protocols/generic/log.py +3 -2
- lionagi/protocols/messages/__init__.py +27 -0
- lionagi/protocols/messages/action_request.py +86 -184
- lionagi/protocols/messages/action_response.py +73 -131
- lionagi/protocols/messages/assistant_response.py +130 -159
- lionagi/protocols/messages/base.py +26 -18
- lionagi/protocols/messages/instruction.py +281 -625
- lionagi/protocols/messages/manager.py +112 -62
- lionagi/protocols/messages/message.py +87 -197
- lionagi/protocols/messages/system.py +52 -123
- lionagi/protocols/types.py +0 -2
- lionagi/service/connections/endpoint.py +0 -8
- lionagi/service/connections/providers/oai_.py +29 -94
- lionagi/service/connections/providers/ollama_.py +3 -2
- lionagi/service/hooks/hooked_event.py +2 -2
- lionagi/service/third_party/claude_code.py +3 -2
- lionagi/service/third_party/openai_models.py +433 -0
- lionagi/session/branch.py +170 -178
- lionagi/session/session.py +3 -9
- lionagi/tools/file/reader.py +2 -2
- lionagi/version.py +1 -1
- {lionagi-0.17.11.dist-info → lionagi-0.18.0.dist-info}/METADATA +1 -2
- {lionagi-0.17.11.dist-info → lionagi-0.18.0.dist-info}/RECORD +41 -49
- lionagi/operations/_act/act.py +0 -86
- lionagi/protocols/messages/templates/README.md +0 -28
- lionagi/protocols/messages/templates/action_request.jinja2 +0 -5
- lionagi/protocols/messages/templates/action_response.jinja2 +0 -9
- lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -6
- lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -61
- lionagi/protocols/messages/templates/system_message.jinja2 +0 -11
- lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -7
- lionagi/service/connections/providers/types.py +0 -28
- lionagi/service/third_party/openai_model_names.py +0 -198
- lionagi/service/types.py +0 -58
- /lionagi/operations/{_act → act}/__init__.py +0 -0
- {lionagi-0.17.11.dist-info → lionagi-0.18.0.dist-info}/WHEEL +0 -0
- {lionagi-0.17.11.dist-info → lionagi-0.18.0.dist-info}/licenses/LICENSE +0 -0
@@ -5,7 +5,7 @@ lionagi/_types.py,sha256=nGtsaSee7FaIZvym3PH8NPaN5PN8QscTgcZfpMNaMEo,1296
|
|
5
5
|
lionagi/config.py,sha256=meBzsT7xYDh1FwxGz_Q-XfOw3XkxPtlSJ1vqx9xk5YE,4779
|
6
6
|
lionagi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
lionagi/utils.py,sha256=j4wRrPiuHprx7l7j3z8U9NlPWMzrM8lHv5q3K_DJLPU,7080
|
8
|
-
lionagi/version.py,sha256=
|
8
|
+
lionagi/version.py,sha256=0EHw4xygmgkGSyfwNfEoMlQyN0uHxjHtlSFF79s6120,23
|
9
9
|
lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
lionagi/adapters/_utils.py,sha256=sniMG1LDDkwJNzUF2K32jv7rA6Y1QcohgyNclYsptzI,453
|
11
11
|
lionagi/adapters/async_postgres_adapter.py,sha256=-7Ah0A8JQvEEYBe2zMkze-65gYiUbpcJGxhYnzrv9ok,3285
|
@@ -28,6 +28,7 @@ lionagi/libs/schema/extract_code_block.py,sha256=ZaDucwumx2rBE3AwWb4EDMeYO7Mb2IJ
|
|
28
28
|
lionagi/libs/schema/extract_docstring.py,sha256=T_wiQfprlJniKNCeKuCxf_Oj7_6Pj_8HJ02ZjB3LelI,5710
|
29
29
|
lionagi/libs/schema/function_to_schema.py,sha256=uRMkpjXYgmL8kxdyVfOSTB-i0dRAbztSZPHI1LilRH8,5600
|
30
30
|
lionagi/libs/schema/load_pydantic_model_from_schema.py,sha256=IWPKhF_drI3VKABon45ufkiIb5hRYTS0sGWxhQLObpI,10112
|
31
|
+
lionagi/libs/schema/minimal_yaml.py,sha256=fj3LFn35o_KpFostcCYpJ6pQMrb1DICqIgxpnWriQRg,3085
|
31
32
|
lionagi/libs/validate/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
32
33
|
lionagi/libs/validate/common_field_validators.py,sha256=9PUabJZVFGeXShOOZ5jliRaXLefBovACllynAQCU0Ow,4774
|
33
34
|
lionagi/libs/validate/to_num.py,sha256=ZRHDjpTCykPfDIZZa4rZKNaR_8ZHbPDFlw9rc02DrII,11610
|
@@ -39,7 +40,7 @@ lionagi/ln/_json_dump.py,sha256=zOeoOE3JbaGAzL-lfAdMqdgaXWYXFliqcgXsZ_pxonI,1034
|
|
39
40
|
lionagi/ln/_list_call.py,sha256=zvISmCeNAH7yjBcusQI1s17n556tILgePhRMdAM2plA,2831
|
40
41
|
lionagi/ln/_to_list.py,sha256=V9hC3dpyMhRJwuuyOCU_wJygzEB6sJVZ0fmIRtM6uTg,6993
|
41
42
|
lionagi/ln/_utils.py,sha256=5Z_AsDxdtH5wNB-P4IiihhH0dYUcZMT-hTxFQBQPwL0,4303
|
42
|
-
lionagi/ln/types.py,sha256=
|
43
|
+
lionagi/ln/types.py,sha256=vUprqqW1nfHDNrOGk417NHEeEXpTpJqP9eqlMuEOaBI,11118
|
43
44
|
lionagi/ln/concurrency/__init__.py,sha256=xt_GLZ1Zb-nC-RnrNt8jOBWb_uf1md__B1R5cplMShg,1190
|
44
45
|
lionagi/ln/concurrency/_compat.py,sha256=itxdRzl95PLEBQvNY0zTriF39kymaNRpKncT8QsOomA,2065
|
45
46
|
lionagi/ln/concurrency/cancel.py,sha256=8JlWy_EVto4Fls1yQLBteCbpn4zP6ydnqIa_EL5kxZc,3313
|
@@ -57,7 +58,7 @@ lionagi/ln/fuzzy/_fuzzy_validate.py,sha256=XuafNXflTerQrQYV0S6MrQHR3_6DuYBv6BAYT
|
|
57
58
|
lionagi/ln/fuzzy/_string_similarity.py,sha256=01u73Bp4YPN-s7YMzQjbYM5d6mjKGSjJpar14Wab_5U,8792
|
58
59
|
lionagi/ln/fuzzy/_to_dict.py,sha256=Crz4sDIIcTZS3idxynWK7U4EdHvZooPDJIsOH3t6xgQ,12068
|
59
60
|
lionagi/models/__init__.py,sha256=Nq0RqoT7DXrpS1_lVgfrlZXl2_E2_E_HHANcbPlDfh8,418
|
60
|
-
lionagi/models/field_model.py,sha256=
|
61
|
+
lionagi/models/field_model.py,sha256=KDz1fVznJZgKSKIj5Lqb9d4rt8vtxmvZiiK-Og5HAh0,29618
|
61
62
|
lionagi/models/hashable_model.py,sha256=ny-eOj6kdPr2TLzKXt3Kyrg0kOylJd8AxWRK3VM4KQE,3300
|
62
63
|
lionagi/models/model_params.py,sha256=ZFknRIm1Qj-gBTNG1_jz7mjmoogXd2NpFObYPK42OK4,12110
|
63
64
|
lionagi/models/operable_model.py,sha256=t6EKeJzG4wqo4tHroPe873R_hMLpcWq4gUiwCC_8pcM,20175
|
@@ -65,42 +66,42 @@ lionagi/models/schema_model.py,sha256=atgySn8e3zcQdFDERMrfSS1ZKzRZjQCAlNNlnp22vI
|
|
65
66
|
lionagi/operations/__init__.py,sha256=A9GvZqRuzxV98wrwo0-Y2bOTpz0TTPePHDTOj0cYR9Y,440
|
66
67
|
lionagi/operations/_visualize_graph.py,sha256=F0KadgRthP-6-R-FPgvlwiiaiWH3ueO-rjSd1bzRUbE,8594
|
67
68
|
lionagi/operations/builder.py,sha256=6fwihDDRiabjliw5LRwChMY7It9oQkYXwOU1K1ag5qc,14718
|
68
|
-
lionagi/operations/flow.py,sha256=
|
69
|
+
lionagi/operations/flow.py,sha256=wCcChUWkxB8y2nMUS9BXvNVboa_q1t8WnfytHLfduks,25153
|
69
70
|
lionagi/operations/manager.py,sha256=YZr3VjPAZVVFd_bIjF1aoQqzzKZHNA1kcqefNi5QFFM,683
|
70
71
|
lionagi/operations/node.py,sha256=zntelS3kO6q4H6vpS2lpw3iNUTLR3a6I3dp07fdSGJs,3465
|
71
|
-
lionagi/operations/types.py,sha256=
|
72
|
+
lionagi/operations/types.py,sha256=b0TR6xsTxw3eJKEbt_1UfpJBcoaT_uRLezQ7h5G2ux0,3947
|
72
73
|
lionagi/operations/utils.py,sha256=_SlmfXRXiPoK5GHJDEK9zxzJT6RAHhU1VTqxhsxMFG4,1369
|
73
|
-
lionagi/operations/ReAct/ReAct.py,sha256=
|
74
|
+
lionagi/operations/ReAct/ReAct.py,sha256=d153LHTbZnti8onydK7c_6Yx6aQEBJRHe_zEYLsGHZY,20686
|
74
75
|
lionagi/operations/ReAct/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
75
|
-
lionagi/operations/ReAct/utils.py,sha256=
|
76
|
-
lionagi/operations/
|
77
|
-
lionagi/operations/
|
76
|
+
lionagi/operations/ReAct/utils.py,sha256=YzKZaqD_Yb016grdx7hqSR2irM-idY9-FgCjgp9zffg,4300
|
77
|
+
lionagi/operations/act/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
78
|
+
lionagi/operations/act/act.py,sha256=xMe0iYS_ziuPHzyEOXvKeBlQ4uSMJgsh656HLX5c1N0,6471
|
78
79
|
lionagi/operations/brainstorm/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
79
80
|
lionagi/operations/brainstorm/brainstorm.py,sha256=daLcfhJxV8vZTZ83XENLCFr0k3rnki3MXqMjnCoybUI,18793
|
80
81
|
lionagi/operations/brainstorm/prompt.py,sha256=Ma-9cAGS5UdDtidK28A4WldS2712-NVGxtXvhSuBet4,606
|
81
82
|
lionagi/operations/chat/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
82
|
-
lionagi/operations/chat/chat.py,sha256=
|
83
|
+
lionagi/operations/chat/chat.py,sha256=j21Zxdc_pkuFskT6HH2rXgh6fkvbwqp4C77L7xfWs9Y,6667
|
83
84
|
lionagi/operations/communicate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
84
|
-
lionagi/operations/communicate/communicate.py,sha256=
|
85
|
+
lionagi/operations/communicate/communicate.py,sha256=zQ-15MwJmw6sic0HdOBl8EJvVUBOThj5bu55Stg9YdA,5569
|
85
86
|
lionagi/operations/instruct/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
86
87
|
lionagi/operations/instruct/instruct.py,sha256=aaWzn3bnN4HCfe2uF0-u0VbSPsTJye83EsAUhmNsVRI,790
|
87
88
|
lionagi/operations/interpret/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
88
|
-
lionagi/operations/interpret/interpret.py,sha256=
|
89
|
+
lionagi/operations/interpret/interpret.py,sha256=uVK9Yk4-n92DZfEQrNQ-IU7PJd_IfVJWJENbmVCf_Ns,2497
|
89
90
|
lionagi/operations/operate/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
90
|
-
lionagi/operations/operate/operate.py,sha256=
|
91
|
+
lionagi/operations/operate/operate.py,sha256=iH0sg1a4HXKElcKrcxbl50-LHR1Dw_Ndm9GEeQnJAgY,10433
|
91
92
|
lionagi/operations/parse/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
92
|
-
lionagi/operations/parse/parse.py,sha256=
|
93
|
+
lionagi/operations/parse/parse.py,sha256=LwQoKNbkADSnhkrwMZeOPlTFAjsKC1QmnorbtKsdNX8,6699
|
93
94
|
lionagi/operations/plan/__init__.py,sha256=_I1NOEn9w7ymriCXW-6gN3dDwJPM35H2nNHy2IJj4FU,152
|
94
95
|
lionagi/operations/plan/plan.py,sha256=04mr8tu3BQmCczf324pm-FlmP_NulZ1sS7JTFrdT5jI,15311
|
95
96
|
lionagi/operations/plan/prompt.py,sha256=WhnND5JjafKgKgcaHBPR5hxwdtwSHfWulVRyomL1rVU,989
|
96
97
|
lionagi/operations/select/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
97
|
-
lionagi/operations/select/select.py,sha256=
|
98
|
-
lionagi/operations/select/utils.py,sha256=
|
98
|
+
lionagi/operations/select/select.py,sha256=kj_nOBpZVey98k3ZAJKWLgedBXhU4Zjj2RjQZ3A_E4A,4449
|
99
|
+
lionagi/operations/select/utils.py,sha256=E7fQ0esYcBKVadCmPla3wXTtI1JaU2dCKU6nxP63a0o,3684
|
99
100
|
lionagi/protocols/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
100
101
|
lionagi/protocols/_concepts.py,sha256=eheWQxlHTo36uGpkSpINLO-OmTdjpJEFrVX1hJ7N590,1551
|
101
102
|
lionagi/protocols/contracts.py,sha256=thdhmP600E0FO7nBZKM2LoQaSuxQkg7YDi3QYUJRxaI,1394
|
102
103
|
lionagi/protocols/ids.py,sha256=zoErFMeyBsRdq7ld89e7YviLyDF1qF4DpzwVQGg1IG8,2468
|
103
|
-
lionagi/protocols/types.py,sha256=
|
104
|
+
lionagi/protocols/types.py,sha256=h06gvQuBq7DGxiDJq6E98MU9525GLqp94_nlOBcGgTw,2391
|
104
105
|
lionagi/protocols/action/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
105
106
|
lionagi/protocols/action/function_calling.py,sha256=Qu5wCBGZk-c0D-rKMF8nYI3mzJGphosLWi7NCySSErY,4534
|
106
107
|
lionagi/protocols/action/manager.py,sha256=joz83NXCqA2TjAOiPmnwuunZ71_vi2tHze1tGSJKhjU,20041
|
@@ -113,7 +114,7 @@ lionagi/protocols/forms/report.py,sha256=zc-2bnVZJRzZnj6QOy1ba4dsfZkqzC0yOqtR_y-
|
|
113
114
|
lionagi/protocols/generic/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
114
115
|
lionagi/protocols/generic/element.py,sha256=CKHzIfKRxg1kh-FyvVB1l06AzU79WTfqSvISzF2XKaA,14628
|
115
116
|
lionagi/protocols/generic/event.py,sha256=oTDHFZeLTlX_olNN-6IFAVUU0bAlxn7nBOi5mu5kMnY,6546
|
116
|
-
lionagi/protocols/generic/log.py,sha256=
|
117
|
+
lionagi/protocols/generic/log.py,sha256=flAk8NrYQN6yfY9w0D8y2Q-MIpESUK-1XaQCLnYtJ_I,8393
|
117
118
|
lionagi/protocols/generic/pile.py,sha256=RONqbLygSVeQhfr_9HNMR7btvME1nsmrCPWDdNoi2sY,37125
|
118
119
|
lionagi/protocols/generic/processor.py,sha256=e4s9pf0yjx-VIGN0uYnJ48TKDVpc_O_98_L-0hwawEk,11701
|
119
120
|
lionagi/protocols/generic/progression.py,sha256=LKUkyMI2ONH78YGAnCu6AO0-iDeXqHvJpe7XKuKXRjo,15186
|
@@ -127,22 +128,15 @@ lionagi/protocols/mail/mail.py,sha256=RmGd8dJD1om8qxCDlb4UlxDrcWXItKL9ZhFgzWUWIf
|
|
127
128
|
lionagi/protocols/mail/mailbox.py,sha256=F6-9do52IKfQKewtwOTxdlPCDYmBT4tDGKlMvFhc-BI,2729
|
128
129
|
lionagi/protocols/mail/manager.py,sha256=QqH5IgnAGwLOpUS8sJmDYLNYKVqbUdz-3sZgVCbl7gw,6960
|
129
130
|
lionagi/protocols/mail/package.py,sha256=RebLIMmkx1V7q1940NsmSXKsNKNPXigwZnI6Aewp3HM,2655
|
130
|
-
lionagi/protocols/messages/__init__.py,sha256=
|
131
|
-
lionagi/protocols/messages/action_request.py,sha256=
|
132
|
-
lionagi/protocols/messages/action_response.py,sha256=
|
133
|
-
lionagi/protocols/messages/assistant_response.py,sha256=
|
134
|
-
lionagi/protocols/messages/base.py,sha256
|
135
|
-
lionagi/protocols/messages/instruction.py,sha256=
|
136
|
-
lionagi/protocols/messages/manager.py,sha256=
|
137
|
-
lionagi/protocols/messages/message.py,sha256=
|
138
|
-
lionagi/protocols/messages/system.py,sha256=
|
139
|
-
lionagi/protocols/messages/templates/README.md,sha256=Ch4JrKSjd85fLitAYO1OhZjNOGKHoEwaKQlcV16jiUI,1286
|
140
|
-
lionagi/protocols/messages/templates/action_request.jinja2,sha256=d6OmxHKyvvNDSK4bnBM3TGSUk_HeE_Q2EtLAQ0ZBEJg,120
|
141
|
-
lionagi/protocols/messages/templates/action_response.jinja2,sha256=Mg0UxmXlIvtP_KPB0GcJxE1TP6lml9BwdPkW1PZxkg8,142
|
142
|
-
lionagi/protocols/messages/templates/assistant_response.jinja2,sha256=oKOX4myBy7it1J1f92mvTS1iBUUlZfsJsY2fC42ygvc,119
|
143
|
-
lionagi/protocols/messages/templates/instruction_message.jinja2,sha256=L-ptw5OHxdL1KVKVhLOn0KAFw6IEFI9QHZxiFuovzhk,1382
|
144
|
-
lionagi/protocols/messages/templates/system_message.jinja2,sha256=JRKJ0aFpYfaXSFouKc_N4unZ35C3yZTOWhIrIdCB5qk,215
|
145
|
-
lionagi/protocols/messages/templates/tool_schemas.jinja2,sha256=ozIaSDCRjIAhLyA8VM6S-YqS0w2NcctALSwx4LjDwII,126
|
131
|
+
lionagi/protocols/messages/__init__.py,sha256=VtHtfD41BezXk2VKgRXlVGBj-Gxc3c5rvomb7g2Qsu0,898
|
132
|
+
lionagi/protocols/messages/action_request.py,sha256=VDmdxxKYJhSOE0oui8mNIPpVb3mmA_46Db_Xo8twV_I,3588
|
133
|
+
lionagi/protocols/messages/action_response.py,sha256=AioBkMKzBworwk7LtlxWZR7rQB6nrvEsjNGTk_v1XYQ,2989
|
134
|
+
lionagi/protocols/messages/assistant_response.py,sha256=jv1svk_pk4sc_AslHMDn7CtIAFCM5aKmaiPbqNyD4Ds,6071
|
135
|
+
lionagi/protocols/messages/base.py,sha256=-feOzxTrfqe-1F74Y5bloTaSGwiF4bRhI_txawTPgXA,2649
|
136
|
+
lionagi/protocols/messages/instruction.py,sha256=o8A3nBIqU_82G86Kg4UgiVpAznzzRSnWiEm9LvlBpM4,11815
|
137
|
+
lionagi/protocols/messages/manager.py,sha256=ZbQ1VfphbS7ddr4SHmnSqLTo8lnZ4Vtl8pKL8xnLPD0,18900
|
138
|
+
lionagi/protocols/messages/message.py,sha256=tgy_drcKB-CbAqFaKi6oQkhBPFuBQYREZU8DqQTz2BE,4457
|
139
|
+
lionagi/protocols/messages/system.py,sha256=A9RqcNUUCFq6GcGBvMpv7Y6R4igFt1sER9sZMXyyFWg,2380
|
146
140
|
lionagi/protocols/operatives/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
147
141
|
lionagi/protocols/operatives/operative.py,sha256=StMHk8EShQXeBLN9GYsLfzne94jsIO0x2vf988bQWos,14368
|
148
142
|
lionagi/protocols/operatives/step.py,sha256=9GEsKOvTSrnBcDEtJV7PryJuR7Uk7CRjhwtFKFEZEe4,9276
|
@@ -153,10 +147,9 @@ lionagi/service/manager.py,sha256=ZQWj_QKYsKVblsNHeDBMMQllduMArjLqaZHlP3F1_tE,11
|
|
153
147
|
lionagi/service/rate_limited_processor.py,sha256=D983_04YqurcA-svjDKXVzmlD1bWoVkFHtwqQhB-fGo,6095
|
154
148
|
lionagi/service/resilience.py,sha256=djIDMJHe2XHoULa3x0wygt3kjeMgElSmWf0RFeyD3SU,18717
|
155
149
|
lionagi/service/token_calculator.py,sha256=s5meEIhulrkemCkY8sYPUOdKGH5jxEkz87Qt0Nwb2zE,6453
|
156
|
-
lionagi/service/types.py,sha256=3wgJhCd8RlSo4d1vdZgNSqc_TpBpfVTiAUdmuOOiTKE,1528
|
157
150
|
lionagi/service/connections/__init__.py,sha256=xgym7BxiQv-QxDMRfvvq6V9PvYmSZklU0-epGj1Beng,365
|
158
151
|
lionagi/service/connections/api_calling.py,sha256=8NpgyFzz9oU6lTXq_gBetaqH_M6RnOoxIg4rbcS1Jco,6003
|
159
|
-
lionagi/service/connections/endpoint.py,sha256=
|
152
|
+
lionagi/service/connections/endpoint.py,sha256=T4JKy-fQ9_LFDpaTP0SEzUFIlfnhlnMJFcEb-qgThVg,14833
|
160
153
|
lionagi/service/connections/endpoint_config.py,sha256=L-DQdxVLBA8ZapVSvLhjmlo0pP1199aRA8lccquGoHI,5172
|
161
154
|
lionagi/service/connections/header_factory.py,sha256=vwVV3jNHIUePvUzbcC5Sj7yDoxB2yVSyLZxgBm-kNjg,1824
|
162
155
|
lionagi/service/connections/match_endpoint.py,sha256=cOPdoEgOpvFE2iJ24zqGJ51fB6s20qg4-RDjTI_bx-0,2571
|
@@ -167,33 +160,32 @@ lionagi/service/connections/providers/anthropic_.py,sha256=7xShtS2Whg-F2DpueSyI0
|
|
167
160
|
lionagi/service/connections/providers/claude_code_cli.py,sha256=pCAXdPCH0AaKYnA3SXL8zGTvvheipR5dZ7Aw7fmqG8g,4451
|
168
161
|
lionagi/service/connections/providers/exa_.py,sha256=p2mVkuztpHuS4Ud2dR082dPPEiVp6MFUXlehU9fD9lc,1051
|
169
162
|
lionagi/service/connections/providers/nvidia_nim_.py,sha256=S1Z8XhL7W5uANiNTkHK_ffeBL3_lD9KuthI70NSd_4g,2412
|
170
|
-
lionagi/service/connections/providers/oai_.py,sha256=
|
171
|
-
lionagi/service/connections/providers/ollama_.py,sha256=
|
163
|
+
lionagi/service/connections/providers/oai_.py,sha256=vXYecSAHkMONpbFoVivldBbyPlU2y8pWKYY-LiXzsBE,4289
|
164
|
+
lionagi/service/connections/providers/ollama_.py,sha256=Y1e8dR7uDOxnCI45f9qvPh4NtVUd0qDppohNb-g6tQM,4564
|
172
165
|
lionagi/service/connections/providers/perplexity_.py,sha256=9eXYXsGQuDy8WdEbZ3Och9qDl-lZTBmocMo9-FsTIeE,1649
|
173
|
-
lionagi/service/connections/providers/types.py,sha256=omKWbmJYu_ozK_qJLcxQezVcauXTqhp4ClOWAyENEFU,807
|
174
166
|
lionagi/service/hooks/__init__.py,sha256=toX-rQji-pxglI4yKzu-0Xp7E4xVvh0__Z70G_Gz2Y0,469
|
175
167
|
lionagi/service/hooks/_types.py,sha256=53Wh0N1pHUZ_IG8iPxP4MbRNNy_e6vzK-y9Mxu8u8Eo,1260
|
176
168
|
lionagi/service/hooks/_utils.py,sha256=oVVDIJOX8HFAHVErPJGTuh57YEGhiwm5_ykFN2GRPyI,2632
|
177
169
|
lionagi/service/hooks/hook_event.py,sha256=VGcpdrbnH6U47mNkSINT8FlwWrR8_QX_kGoCy55RXTc,2836
|
178
170
|
lionagi/service/hooks/hook_registry.py,sha256=SGwWoFTHhKn0hGrb2GeDi2ecLrt8ax_kiJoHPZgz5Ls,8532
|
179
|
-
lionagi/service/hooks/hooked_event.py,sha256=
|
171
|
+
lionagi/service/hooks/hooked_event.py,sha256=iBN7dCpYwJBndai94vm9FwpFvQHcUonEDOg7C9g75iI,4318
|
180
172
|
lionagi/service/third_party/README.md,sha256=qFjWnI8rmLivIyr6Tc-hRZh-rQwntROp76af4MBNJJc,2214
|
181
173
|
lionagi/service/third_party/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
182
174
|
lionagi/service/third_party/anthropic_models.py,sha256=8Ioc2YjQkHIwsqrnzbfyXAADIIPpP21mPDhx7XkGpRo,4022
|
183
|
-
lionagi/service/third_party/claude_code.py,sha256=
|
175
|
+
lionagi/service/third_party/claude_code.py,sha256=jy7Xe2lQ85uKUayaHHdLfSQqWVNhgC9A71z1TA6cYS0,23831
|
184
176
|
lionagi/service/third_party/exa_models.py,sha256=G_hnekcy-DillPLzMoDQ8ZisVAL8Mp7iMAK4xqAT_3w,5470
|
185
|
-
lionagi/service/third_party/
|
177
|
+
lionagi/service/third_party/openai_models.py,sha256=UCuIlYejgEAReQh1ldm-k1HC1Xk_lDM0aY0UBhbA7KA,11357
|
186
178
|
lionagi/service/third_party/pplx_models.py,sha256=-EhyJgOWR6rzSv3zczUtk80X6c19p18Dg9KC6l8BFRQ,6473
|
187
179
|
lionagi/session/__init__.py,sha256=KqR6ZzF0JZmPxa0Yb5Ocm88MTMQR1alhlm00QTbHOvA,198
|
188
|
-
lionagi/session/branch.py,sha256=
|
180
|
+
lionagi/session/branch.py,sha256=I-0Yn3nkNvAZTjuC1imTSrr3DYzRsi0ZiZEsBiHOSz8,59756
|
189
181
|
lionagi/session/prompts.py,sha256=GPr0jibyAAqS3awDzGC8SoCL6aWJLLCCbXY0JUuxOC0,3170
|
190
|
-
lionagi/session/session.py,sha256=
|
182
|
+
lionagi/session/session.py,sha256=DAt7pU5l2J6t6Uzon0zlC0eWsOtIHFUs2VuLolH0Bcw,12810
|
191
183
|
lionagi/tools/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
192
184
|
lionagi/tools/base.py,sha256=ypzT7-XPGW_KzIAAGwlzwRx594zcIPoBqW_WqAozwo4,1893
|
193
185
|
lionagi/tools/types.py,sha256=HD3lkxKFFxVKPgxVLOerJ-VNxQiXA0Cw2TrlxEEBQWU,226
|
194
186
|
lionagi/tools/file/__init__.py,sha256=ySvN2mEd6TEvCVCDGfBS9H_cSrZQ21WomjRC8Herm0Y,108
|
195
|
-
lionagi/tools/file/reader.py,sha256=
|
196
|
-
lionagi-0.
|
197
|
-
lionagi-0.
|
198
|
-
lionagi-0.
|
199
|
-
lionagi-0.
|
187
|
+
lionagi/tools/file/reader.py,sha256=JCKDyOcKv07Iee8oJls8y5Qg0_PefnfqsIp_FiZQrsQ,9660
|
188
|
+
lionagi-0.18.0.dist-info/METADATA,sha256=3j0lkBH0hhEThs8UwMZbPvqUZZc-DKQaL3H4_Eo0-k4,23416
|
189
|
+
lionagi-0.18.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
190
|
+
lionagi-0.18.0.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
|
191
|
+
lionagi-0.18.0.dist-info/RECORD,,
|
lionagi/operations/_act/act.py
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# Copyright (c) 2023-2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
-
# SPDX-License-Identifier: Apache-2.0
|
3
|
-
|
4
|
-
import logging
|
5
|
-
from typing import TYPE_CHECKING
|
6
|
-
|
7
|
-
from pydantic import BaseModel
|
8
|
-
|
9
|
-
from lionagi.fields.action import ActionResponseModel
|
10
|
-
from lionagi.protocols.types import ActionRequest, Log
|
11
|
-
|
12
|
-
if TYPE_CHECKING:
|
13
|
-
from lionagi.session.branch import Branch
|
14
|
-
|
15
|
-
|
16
|
-
async def _act(
|
17
|
-
branch: "Branch",
|
18
|
-
action_request: BaseModel | dict,
|
19
|
-
suppress_errors: bool = False,
|
20
|
-
verbose_action: bool = False,
|
21
|
-
) -> "ActionResponseModel":
|
22
|
-
_request = {}
|
23
|
-
|
24
|
-
if isinstance(action_request, BaseModel):
|
25
|
-
if hasattr(action_request, "function") and hasattr(
|
26
|
-
action_request, "arguments"
|
27
|
-
):
|
28
|
-
_request["function"] = action_request.function
|
29
|
-
_request["arguments"] = action_request.arguments
|
30
|
-
elif isinstance(action_request, dict):
|
31
|
-
if {"function", "arguments"} <= set(action_request.keys()):
|
32
|
-
_request["function"] = action_request["function"]
|
33
|
-
_request["arguments"] = action_request["arguments"]
|
34
|
-
|
35
|
-
try:
|
36
|
-
if verbose_action:
|
37
|
-
args_ = str(_request["arguments"])
|
38
|
-
args_ = args_[:50] + "..." if len(args_) > 50 else args_
|
39
|
-
print(f"Invoking action {_request['function']} with {args_}.")
|
40
|
-
|
41
|
-
func_call = await branch._action_manager.invoke(_request)
|
42
|
-
if verbose_action:
|
43
|
-
print(
|
44
|
-
f"Action {_request['function']} invoked, status: {func_call.status}."
|
45
|
-
)
|
46
|
-
|
47
|
-
except Exception as e:
|
48
|
-
content = {
|
49
|
-
"error": str(e),
|
50
|
-
"function": _request.get("function"),
|
51
|
-
"arguments": _request.get("arguments"),
|
52
|
-
"branch": str(branch.id),
|
53
|
-
}
|
54
|
-
branch._log_manager.log(Log(content=content))
|
55
|
-
if verbose_action:
|
56
|
-
print(f"Action {_request['function']} failed, error: {str(e)}.")
|
57
|
-
if suppress_errors:
|
58
|
-
logging.error(
|
59
|
-
f"Error invoking action '{_request['function']}': {e}"
|
60
|
-
)
|
61
|
-
return None
|
62
|
-
raise e
|
63
|
-
|
64
|
-
branch._log_manager.log(Log.create(func_call))
|
65
|
-
|
66
|
-
if not isinstance(action_request, ActionRequest):
|
67
|
-
action_request = ActionRequest.create(
|
68
|
-
sender=branch.id,
|
69
|
-
recipient=func_call.func_tool.id,
|
70
|
-
**_request,
|
71
|
-
)
|
72
|
-
|
73
|
-
# Add the action request/response to the message manager, if not present
|
74
|
-
if action_request not in branch.messages:
|
75
|
-
branch.msgs.add_message(action_request=action_request)
|
76
|
-
|
77
|
-
branch.msgs.add_message(
|
78
|
-
action_request=action_request,
|
79
|
-
action_output=func_call.response,
|
80
|
-
)
|
81
|
-
|
82
|
-
return ActionResponseModel(
|
83
|
-
function=action_request.function,
|
84
|
-
arguments=action_request.arguments,
|
85
|
-
output=func_call.response,
|
86
|
-
)
|
@@ -1,28 +0,0 @@
|
|
1
|
-
## Rendering Templates
|
2
|
-
|
3
|
-
Once templates are defined, you can load and render them using Jinja2:
|
4
|
-
|
5
|
-
```python
|
6
|
-
from jinja2 import Environment, FileSystemLoader
|
7
|
-
|
8
|
-
env = Environment(loader=FileSystemLoader('templates'))
|
9
|
-
|
10
|
-
# Example: Rendering an instruction message
|
11
|
-
template = env.get_template('instruction_message.jinja2')
|
12
|
-
args = {
|
13
|
-
"guidance": "Please ensure accuracy.",
|
14
|
-
"instruction": "Summarize the document",
|
15
|
-
"context": ["Doc1: ...", "Doc2: ..."],
|
16
|
-
"request_fields": {"summary": "...", "key_points": "..."}
|
17
|
-
}
|
18
|
-
message_text = template.render(**args)
|
19
|
-
print(message_text)
|
20
|
-
```
|
21
|
-
|
22
|
-
Benefits and Customization
|
23
|
-
• You can easily rearrange sections within these templates without changing your code logic.
|
24
|
-
• Each message type is clearly separated, making it simpler to maintain or adjust one message format without affecting the others.
|
25
|
-
• If you find that you use some snippet (like rendering a schema) in multiple templates, you can factor it out into its own partial template (like tool_schemas.jinja2) and include it where needed.
|
26
|
-
• Over time, you can add more templates or split existing ones if certain messages become too complex.
|
27
|
-
|
28
|
-
By establishing this set of base templates and arguments, you have a starting point. You can expand or refine as your requirements evolve.
|
@@ -1,61 +0,0 @@
|
|
1
|
-
{%- set content = [] -%}
|
2
|
-
|
3
|
-
{# If plain_content is provided, we use it directly. Otherwise, we build a text block from guidance, instruction, context, etc. #}
|
4
|
-
{% if plain_content %}
|
5
|
-
{% set content = content + [{"type": "text", "text": plain_content}] %}
|
6
|
-
{% else %}
|
7
|
-
{# Build a text block from the available sections #}
|
8
|
-
{% set text_block = "" %}
|
9
|
-
|
10
|
-
{% if guidance %}
|
11
|
-
## Guidance
|
12
|
-
{{ guidance }}
|
13
|
-
|
14
|
-
{% endif %}
|
15
|
-
|
16
|
-
{% if instruction %}
|
17
|
-
## Instruction
|
18
|
-
{{ instruction }}
|
19
|
-
|
20
|
-
{% endif %}
|
21
|
-
|
22
|
-
{% if context %}
|
23
|
-
## Context
|
24
|
-
{% for item in context %}
|
25
|
-
- {{ item }}
|
26
|
-
{% endfor %}
|
27
|
-
{% endif %}
|
28
|
-
|
29
|
-
{% if tool_schemas %}
|
30
|
-
## Tool Schemas
|
31
|
-
{% include "tool_schemas.jinja2" %}
|
32
|
-
{% endif %}
|
33
|
-
|
34
|
-
{% if request_fields %}
|
35
|
-
## Requested Fields
|
36
|
-
Please return a JSON object with the following fields:
|
37
|
-
```json
|
38
|
-
{{ request_fields | tojson(indent=2) }}
|
39
|
-
|
40
|
-
{% endif %}
|
41
|
-
|
42
|
-
{% if request_response_format %}
|
43
|
-
|
44
|
-
Response Format
|
45
|
-
|
46
|
-
{{ request_response_format }}
|
47
|
-
{% endif %}
|
48
|
-
|
49
|
-
{# Append the built sections into text_block #}
|
50
|
-
{% set text_block = text_block + self %}
|
51
|
-
{% set content = content + [{"type": "text", "text": text_block.strip()}] %}
|
52
|
-
{% endif %}
|
53
|
-
|
54
|
-
{# If images are present, we append image_url items to content #}
|
55
|
-
{% if images %}
|
56
|
-
{% for img in images %}
|
57
|
-
{% set content = content + [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," ~ img, "detail": image_detail}}] %}
|
58
|
-
{% endfor %}
|
59
|
-
{% endif %}
|
60
|
-
|
61
|
-
{{ content | tojson(indent=2) }}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
from .anthropic_ import AnthropicMessagesEndpoint
|
2
|
-
from .claude_code_cli import ClaudeCodeCLIEndpoint, ClaudeCodeRequest
|
3
|
-
from .exa_ import ExaSearchEndpoint, ExaSearchRequest
|
4
|
-
from .oai_ import (
|
5
|
-
GroqChatEndpoint,
|
6
|
-
OpenaiChatEndpoint,
|
7
|
-
OpenaiEmbedEndpoint,
|
8
|
-
OpenaiResponseEndpoint,
|
9
|
-
OpenrouterChatEndpoint,
|
10
|
-
)
|
11
|
-
from .ollama_ import OllamaChatEndpoint
|
12
|
-
from .perplexity_ import PerplexityChatEndpoint, PerplexityChatRequest
|
13
|
-
|
14
|
-
__all__ = (
|
15
|
-
"AnthropicMessagesEndpoint",
|
16
|
-
"ClaudeCodeRequest",
|
17
|
-
"ClaudeCodeCLIEndpoint",
|
18
|
-
"ExaSearchEndpoint",
|
19
|
-
"ExaSearchRequest",
|
20
|
-
"OpenaiChatEndpoint",
|
21
|
-
"OpenaiEmbedEndpoint",
|
22
|
-
"OpenaiResponseEndpoint",
|
23
|
-
"OpenrouterChatEndpoint",
|
24
|
-
"GroqChatEndpoint",
|
25
|
-
"OllamaChatEndpoint",
|
26
|
-
"PerplexityChatEndpoint",
|
27
|
-
"PerplexityChatRequest",
|
28
|
-
)
|
@@ -1,198 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
OpenAI Model Names extracted from generated models.
|
3
|
-
|
4
|
-
This module provides lists of allowed model names for different OpenAI services,
|
5
|
-
extracted from the auto-generated openai_models.py file.
|
6
|
-
"""
|
7
|
-
|
8
|
-
from typing import Literal, get_args
|
9
|
-
|
10
|
-
# Manually define the chat models from the ChatModel class in openai_models.py
|
11
|
-
# These are extracted from the Literal type definition
|
12
|
-
CHAT_MODELS = [
|
13
|
-
"gpt-5",
|
14
|
-
"gpt-5-mini",
|
15
|
-
"gpt-5-nano",
|
16
|
-
"gpt-5-2025-08-07",
|
17
|
-
"gpt-5-mini-2025-08-07",
|
18
|
-
"gpt-5-nano-2025-08-07",
|
19
|
-
"gpt-5-chat-latest",
|
20
|
-
"gpt-4.1",
|
21
|
-
"gpt-4.1-mini",
|
22
|
-
"gpt-4.1-nano",
|
23
|
-
"gpt-4.1-2025-04-14",
|
24
|
-
"gpt-4.1-mini-2025-04-14",
|
25
|
-
"gpt-4.1-nano-2025-04-14",
|
26
|
-
"o4-mini",
|
27
|
-
"o4-mini-2025-04-16",
|
28
|
-
"o3",
|
29
|
-
"o3-2025-04-16",
|
30
|
-
"o3-mini",
|
31
|
-
"o3-mini-2025-01-31",
|
32
|
-
"o1",
|
33
|
-
"o1-2024-12-17",
|
34
|
-
"o1-preview",
|
35
|
-
"o1-preview-2024-09-12",
|
36
|
-
"o1-mini",
|
37
|
-
"o1-mini-2024-09-12",
|
38
|
-
"gpt-4o",
|
39
|
-
"gpt-4o-2024-11-20",
|
40
|
-
"gpt-4o-2024-08-06",
|
41
|
-
"gpt-4o-2024-05-13",
|
42
|
-
"gpt-4o-audio-preview",
|
43
|
-
"gpt-4o-audio-preview-2024-10-01",
|
44
|
-
"gpt-4o-audio-preview-2024-12-17",
|
45
|
-
"gpt-4o-audio-preview-2025-06-03",
|
46
|
-
"gpt-4o-mini-audio-preview",
|
47
|
-
"gpt-4o-mini-audio-preview-2024-12-17",
|
48
|
-
"gpt-4o-search-preview",
|
49
|
-
"gpt-4o-mini-search-preview",
|
50
|
-
"gpt-4o-search-preview-2025-03-11",
|
51
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
52
|
-
"chatgpt-4o-latest",
|
53
|
-
"codex-mini-latest",
|
54
|
-
"gpt-4o-mini",
|
55
|
-
"gpt-4o-mini-2024-07-18",
|
56
|
-
"gpt-4-turbo",
|
57
|
-
"gpt-4-turbo-2024-04-09",
|
58
|
-
"gpt-4-0125-preview",
|
59
|
-
"gpt-4-turbo-preview",
|
60
|
-
"gpt-4-1106-preview",
|
61
|
-
"gpt-4-vision-preview",
|
62
|
-
"gpt-4",
|
63
|
-
"gpt-4-0314",
|
64
|
-
"gpt-4-0613",
|
65
|
-
"gpt-4-32k",
|
66
|
-
"gpt-4-32k-0314",
|
67
|
-
"gpt-4-32k-0613",
|
68
|
-
"gpt-3.5-turbo",
|
69
|
-
"gpt-3.5-turbo-16k",
|
70
|
-
"gpt-3.5-turbo-0301",
|
71
|
-
"gpt-3.5-turbo-0613",
|
72
|
-
"gpt-3.5-turbo-1106",
|
73
|
-
"gpt-3.5-turbo-0125",
|
74
|
-
"gpt-3.5-turbo-16k-0613",
|
75
|
-
]
|
76
|
-
|
77
|
-
# Reasoning models (o1, o3, o4 series)
|
78
|
-
# Note: Add o1-pro models that may not be in the generated list yet
|
79
|
-
ADDITIONAL_REASONING_MODELS = [
|
80
|
-
"o1-pro",
|
81
|
-
"o1-pro-2025-03-19",
|
82
|
-
"o3-pro",
|
83
|
-
"o3-pro-2025-06-10",
|
84
|
-
]
|
85
|
-
|
86
|
-
REASONING_MODELS = [
|
87
|
-
model
|
88
|
-
for model in CHAT_MODELS
|
89
|
-
if model.startswith(("o1", "o1-", "o3", "o3-", "o4", "o4-", "gpt-5"))
|
90
|
-
] + ADDITIONAL_REASONING_MODELS
|
91
|
-
|
92
|
-
# GPT models (excluding reasoning models)
|
93
|
-
GPT_MODELS = [
|
94
|
-
model
|
95
|
-
for model in CHAT_MODELS
|
96
|
-
if model.startswith("gpt")
|
97
|
-
or model.startswith("chatgpt")
|
98
|
-
or model.startswith("codex")
|
99
|
-
]
|
100
|
-
|
101
|
-
# Embedding models
|
102
|
-
EMBEDDING_MODELS = [
|
103
|
-
"text-embedding-ada-002",
|
104
|
-
"text-embedding-3-small",
|
105
|
-
"text-embedding-3-large",
|
106
|
-
]
|
107
|
-
|
108
|
-
# Audio models
|
109
|
-
AUDIO_MODELS = {
|
110
|
-
"tts": ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"],
|
111
|
-
"transcription": [
|
112
|
-
"whisper-1",
|
113
|
-
"gpt-4o-transcribe",
|
114
|
-
"gpt-4o-mini-transcribe",
|
115
|
-
],
|
116
|
-
}
|
117
|
-
|
118
|
-
# Image models
|
119
|
-
IMAGE_MODELS = ["dall-e-2", "dall-e-3", "gpt-image-1"]
|
120
|
-
|
121
|
-
# Moderation models
|
122
|
-
MODERATION_MODELS = ["text-moderation-latest", "text-moderation-stable"]
|
123
|
-
|
124
|
-
|
125
|
-
def is_reasoning_model(model: str) -> bool:
|
126
|
-
"""Check if a model is a reasoning model (o1/o3/o4 series)."""
|
127
|
-
return model in REASONING_MODELS
|
128
|
-
|
129
|
-
|
130
|
-
def is_valid_chat_model(model: str) -> bool:
|
131
|
-
"""Check if a model is a valid chat model."""
|
132
|
-
return model in CHAT_MODELS
|
133
|
-
|
134
|
-
|
135
|
-
def is_valid_embedding_model(model: str) -> bool:
|
136
|
-
"""Check if a model is a valid embedding model."""
|
137
|
-
return model in EMBEDDING_MODELS
|
138
|
-
|
139
|
-
|
140
|
-
def get_model_category(model: str) -> str:
|
141
|
-
"""Get the category of a model."""
|
142
|
-
if model in REASONING_MODELS:
|
143
|
-
return "reasoning"
|
144
|
-
elif model in GPT_MODELS:
|
145
|
-
return "gpt"
|
146
|
-
elif model in EMBEDDING_MODELS:
|
147
|
-
return "embedding"
|
148
|
-
elif model in AUDIO_MODELS["tts"]:
|
149
|
-
return "tts"
|
150
|
-
elif model in AUDIO_MODELS["transcription"]:
|
151
|
-
return "transcription"
|
152
|
-
elif model in IMAGE_MODELS:
|
153
|
-
return "image"
|
154
|
-
elif model in MODERATION_MODELS:
|
155
|
-
return "moderation"
|
156
|
-
else:
|
157
|
-
return "unknown"
|
158
|
-
|
159
|
-
|
160
|
-
def validate_model(model: str, category: str = None) -> bool:
|
161
|
-
"""
|
162
|
-
Validate if a model is valid, optionally checking category.
|
163
|
-
|
164
|
-
Args:
|
165
|
-
model: The model name to validate
|
166
|
-
category: Optional category to check against ('chat', 'embedding', etc.)
|
167
|
-
|
168
|
-
Returns:
|
169
|
-
True if model is valid (and in the specified category if provided)
|
170
|
-
"""
|
171
|
-
if category == "chat":
|
172
|
-
return model in CHAT_MODELS or model in ADDITIONAL_REASONING_MODELS
|
173
|
-
elif category == "reasoning":
|
174
|
-
return is_reasoning_model(model)
|
175
|
-
elif category == "embedding":
|
176
|
-
return is_valid_embedding_model(model)
|
177
|
-
elif category:
|
178
|
-
return get_model_category(model) == category
|
179
|
-
else:
|
180
|
-
# Check if model exists in any category
|
181
|
-
return get_model_category(model) != "unknown"
|
182
|
-
|
183
|
-
|
184
|
-
# Export all model lists
|
185
|
-
__all__ = [
|
186
|
-
"CHAT_MODELS",
|
187
|
-
"REASONING_MODELS",
|
188
|
-
"GPT_MODELS",
|
189
|
-
"EMBEDDING_MODELS",
|
190
|
-
"AUDIO_MODELS",
|
191
|
-
"IMAGE_MODELS",
|
192
|
-
"MODERATION_MODELS",
|
193
|
-
"is_reasoning_model",
|
194
|
-
"is_valid_chat_model",
|
195
|
-
"is_valid_embedding_model",
|
196
|
-
"get_model_category",
|
197
|
-
"validate_model",
|
198
|
-
]
|