jaclang 0.7.5__py3-none-any.whl → 0.7.6__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.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/compiler/absyntree.py +167 -26
- jaclang/compiler/constant.py +98 -2
- jaclang/compiler/jac.lark +2 -0
- jaclang/compiler/parser.py +4 -0
- jaclang/compiler/passes/main/access_modifier_pass.py +5 -3
- jaclang/compiler/passes/main/def_impl_match_pass.py +3 -1
- jaclang/compiler/passes/main/def_use_pass.py +27 -39
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +34 -12
- jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -5
- jaclang/compiler/passes/main/sym_tab_build_pass.py +31 -181
- jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +1 -1
- jaclang/compiler/symtable.py +118 -65
- jaclang/core/aott.py +7 -3
- jaclang/core/importer.py +1 -1
- jaclang/langserve/engine.py +100 -36
- jaclang/langserve/server.py +34 -61
- jaclang/langserve/tests/fixtures/base_module_structure.jac +28 -0
- jaclang/langserve/tests/fixtures/circle_pure.test.jac +15 -0
- jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -0
- jaclang/langserve/tests/fixtures/py_import.py +26 -0
- jaclang/langserve/tests/test_server.py +90 -6
- jaclang/langserve/utils.py +114 -4
- jaclang/plugin/default.py +2 -2
- jaclang/plugin/feature.py +1 -1
- jaclang/plugin/spec.py +1 -1
- jaclang/tests/fixtures/aott_raise.jac +1 -1
- jaclang/tests/fixtures/edgetypeissue.jac +10 -0
- jaclang/tests/fixtures/hello.jac +1 -1
- jaclang/tests/fixtures/with_llm_function.jac +1 -1
- jaclang/tests/fixtures/with_llm_lower.jac +1 -1
- jaclang/tests/fixtures/with_llm_method.jac +1 -1
- jaclang/tests/fixtures/with_llm_type.jac +1 -1
- jaclang/tests/fixtures/with_llm_vision.jac +1 -1
- jaclang/tests/test_language.py +106 -96
- {jaclang-0.7.5.dist-info → jaclang-0.7.6.dist-info}/METADATA +1 -1
- {jaclang-0.7.5.dist-info → jaclang-0.7.6.dist-info}/RECORD +45 -50
- jaclang/core/llms/__init__.py +0 -20
- jaclang/core/llms/anthropic.py +0 -90
- jaclang/core/llms/base.py +0 -206
- jaclang/core/llms/groq.py +0 -70
- jaclang/core/llms/huggingface.py +0 -76
- jaclang/core/llms/ollama.py +0 -81
- jaclang/core/llms/openai.py +0 -65
- jaclang/core/llms/togetherai.py +0 -63
- jaclang/core/llms/utils.py +0 -9
- jaclang/tests/fixtures/edgetypetest.jac +0 -16
- {jaclang-0.7.5.dist-info → jaclang-0.7.6.dist-info}/WHEEL +0 -0
- {jaclang-0.7.5.dist-info → jaclang-0.7.6.dist-info}/entry_points.txt +0 -0
jaclang/tests/test_language.py
CHANGED
|
@@ -112,104 +112,105 @@ class JacLanguageTests(TestCase):
|
|
|
112
112
|
"{'a': 'apple', 'b': 'ball', 'c': 'cat', 'd': 'dog', 'e': 'elephant'}\n",
|
|
113
113
|
)
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
# TODO: Move these tests to mtllm repo
|
|
116
|
+
# def test_with_llm_function(self) -> None:
|
|
117
|
+
# """Parse micro jac file."""
|
|
118
|
+
# captured_output = io.StringIO()
|
|
119
|
+
# sys.stdout = captured_output
|
|
120
|
+
# jac_import("with_llm_function", base_path=self.fixture_abs_path("./"))
|
|
121
|
+
# sys.stdout = sys.__stdout__
|
|
122
|
+
# stdout_value = captured_output.getvalue()
|
|
123
|
+
# self.assertIn("{'temperature': 0.7}", stdout_value)
|
|
124
|
+
# self.assertIn("Emoji Representation (str)", stdout_value)
|
|
125
|
+
# self.assertIn('Text Input (input) (str) = "Lets move to paris"', stdout_value)
|
|
126
|
+
# self.assertIn(
|
|
127
|
+
# ' = [{"input": "I love tp drink pina coladas"',
|
|
128
|
+
# stdout_value,
|
|
129
|
+
# )
|
|
129
130
|
|
|
130
|
-
def test_with_llm_method(self) -> None:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
131
|
+
# def test_with_llm_method(self) -> None:
|
|
132
|
+
# """Parse micro jac file."""
|
|
133
|
+
# captured_output = io.StringIO()
|
|
134
|
+
# sys.stdout = captured_output
|
|
135
|
+
# jac_import("with_llm_method", base_path=self.fixture_abs_path("./"))
|
|
136
|
+
# sys.stdout = sys.__stdout__
|
|
137
|
+
# stdout_value = captured_output.getvalue()
|
|
138
|
+
# self.assertIn("[Reasoning] <Reason>", stdout_value)
|
|
139
|
+
# self.assertIn("(Enum) eg:- Personality.EXTROVERT ->", stdout_value)
|
|
140
|
+
# self.assertIn(
|
|
141
|
+
# "Personality Index of a Person (PersonalityIndex) (class) eg:- "
|
|
142
|
+
# "PersonalityIndex(index=int) -> Personality Index (index) (int)",
|
|
143
|
+
# stdout_value,
|
|
144
|
+
# )
|
|
145
|
+
# self.assertIn(
|
|
146
|
+
# "Personality of the Person (dict[Personality,PersonalityIndex])",
|
|
147
|
+
# stdout_value,
|
|
148
|
+
# )
|
|
149
|
+
# self.assertIn(
|
|
150
|
+
# 'Diary Entries (diary_entries) (list[str]) = ["I won noble prize in '
|
|
151
|
+
# 'Physics", "I am popular for my theory of relativity"]',
|
|
152
|
+
# stdout_value,
|
|
153
|
+
# )
|
|
153
154
|
|
|
154
|
-
def test_with_llm_lower(self) -> None:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
# def test_with_llm_lower(self) -> None:
|
|
156
|
+
# """Parse micro jac file."""
|
|
157
|
+
# captured_output = io.StringIO()
|
|
158
|
+
# sys.stdout = captured_output
|
|
159
|
+
# jac_import("with_llm_lower", base_path=self.fixture_abs_path("./"))
|
|
160
|
+
# sys.stdout = sys.__stdout__
|
|
161
|
+
# stdout_value = captured_output.getvalue()
|
|
162
|
+
# self.assertIn("[Reasoning] <Reason>", stdout_value)
|
|
163
|
+
# self.assertIn(
|
|
164
|
+
# 'Name of the Person (name) (str) = "Oppenheimer"',
|
|
165
|
+
# stdout_value,
|
|
166
|
+
# )
|
|
167
|
+
# self.assertIn(
|
|
168
|
+
# "Person (Person) (obj) eg:- Person(full_name=str, yod=int, personality"
|
|
169
|
+
# "=Personality) -> Fullname of the Person (full_name) (str), Year of Death"
|
|
170
|
+
# " (yod) (int), Personality of the Person (personality) (Personality)",
|
|
171
|
+
# stdout_value,
|
|
172
|
+
# )
|
|
173
|
+
# self.assertIn(
|
|
174
|
+
# "J. Robert Oppenheimer was a Introvert person who died in 1967",
|
|
175
|
+
# stdout_value,
|
|
176
|
+
# )
|
|
176
177
|
|
|
177
|
-
def test_with_llm_type(self) -> None:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def test_with_llm_vision(self) -> None:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
178
|
+
# def test_with_llm_type(self) -> None:
|
|
179
|
+
# """Parse micro jac file."""
|
|
180
|
+
# captured_output = io.StringIO()
|
|
181
|
+
# sys.stdout = captured_output
|
|
182
|
+
# jac_import("with_llm_type", base_path=self.fixture_abs_path("./"))
|
|
183
|
+
# sys.stdout = sys.__stdout__
|
|
184
|
+
# stdout_value = captured_output.getvalue()
|
|
185
|
+
# self.assertIn("14/03/1879", stdout_value)
|
|
186
|
+
# self.assertNotIn(
|
|
187
|
+
# 'University (University) (obj) = type(__module__="with_llm_type", __doc__=None, '
|
|
188
|
+
# "_jac_entry_funcs_`=[`], _jac_exit_funcs_=[], __init__=function(__wrapped__=function()))",
|
|
189
|
+
# stdout_value,
|
|
190
|
+
# )
|
|
191
|
+
# desired_output_count = stdout_value.count(
|
|
192
|
+
# "Person(name='Jason Mars', dob='1994-01-01', age=30)"
|
|
193
|
+
# )
|
|
194
|
+
# self.assertEqual(desired_output_count, 2)
|
|
195
|
+
|
|
196
|
+
# def test_with_llm_vision(self) -> None:
|
|
197
|
+
# """Test MTLLLM Vision Implementation."""
|
|
198
|
+
# try:
|
|
199
|
+
# captured_output = io.StringIO()
|
|
200
|
+
# sys.stdout = captured_output
|
|
201
|
+
# jac_import("with_llm_vision", base_path=self.fixture_abs_path("./"))
|
|
202
|
+
# sys.stdout = sys.__stdout__
|
|
203
|
+
# stdout_value = captured_output.getvalue()
|
|
204
|
+
# self.assertIn(
|
|
205
|
+
# "{'type': 'text', 'text': '\\n[System Prompt]\\n", stdout_value[:500]
|
|
206
|
+
# )
|
|
207
|
+
# self.assertNotIn(
|
|
208
|
+
# " {'type': 'text', 'text': 'Image of the Question (question_img) (Image) = '}, "
|
|
209
|
+
# "{'type': 'image_url', 'image_url': {'url': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAB",
|
|
210
|
+
# stdout_value[:500],
|
|
211
|
+
# )
|
|
212
|
+
# except Exception:
|
|
213
|
+
# self.skipTest("This test requires Pillow to be installed.")
|
|
213
214
|
|
|
214
215
|
def test_ignore(self) -> None:
|
|
215
216
|
"""Parse micro jac file."""
|
|
@@ -907,7 +908,7 @@ class JacLanguageTests(TestCase):
|
|
|
907
908
|
)
|
|
908
909
|
|
|
909
910
|
self.assertEqual(mypass.ir.pp().count("AbilityDef - (o)Circle.(c)area"), 1)
|
|
910
|
-
self.assertIsNone(mypass.ir.
|
|
911
|
+
self.assertIsNone(mypass.ir._sym_tab)
|
|
911
912
|
mypass = jac_file_to_pass(
|
|
912
913
|
self.fixture_abs_path("../../../examples/manual_code/circle_pure.jac"),
|
|
913
914
|
target=passes.SymTabBuildPass,
|
|
@@ -934,3 +935,12 @@ class JacLanguageTests(TestCase):
|
|
|
934
935
|
break
|
|
935
936
|
self.assertIsNotNone(table)
|
|
936
937
|
self.assertIsNotNone(table.lookup("attempts"))
|
|
938
|
+
|
|
939
|
+
def test_edge_expr_not_type(self) -> None:
|
|
940
|
+
"""Test importing python."""
|
|
941
|
+
captured_output = io.StringIO()
|
|
942
|
+
sys.stdout = captured_output
|
|
943
|
+
jac_import("edgetypeissue", base_path=self.fixture_abs_path("./"))
|
|
944
|
+
sys.stdout = sys.__stdout__
|
|
945
|
+
stdout_value = captured_output.getvalue()
|
|
946
|
+
self.assertIn("[x()]", stdout_value)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaclang
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.6
|
|
4
4
|
Summary: Jac is a unique and powerful programming language that runs on top of Python, offering an unprecedented level of intelligence and intuitive understanding.
|
|
5
5
|
Home-page: https://jaseci.org
|
|
6
6
|
License: MIT
|
|
@@ -6,19 +6,19 @@ jaclang/cli/cli.py,sha256=8CbN_oqMhZ71AJhgA9J0Q551GMO3ey273dgaFPckLyI,13582
|
|
|
6
6
|
jaclang/cli/cmdreg.py,sha256=u0jAd6A8czt7tBgPBBKBhYAG4By1FrjEGaTU2XFKeYs,8372
|
|
7
7
|
jaclang/compiler/.gitignore,sha256=n1k2_xXTorp9PY8hhYM4psHircn-NMaFx95bSgDKopo,10
|
|
8
8
|
jaclang/compiler/__init__.py,sha256=JA3L1ran0PlZI5Pcj2CIrFgrZGRNFHHC5kRh1QYgYlY,3146
|
|
9
|
-
jaclang/compiler/absyntree.py,sha256=
|
|
9
|
+
jaclang/compiler/absyntree.py,sha256=q3Ma7mGGzPDRoiNEX_H0wJmechx4zGpSYTnYCJpa-WA,134509
|
|
10
10
|
jaclang/compiler/codeloc.py,sha256=YhJcHjhMCOT6mV1qLehwriuFgW0H2-ntq68k_r8yBs4,2800
|
|
11
11
|
jaclang/compiler/compile.py,sha256=0d8p4i2LXg2RCu1XfWx_Jq_dx7pK2Zn2VIj-apvX_nI,3389
|
|
12
|
-
jaclang/compiler/constant.py,sha256=
|
|
13
|
-
jaclang/compiler/jac.lark,sha256=
|
|
14
|
-
jaclang/compiler/parser.py,sha256=
|
|
12
|
+
jaclang/compiler/constant.py,sha256=n4KaEkvnb9-KVJJVvxiWimhjbrOiknBvLHAVDBFbF7Y,8991
|
|
13
|
+
jaclang/compiler/jac.lark,sha256=Vu14pEa9HObGQCHCGFhIdq__yA3W0-cKAX53NZc--xM,17204
|
|
14
|
+
jaclang/compiler/parser.py,sha256=RccqG82EqkDdfi0n-4BB34Dh80EYINWy36jX8Ntklhw,140235
|
|
15
15
|
jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
|
|
16
16
|
jaclang/compiler/passes/ir_pass.py,sha256=gh1Zd8ouu79FoxerW1sMxktmfeC9gHyp4H_MoAviYP8,5504
|
|
17
17
|
jaclang/compiler/passes/main/__init__.py,sha256=YSWVNkgnJKF32LpJwX__FwvYrpTSoxFqvnw410WrhkA,947
|
|
18
|
-
jaclang/compiler/passes/main/access_modifier_pass.py,sha256=
|
|
19
|
-
jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=
|
|
20
|
-
jaclang/compiler/passes/main/def_use_pass.py,sha256=
|
|
21
|
-
jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256
|
|
18
|
+
jaclang/compiler/passes/main/access_modifier_pass.py,sha256=fvmvU_V72Zby8fiBnVESinAYFII5qJWKYXtmn4JAChA,5140
|
|
19
|
+
jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=yAkwLQm2NBJycJVSmG88Shq0r2GSxTH8goINDfGIHek,4583
|
|
20
|
+
jaclang/compiler/passes/main/def_use_pass.py,sha256=68Uts_v-R-9mzBXC9EfXpcBEQwqnVcpL2JD0sri88AY,9674
|
|
21
|
+
jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=-Ubaxk_5Tm4e09pDiTk0U-vZqUIZRzffLBw4yT2pOVo,18187
|
|
22
22
|
jaclang/compiler/passes/main/import_pass.py,sha256=18Lf8oC66Q2TmpKPjk-tY2a9kUtbssG_z4VU8RZLD_0,10374
|
|
23
23
|
jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=b0LHAeJbyZXDyqBD38oenar_HuR8urZGlW9SLaNYO2E,139978
|
|
24
24
|
jaclang/compiler/passes/main/pyast_load_pass.py,sha256=UJyoSpz_QHN0yX7RIubVQ-GjQxcVSkyueDxlwK6Qv-w,93127
|
|
@@ -27,8 +27,8 @@ jaclang/compiler/passes/main/pyjac_ast_link_pass.py,sha256=dnx_MvrVIks9hpUbiF2m3
|
|
|
27
27
|
jaclang/compiler/passes/main/pyout_pass.py,sha256=QWVB-AyVBha3OespP89LMuslRsdG2niZErwtnRPiURM,3191
|
|
28
28
|
jaclang/compiler/passes/main/registry_pass.py,sha256=yc5ua5iyYTGizJewhP-AcXKvDZ0ilzy9hH1MIQzsy_0,4573
|
|
29
29
|
jaclang/compiler/passes/main/schedules.py,sha256=cu3-AIckvbKGe3C-DbtDwwAdvnX25CdDP6j9QLps9Kg,1298
|
|
30
|
-
jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=
|
|
31
|
-
jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=
|
|
30
|
+
jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=25HEJGBbDlJibyW5MV4ShXQ2vmzG3LDreknV-u2nQjk,1184
|
|
31
|
+
jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=_EYyPOS2_CMgO2znCJck3NLgg6kx7lfiQGhY3Fy9JnI,34689
|
|
32
32
|
jaclang/compiler/passes/main/tests/__init__.py,sha256=UBAATLUEH3yuBN4LYKnXXV79kokRc4XB-rX12qfu0ds,28
|
|
33
33
|
jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl/getme.impl.jac,sha256=PUQSEKl0ZCjwhgU23o6qX8wEmnqvT7MSoFn8TVBlFpc,31
|
|
34
34
|
jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl.jac,sha256=Br7R3fHBl5hZTfwelSlIvAzca7rb9v1bAIpeU1NnFmg,28
|
|
@@ -71,14 +71,14 @@ jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmO
|
|
|
71
71
|
jaclang/compiler/passes/tool/tests/fixtures/corelib.jac,sha256=fNJJWnT_MiyYuN0exec1JTAkh4VKkAcEPFtFYLw3JKk,12712
|
|
72
72
|
jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac,sha256=fNJJWnT_MiyYuN0exec1JTAkh4VKkAcEPFtFYLw3JKk,12712
|
|
73
73
|
jaclang/compiler/passes/tool/tests/fixtures/doc_string.jac,sha256=hXD5bidK3sCGlJwTxy5Tka568hVxzqY6KL9y_z19CQo,217
|
|
74
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac,sha256=
|
|
75
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac,sha256=
|
|
76
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac,sha256=
|
|
77
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac,sha256=
|
|
78
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac,sha256=
|
|
79
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac,sha256=
|
|
80
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac,sha256=
|
|
81
|
-
jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac,sha256
|
|
74
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac,sha256=wswRZnBVc9b-kWVYHlsQKa-L958IzvclHWEnvNM7vYc,1776
|
|
75
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac,sha256=97Xm1O70OoHOpAooPjNI2CnJmBUI8x5CmYpMvuOET0E,677
|
|
76
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac,sha256=AweZhXmdyt8iHBH76soEkhR-15e46WlSrMiZWhQ5DY0,912
|
|
77
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac,sha256=70UEQLsOzGMzBLq8VWHa_hHBb8tVYx2OLC56Fu2df8E,1086
|
|
78
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac,sha256=5Qa2zUzQjppMQIL2Y-i5KN9jNpIl9qEMOTb20o8YsBI,1060
|
|
79
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac,sha256=A4yTeJg-FPvIbQspHU7I2Nc3oNm7SdKVGI0MTH1fO2w,693
|
|
80
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac,sha256=B7jiK2UPDWu6034RkqS5gNU2_pC8Zd6X1srNhRlv49A,430
|
|
81
|
+
jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac,sha256=byTwJbSi1CJ-RWOXRxRAUw128-XBzEeZ_KiS8H9gp0Q,2750
|
|
82
82
|
jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.dot,sha256=muQG45ABv5xlMAnj1F0BZdr9-idH9KaZCT__P4lDHcI,1391
|
|
83
83
|
jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.jac,sha256=BxgmNUdz76gKLi6PXnLZE9rartodMgch5ydpGrd25Ec,87
|
|
84
84
|
jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.txt,sha256=nm4n-i5Nh7RytChrolbTV-WwJh11pV8mTlRDmZYn7tI,780
|
|
@@ -105,7 +105,7 @@ jaclang/compiler/passes/transform.py,sha256=GEHK3zFWrEjbAQ3mIl3D59jBuIrA8DRbw9t_
|
|
|
105
105
|
jaclang/compiler/passes/utils/__init__.py,sha256=UsI5rUopTUiStAzup4kbPwIwrnC5ofCrqWBCBbM2-k4,35
|
|
106
106
|
jaclang/compiler/passes/utils/mypy_ast_build.py,sha256=DbTYKwQ2K-3JXS_RybLyvqDz_381Li8JfFKNeEQhbRY,26324
|
|
107
107
|
jaclang/compiler/semtable.py,sha256=tW0vY1N377w_WgKalqXe2VR8FJDwd9CpI6jDJi1jhEU,4152
|
|
108
|
-
jaclang/compiler/symtable.py,sha256=
|
|
108
|
+
jaclang/compiler/symtable.py,sha256=oYdYS1PUnNCGPPZsZZOduiDtTYyLVd6tXWAoUyCupUc,9275
|
|
109
109
|
jaclang/compiler/tests/__init__.py,sha256=qiXa5UNRBanGOcplFKTT9a_9GEyiv7goq1OzuCjDCFE,27
|
|
110
110
|
jaclang/compiler/tests/fixtures/__init__.py,sha256=udQ0T6rajpW_nMiYKJNckqP8izZ-pH3P4PNTJEln2NU,36
|
|
111
111
|
jaclang/compiler/tests/fixtures/activity.py,sha256=fSvxYDKufsPeQIrbuh031zHw_hdbRv5iK9mS7dD8E54,263
|
|
@@ -118,48 +118,43 @@ jaclang/compiler/tests/fixtures/stuff.jac,sha256=qOq6WOwhlprMmJpiqQudgqnr4qTd9uh
|
|
|
118
118
|
jaclang/compiler/tests/test_importer.py,sha256=JNmte5FsHhnng9jzw7N5BenflAFCasuhezN1sytDVyg,1739
|
|
119
119
|
jaclang/compiler/tests/test_parser.py,sha256=Sj9Kz1FghESaPpyx_kEvScs4xvz-vgEdH8yyQJ0iB7M,4820
|
|
120
120
|
jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
|
|
121
|
-
jaclang/core/aott.py,sha256=
|
|
121
|
+
jaclang/core/aott.py,sha256=W-hvfwDxwu1S3jFTWADWNob0-JnYbywdbUklkXIAOUA,11367
|
|
122
122
|
jaclang/core/architype.py,sha256=qBH0W-ALxmK6DALc4_S7gx-3R7C_6o-PGKb3f4RbWbE,16781
|
|
123
123
|
jaclang/core/constructs.py,sha256=ogWc95DEZxQWoxqsfbRrcmt9ldGDqW7zQVu3DWuIAKs,848
|
|
124
124
|
jaclang/core/context.py,sha256=AxGsra9EqokVdOhwIxR9RuAcnm0HmobUnMBezUBY1_s,4774
|
|
125
|
-
jaclang/core/importer.py,sha256=
|
|
126
|
-
jaclang/core/llms/__init__.py,sha256=hxuxduH6ahhkXgJ9eUkhfn8LCS1KTz1ESuYgtspu_c0,371
|
|
127
|
-
jaclang/core/llms/anthropic.py,sha256=numnoRVzi6ZjOMEP7UvMDsM_NnNfpqv4jeRfpSb79c4,3233
|
|
128
|
-
jaclang/core/llms/base.py,sha256=_qOv8G5jH2dc4OKUBDKDLx9M6Mv5kFUu5rj5dI625vU,6076
|
|
129
|
-
jaclang/core/llms/groq.py,sha256=VjBltafRkeNhpoGQzB79EsA4NWXnJVAArapKaqTWOq0,2303
|
|
130
|
-
jaclang/core/llms/huggingface.py,sha256=IA0Q1dBP-M4saD4uHcrJF7Q6YgPp_GGd9p8-hpG-XKQ,2815
|
|
131
|
-
jaclang/core/llms/ollama.py,sha256=eJ_Jy7MNy33gR3zuSwcuGaWUedvY_Qy5A08H7kqLvFE,2850
|
|
132
|
-
jaclang/core/llms/openai.py,sha256=01xY6l23_y4lX0t8ZEHiMwEBL7Govyf7fPQ2k4zdAKI,2219
|
|
133
|
-
jaclang/core/llms/togetherai.py,sha256=45lZHKtG4B7tyjI1s_7Pu39VXUaC5n9EAMajfGxHZb8,2164
|
|
134
|
-
jaclang/core/llms/utils.py,sha256=mTpROnh4qS8fE26TkcotSt-mAqWoSeEeRBOu0SgoPmA,219
|
|
125
|
+
jaclang/core/importer.py,sha256=CReQhfVak0kUT-UB2Q_g023hR_JpyNl-uA91pZeDNXs,6324
|
|
135
126
|
jaclang/core/memory.py,sha256=7QukfL6wDBXrdpRn01yu4RMNkmIMNqFiKrI0zfpGSy4,2947
|
|
136
127
|
jaclang/core/test.py,sha256=HRCl3cf0uPTe58Kcx_sBUb6ow8J53rnmpFOhA7g9oAA,2851
|
|
137
128
|
jaclang/core/utils.py,sha256=uzEsRSuNSMMo7dlvCozGv0TnpUmHEjGNzUTZt1Df2gQ,7741
|
|
138
129
|
jaclang/langserve/__init__.py,sha256=3qbnivBBcLZCfmDYRMIeKkG08Lx7XQsJJg-qG8TU8yc,51
|
|
139
|
-
jaclang/langserve/engine.py,sha256=
|
|
140
|
-
jaclang/langserve/server.py,sha256=
|
|
130
|
+
jaclang/langserve/engine.py,sha256=oo9IvUFTKxpfk65sk2ExRBEhN0y2PzFTLrTNF0rxMeE,16289
|
|
131
|
+
jaclang/langserve/server.py,sha256=XGg9AfGiY17DvVGLQ-O228OwdvSsKaqdhnsiYxVgwew,4368
|
|
141
132
|
jaclang/langserve/tests/__init__.py,sha256=iDM47k6c3vahaWhwxpbkdEOshbmX-Zl5x669VONjS2I,23
|
|
142
133
|
jaclang/langserve/tests/defaults.py,sha256=8UWHuCHY-WatPcWFhyX9-4KLuJgODTlLNj0wNnKomIM,7608
|
|
134
|
+
jaclang/langserve/tests/fixtures/base_module_structure.jac,sha256=gtU3Uq0gsJy6G8Dg4IWiL-YSk_LVFAYK4mVEPt5rGpE,515
|
|
143
135
|
jaclang/langserve/tests/fixtures/circle.jac,sha256=AWzRxTBjvQwoLSOakjn0kKXWqKvDaUYGc1zmBk1Nd5c,1770
|
|
144
136
|
jaclang/langserve/tests/fixtures/circle_err.jac,sha256=T22UiWpKJy6IhS-y0DrrZJMz95-8SAZnRAQUmT_kxO4,1732
|
|
145
137
|
jaclang/langserve/tests/fixtures/circle_pure.impl.jac,sha256=rsXatY9a-wZONRPJ6VOuw7Bj9R_CrJO_TEwAVXj1PjU,702
|
|
146
138
|
jaclang/langserve/tests/fixtures/circle_pure.jac,sha256=62j4v1LbWIfGfz_-tR7GDWNmEFqhdXhkDRC68Jc5fUs,624
|
|
139
|
+
jaclang/langserve/tests/fixtures/circle_pure.test.jac,sha256=QiOAUZ5xXPKDx_QQRCZ_l_Mt3DQvWd8toKehdNa-ZgU,295
|
|
147
140
|
jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac,sha256=rsXatY9a-wZONRPJ6VOuw7Bj9R_CrJO_TEwAVXj1PjU,702
|
|
148
141
|
jaclang/langserve/tests/fixtures/circle_pure_err.jac,sha256=jQ5QX0G5khGACoY82CM-6LcOX57w4e29tHVicE2eMgw,608
|
|
149
142
|
jaclang/langserve/tests/fixtures/hello.jac,sha256=iRMKtYVCw1zLvjOQbj3q__3Manj1Di1YeDTNMEvYtBc,36
|
|
143
|
+
jaclang/langserve/tests/fixtures/import_include_statements.jac,sha256=9FGQX_xet105BwQqyFC7SdsbYwW5JyVOJVWpsqx56jg,288
|
|
144
|
+
jaclang/langserve/tests/fixtures/py_import.py,sha256=BvNimsRmsbJWd-JNM31oJpl52bYvSdfQ6Np3DJNt7d0,320
|
|
150
145
|
jaclang/langserve/tests/pylsp_jsonrpc/__init__.py,sha256=bDWxRjmELPCVGy243_0kNrG7PttyZsv_eZ9JTKQrU1E,105
|
|
151
146
|
jaclang/langserve/tests/pylsp_jsonrpc/dispatchers.py,sha256=zEZWu6C2_n4lPoA8H8OO67746P93VhbYaXZMdtrD8Z0,1038
|
|
152
147
|
jaclang/langserve/tests/pylsp_jsonrpc/endpoint.py,sha256=TxDpWUd-8AGJwdRQN_iiCXYxrVfviZQlNtEvBL0dDPc,10591
|
|
153
148
|
jaclang/langserve/tests/pylsp_jsonrpc/exceptions.py,sha256=NGHeFQawZcjoLUcgDmY3bF7BqZR83g7TmdKyzCmRaKM,2836
|
|
154
149
|
jaclang/langserve/tests/pylsp_jsonrpc/streams.py,sha256=R80_FvICIkrbdGmNtlemWYaxrr7-XldPgLaASnyv0W8,3332
|
|
155
150
|
jaclang/langserve/tests/session.py,sha256=3pIRoQjZnsnUWIYnO2SpK7c1PAiHMCFrrStNK2tawRM,9572
|
|
156
|
-
jaclang/langserve/tests/test_server.py,sha256=
|
|
157
|
-
jaclang/langserve/utils.py,sha256=
|
|
151
|
+
jaclang/langserve/tests/test_server.py,sha256=Bmllojot7c40rq0mDMOAiOyowY0-ECh_qAJtCZV_8Q0,11102
|
|
152
|
+
jaclang/langserve/utils.py,sha256=JS_XxDAtqTO4r0wSQjxgGqHwx9xTN_JZpNI1YP-kgbY,9868
|
|
158
153
|
jaclang/plugin/__init__.py,sha256=5t2krHKt_44PrCTGojzxEimxpNHYVQcn89jAiCSXE_k,165
|
|
159
154
|
jaclang/plugin/builtin.py,sha256=MEMPUnj_rlwcCNmUkfH5S8iazMnQ6fpp6tls4fh5z7k,1188
|
|
160
|
-
jaclang/plugin/default.py,sha256=
|
|
161
|
-
jaclang/plugin/feature.py,sha256=
|
|
162
|
-
jaclang/plugin/spec.py,sha256=
|
|
155
|
+
jaclang/plugin/default.py,sha256=kx7rKU7t0PN4z-zF5kLUg_PiQHUV6_90bh3SJldynHY,25837
|
|
156
|
+
jaclang/plugin/feature.py,sha256=fhyQRNYOkcXlYn1ObFPqdOHPhtC_lGQfgd7RD2ooLUY,9792
|
|
157
|
+
jaclang/plugin/spec.py,sha256=CMu6rzi94eIZaqsFz3NIbN3upJgGneb4FE_7Rly7slE,8893
|
|
163
158
|
jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
|
|
164
159
|
jaclang/plugin/tests/fixtures/impl_match.jac,sha256=WEhcA1GlovusITEFO2bOjYYqiiULyYGKhM17uK2GqnI,91
|
|
165
160
|
jaclang/plugin/tests/fixtures/impl_match_impl.jac,sha256=k1385r7Hdlq6mUKxEHa3VOKJUIWH08hYg2kErhbYwFM,31
|
|
@@ -171,7 +166,7 @@ jaclang/settings.py,sha256=7rKy_kQkWjciwBoWHoJVYrK0nxLwaG54FFvFLOGGggk,3375
|
|
|
171
166
|
jaclang/tests/fixtures/abc.jac,sha256=AWzRxTBjvQwoLSOakjn0kKXWqKvDaUYGc1zmBk1Nd5c,1770
|
|
172
167
|
jaclang/tests/fixtures/access_checker.jac,sha256=6Inm14cZsyMfezFRs2zfnQEZSE_JRxVvytcZbox7BNw,375
|
|
173
168
|
jaclang/tests/fixtures/access_modifier.jac,sha256=bxiPlbqm4zPXdMIeTR0-LhjO6c-LS7fW_fGuIA7oKWI,945
|
|
174
|
-
jaclang/tests/fixtures/aott_raise.jac,sha256=
|
|
169
|
+
jaclang/tests/fixtures/aott_raise.jac,sha256=ufKMVC21NJw3zSSJ_8uCoG_IR9pJf8WfGp8AAyX14DQ,747
|
|
175
170
|
jaclang/tests/fixtures/arithmetic_bug.jac,sha256=iiO3ZwTi7R1U6-flV4tGbxDHXsw8GnaLEzVNGTPdMUA,135
|
|
176
171
|
jaclang/tests/fixtures/assign_compr.jac,sha256=rnoujdtpjNbem4IdtBfxPahSUXl-gxNv4JFNEuUs5iM,286
|
|
177
172
|
jaclang/tests/fixtures/assign_compr_dup.jac,sha256=rnoujdtpjNbem4IdtBfxPahSUXl-gxNv4JFNEuUs5iM,286
|
|
@@ -195,7 +190,7 @@ jaclang/tests/fixtures/disconn.jac,sha256=gRbNh6R6t-cTdB6lT4M7HW7cdGoYoGV5Bnp3Nh
|
|
|
195
190
|
jaclang/tests/fixtures/edge_node_walk.jac,sha256=OOIMT7lrwZT3rVF-niRWbUeifBL5fuu1D1TMYXPRlfk,961
|
|
196
191
|
jaclang/tests/fixtures/edge_ops.jac,sha256=PYw_ChRnYReVSev1PjUmbtvHUj-ZWfZax2KOkaWC1pc,941
|
|
197
192
|
jaclang/tests/fixtures/edges_walk.jac,sha256=3X7LH0O9EinQnGvSu0BKMZptI10vVXpry_RdV2lTFnE,800
|
|
198
|
-
jaclang/tests/fixtures/
|
|
193
|
+
jaclang/tests/fixtures/edgetypeissue.jac,sha256=ZsJuNdtmD_fu2b7sDJ_tWZjoDI_rxouDEcSWkahhBS0,118
|
|
199
194
|
jaclang/tests/fixtures/enum_inside_archtype.jac,sha256=EiuL9szE0ISfeczoVcnZyw0eK1n6vc6_koDf0cHgoh4,236
|
|
200
195
|
jaclang/tests/fixtures/err.jac,sha256=0MbNsaJaVp7cpL-nvG2SOCnDmZbfcpjOaF7VIU_2ggU,49
|
|
201
196
|
jaclang/tests/fixtures/err2.jac,sha256=x8h69NTVMGJa_UicY-CZblLMdeH09myTeiYqNFamiK0,50
|
|
@@ -206,7 +201,7 @@ jaclang/tests/fixtures/has_goodness.jac,sha256=CmhMXiRLCkdrqpGbSm2e7mBf0hCBgCk5s
|
|
|
206
201
|
jaclang/tests/fixtures/hash_init_check.jac,sha256=Yrh3Rmi4SHIbY_c8EjHzcnwXVXas9ufbCAnkdRa3EyQ,205
|
|
207
202
|
jaclang/tests/fixtures/hashcheck.jac,sha256=ksWSP6jyQ7MedV-Oh7HoXHn1rTdQwv2O1H22Pyq3d3c,160
|
|
208
203
|
jaclang/tests/fixtures/hashcheck_dup.jac,sha256=ksWSP6jyQ7MedV-Oh7HoXHn1rTdQwv2O1H22Pyq3d3c,160
|
|
209
|
-
jaclang/tests/fixtures/hello.jac,sha256=
|
|
204
|
+
jaclang/tests/fixtures/hello.jac,sha256=M_E69sEKTpetkG-LLydm698o0cjpN6WhIT4ADJr5YpE,64
|
|
210
205
|
jaclang/tests/fixtures/hello_nc.jac,sha256=6YezKvx2CNjE0l3Ea6P9ZsTrj4XyqvXDQO9S1EFNbIE,63
|
|
211
206
|
jaclang/tests/fixtures/ignore.jac,sha256=_2ZzV5VV_5F7i5cHUxOkQgsKtxnUGKlBxDHeGGLoK3g,673
|
|
212
207
|
jaclang/tests/fixtures/ignore_dup.jac,sha256=_2ZzV5VV_5F7i5cHUxOkQgsKtxnUGKlBxDHeGGLoK3g,673
|
|
@@ -248,14 +243,14 @@ jaclang/tests/fixtures/tuplytuples.jac,sha256=6qiXn5OV_qn4cqKwROjJ1VuBAh0nbUGpp-
|
|
|
248
243
|
jaclang/tests/fixtures/type_info.jac,sha256=4Cw31ef5gny6IS0kLzgeSO-7ArEH1HgFFFip1BGQhZM,316
|
|
249
244
|
jaclang/tests/fixtures/walker_override.jac,sha256=Ok58ZAgxuV6aECNxYrjbbyAWSiqIbnly3N3O6cD563o,271
|
|
250
245
|
jaclang/tests/fixtures/with_context.jac,sha256=cDA_4YWe5UVmQRgcpktzkZ_zsswQpV_T2Otf_rFnPy8,466
|
|
251
|
-
jaclang/tests/fixtures/with_llm_function.jac,sha256=
|
|
252
|
-
jaclang/tests/fixtures/with_llm_lower.jac,sha256=
|
|
253
|
-
jaclang/tests/fixtures/with_llm_method.jac,sha256=
|
|
254
|
-
jaclang/tests/fixtures/with_llm_type.jac,sha256=
|
|
255
|
-
jaclang/tests/fixtures/with_llm_vision.jac,sha256=
|
|
246
|
+
jaclang/tests/fixtures/with_llm_function.jac,sha256=Tt5C9rmAtHPGMVWx9A6M9iYLasPZVBecM_bzK_5btz8,797
|
|
247
|
+
jaclang/tests/fixtures/with_llm_lower.jac,sha256=G-aq6uQnRfcnXvv9Jan_WO7X1o0xU_FCKTzk007aXsQ,1871
|
|
248
|
+
jaclang/tests/fixtures/with_llm_method.jac,sha256=_la52GnLVXE5wnF3t8ZaL_72ojXHpzeYLlL-4zUOdM8,1413
|
|
249
|
+
jaclang/tests/fixtures/with_llm_type.jac,sha256=IXXgOaLPz90IbU8az9FqxmzKW9m08t3cq3146QWkXoA,1771
|
|
250
|
+
jaclang/tests/fixtures/with_llm_vision.jac,sha256=2UC_i1ufnXk9uhj4ruEaR_6romR_r2CVN3YwMLDdgGY,672
|
|
256
251
|
jaclang/tests/test_bugs.py,sha256=tBPsIlSPqZDIz4QaScNRT-WdGIdJ0uU-aRBWq1XUZ6o,555
|
|
257
252
|
jaclang/tests/test_cli.py,sha256=tnqdx8W5jTlsDJYR3713EikJqCbcgWEknEwuRHByvWk,8703
|
|
258
|
-
jaclang/tests/test_language.py,sha256=
|
|
253
|
+
jaclang/tests/test_language.py,sha256=CWEFxvkPI2TnNt_W3zDv737srQ9NQnX2ByLEvxnB-do,39210
|
|
259
254
|
jaclang/tests/test_man_code.py,sha256=Kq93zg3hEfiouvpWvmfCgR6lDT5RKDp28k5ZaWe1Xeg,4519
|
|
260
255
|
jaclang/tests/test_reference.py,sha256=FoZQS-U9teiag8mAmX5X6ak4fuCOv00mvOyqJ44Zkc8,3379
|
|
261
256
|
jaclang/tests/test_settings.py,sha256=TIX5uiu8H9IpZN2__uFiclcdCpBpPpcAwtlEHyFC4kk,1999
|
|
@@ -1489,7 +1484,7 @@ jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjW
|
|
|
1489
1484
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD,sha256=XS4fBVrPI7kaNZ56Ggl2RGa76jySWLqTzcrUpZIQTVM,418
|
|
1490
1485
|
jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
1491
1486
|
jaclang/vendor/typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
|
|
1492
|
-
jaclang-0.7.
|
|
1493
|
-
jaclang-0.7.
|
|
1494
|
-
jaclang-0.7.
|
|
1495
|
-
jaclang-0.7.
|
|
1487
|
+
jaclang-0.7.6.dist-info/METADATA,sha256=JomH4mb5sIr3hHysKl_vBgPYtLN47-GVs-wnOXnJU1k,4807
|
|
1488
|
+
jaclang-0.7.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
1489
|
+
jaclang-0.7.6.dist-info/entry_points.txt,sha256=8sMi4Tvi9f8tQDN2QAXsSA2icO27zQ4GgEdph6bNEZM,49
|
|
1490
|
+
jaclang-0.7.6.dist-info/RECORD,,
|
jaclang/core/llms/__init__.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"""LLM implementations for MTLLM."""
|
|
2
|
-
|
|
3
|
-
from .anthropic import Anthropic
|
|
4
|
-
from .base import BaseLLM
|
|
5
|
-
from .groq import Groq
|
|
6
|
-
from .huggingface import Huggingface
|
|
7
|
-
from .ollama import Ollama
|
|
8
|
-
from .openai import OpenAI
|
|
9
|
-
from .togetherai import TogetherAI
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"Anthropic",
|
|
14
|
-
"Ollama",
|
|
15
|
-
"Huggingface",
|
|
16
|
-
"Groq",
|
|
17
|
-
"BaseLLM",
|
|
18
|
-
"OpenAI",
|
|
19
|
-
"TogetherAI",
|
|
20
|
-
]
|
jaclang/core/llms/anthropic.py
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"""Anthropic API client for MTLLM."""
|
|
2
|
-
|
|
3
|
-
from .base import BaseLLM
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
REASON_SUFFIX = """
|
|
7
|
-
Reason and return the output result(s) only, adhering to the provided Type in the following format
|
|
8
|
-
|
|
9
|
-
[Reasoning] <Reason>
|
|
10
|
-
[Output] <Result>
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
NORMAL_SUFFIX = """Generate and return the output result(s) only, adhering to the provided Type in the following format
|
|
14
|
-
|
|
15
|
-
[Output] <result>
|
|
16
|
-
""" # noqa E501
|
|
17
|
-
|
|
18
|
-
CHAIN_OF_THOUGHT_SUFFIX = """
|
|
19
|
-
Generate and return the output result(s) only, adhering to the provided Type in the following format. Perform the operation in a chain of thoughts.(Think Step by Step)
|
|
20
|
-
|
|
21
|
-
[Chain of Thoughts] <Chain of Thoughts>
|
|
22
|
-
[Output] <Result>
|
|
23
|
-
""" # noqa E501
|
|
24
|
-
|
|
25
|
-
REACT_SUFFIX = """
|
|
26
|
-
""" # noqa E501
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Anthropic(BaseLLM):
|
|
30
|
-
"""Anthropic API client for MTLLM."""
|
|
31
|
-
|
|
32
|
-
MTLLM_METHOD_PROMPTS: dict[str, str] = {
|
|
33
|
-
"Normal": NORMAL_SUFFIX,
|
|
34
|
-
"Reason": REASON_SUFFIX,
|
|
35
|
-
"Chain-of-Thoughts": CHAIN_OF_THOUGHT_SUFFIX,
|
|
36
|
-
"ReAct": REACT_SUFFIX,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
def __init__(
|
|
40
|
-
self, verbose: bool = False, max_tries: int = 10, **kwargs: dict
|
|
41
|
-
) -> None:
|
|
42
|
-
"""Initialize the Anthropic API client."""
|
|
43
|
-
import anthropic # type: ignore
|
|
44
|
-
|
|
45
|
-
self.client = anthropic.Anthropic()
|
|
46
|
-
self.verbose = verbose
|
|
47
|
-
self.max_tries = max_tries
|
|
48
|
-
self.model_name = str(kwargs.get("model_name", "claude-3-sonnet-20240229"))
|
|
49
|
-
self.temperature = kwargs.get("temperature", 0.7)
|
|
50
|
-
self.max_tokens = kwargs.get("max_tokens", 1024)
|
|
51
|
-
|
|
52
|
-
def __infer__(self, meaning_in: str | list[dict], **kwargs: dict) -> str:
|
|
53
|
-
"""Infer a response from the input meaning."""
|
|
54
|
-
if not isinstance(meaning_in, str):
|
|
55
|
-
assert self.model_name.startswith(
|
|
56
|
-
("claude-3-opus", "claude-3-sonnet", "claude-3-haiku")
|
|
57
|
-
), f"Model {self.model_name} is not multimodal, use a multimodal model instead."
|
|
58
|
-
|
|
59
|
-
import re
|
|
60
|
-
|
|
61
|
-
formatted_meaning_in = []
|
|
62
|
-
for item in meaning_in:
|
|
63
|
-
if item["type"] == "image_url":
|
|
64
|
-
# "data:image/jpeg;base64,base64_string"
|
|
65
|
-
img_match = re.match(
|
|
66
|
-
r"data:(image/[a-zA-Z]*);base64,(.*)", item["source"]
|
|
67
|
-
)
|
|
68
|
-
if img_match:
|
|
69
|
-
media_type, base64_string = img_match.groups()
|
|
70
|
-
formatted_meaning_in.append(
|
|
71
|
-
{
|
|
72
|
-
"type": "image",
|
|
73
|
-
"source": {
|
|
74
|
-
"type": "base64",
|
|
75
|
-
"media_type": media_type,
|
|
76
|
-
"data": base64_string,
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
continue
|
|
81
|
-
formatted_meaning_in.append(item)
|
|
82
|
-
meaning_in = formatted_meaning_in
|
|
83
|
-
messages = [{"role": "user", "content": meaning_in}]
|
|
84
|
-
output = self.client.messages.create(
|
|
85
|
-
model=kwargs.get("model_name", self.model_name),
|
|
86
|
-
temperature=kwargs.get("temperature", self.temperature),
|
|
87
|
-
max_tokens=kwargs.get("max_tokens", self.max_tokens),
|
|
88
|
-
messages=messages,
|
|
89
|
-
)
|
|
90
|
-
return output.content[0].text
|