jaclang 0.5.18__py3-none-any.whl → 0.6.1__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.

Files changed (57) hide show
  1. jaclang/cli/cli.py +94 -5
  2. jaclang/cli/cmdreg.py +18 -6
  3. jaclang/compiler/__init__.py +12 -5
  4. jaclang/compiler/absyntree.py +4 -5
  5. jaclang/compiler/generated/jac_parser.py +2 -2
  6. jaclang/compiler/jac.lark +2 -2
  7. jaclang/compiler/parser.py +48 -8
  8. jaclang/compiler/passes/main/__init__.py +3 -2
  9. jaclang/compiler/passes/main/access_modifier_pass.py +173 -0
  10. jaclang/compiler/passes/main/def_impl_match_pass.py +4 -1
  11. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +10 -7
  12. jaclang/compiler/passes/main/import_pass.py +70 -40
  13. jaclang/compiler/passes/main/pyast_gen_pass.py +47 -83
  14. jaclang/compiler/passes/main/pyast_load_pass.py +136 -73
  15. jaclang/compiler/passes/main/pyjac_ast_link_pass.py +218 -0
  16. jaclang/compiler/passes/main/pyout_pass.py +14 -13
  17. jaclang/compiler/passes/main/registry_pass.py +8 -3
  18. jaclang/compiler/passes/main/schedules.py +7 -3
  19. jaclang/compiler/passes/main/sym_tab_build_pass.py +32 -29
  20. jaclang/compiler/passes/main/tests/test_import_pass.py +13 -2
  21. jaclang/compiler/passes/tool/jac_formatter_pass.py +83 -21
  22. jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +11 -4
  23. jaclang/compiler/passes/transform.py +2 -0
  24. jaclang/compiler/symtable.py +10 -3
  25. jaclang/compiler/tests/test_importer.py +9 -0
  26. jaclang/compiler/workspace.py +17 -5
  27. jaclang/core/aott.py +43 -63
  28. jaclang/core/construct.py +157 -21
  29. jaclang/core/importer.py +77 -65
  30. jaclang/core/llms/__init__.py +20 -0
  31. jaclang/core/llms/anthropic.py +61 -0
  32. jaclang/core/llms/base.py +206 -0
  33. jaclang/core/llms/groq.py +67 -0
  34. jaclang/core/llms/huggingface.py +73 -0
  35. jaclang/core/llms/ollama.py +78 -0
  36. jaclang/core/llms/openai.py +61 -0
  37. jaclang/core/llms/togetherai.py +60 -0
  38. jaclang/core/llms/utils.py +9 -0
  39. jaclang/core/memory.py +48 -0
  40. jaclang/core/shelve_storage.py +55 -0
  41. jaclang/core/utils.py +16 -1
  42. jaclang/plugin/__init__.py +1 -2
  43. jaclang/plugin/builtin.py +1 -1
  44. jaclang/plugin/default.py +134 -18
  45. jaclang/plugin/feature.py +35 -13
  46. jaclang/plugin/spec.py +52 -10
  47. jaclang/plugin/tests/test_jaseci.py +219 -0
  48. jaclang/settings.py +1 -1
  49. jaclang/utils/helpers.py +6 -2
  50. jaclang/utils/treeprinter.py +14 -6
  51. jaclang-0.6.1.dist-info/METADATA +17 -0
  52. {jaclang-0.5.18.dist-info → jaclang-0.6.1.dist-info}/RECORD +55 -42
  53. jaclang/core/llms.py +0 -111
  54. jaclang-0.5.18.dist-info/METADATA +0 -7
  55. {jaclang-0.5.18.dist-info → jaclang-0.6.1.dist-info}/WHEEL +0 -0
  56. {jaclang-0.5.18.dist-info → jaclang-0.6.1.dist-info}/entry_points.txt +0 -0
  57. {jaclang-0.5.18.dist-info → jaclang-0.6.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,219 @@
1
+ """Test for jaseci plugin."""
2
+
3
+ import io
4
+ import os
5
+ import sys
6
+
7
+ from jaclang.cli import cli
8
+ from jaclang.utils.test import TestCase
9
+
10
+
11
+ class TestJaseciPlugin(TestCase):
12
+ """Test jaseci plugin."""
13
+
14
+ def setUp(self) -> None:
15
+ """Set up test."""
16
+ super().setUp()
17
+
18
+ def tearDown(self) -> None:
19
+ """Tear down test."""
20
+ super().tearDown()
21
+ sys.stdout = sys.__stdout__
22
+
23
+ def _output2buffer(self) -> None:
24
+ """Start capturing output."""
25
+ self.capturedOutput = io.StringIO()
26
+ sys.stdout = self.capturedOutput
27
+
28
+ def _output2std(self) -> None:
29
+ """Redirect output back to stdout."""
30
+ sys.stdout = sys.__stdout__
31
+
32
+ def _del_session(self, session: str) -> None:
33
+ if os.path.exists(session):
34
+ os.remove(session)
35
+
36
+ def test_walker_simple_persistent(self) -> None:
37
+ """Test simple persistent object."""
38
+ session = self.fixture_abs_path("test_walker_simple_persistent.session")
39
+ self._output2buffer()
40
+ cli.run(
41
+ filename=self.fixture_abs_path("simple_persistent.jac"),
42
+ session=session,
43
+ walker="create",
44
+ )
45
+ cli.run(
46
+ filename=self.fixture_abs_path("simple_persistent.jac"),
47
+ session=session,
48
+ walker="traverse",
49
+ )
50
+ output = self.capturedOutput.getvalue().strip()
51
+ self.assertEqual(output, "node a\nnode b")
52
+ self._del_session(session)
53
+
54
+ def test_entrypoint_root(self) -> None:
55
+ """Test entrypoint being root."""
56
+ session = self.fixture_abs_path("test_entrypoint_root.session")
57
+ cli.run(
58
+ filename=self.fixture_abs_path("simple_persistent.jac"),
59
+ session=session,
60
+ walker="create",
61
+ )
62
+ obj = cli.get_object(session=session, id="root")
63
+ self._output2buffer()
64
+ cli.run(
65
+ filename=self.fixture_abs_path("simple_persistent.jac"),
66
+ session=session,
67
+ node=str(obj["_jac_"]["id"]),
68
+ walker="traverse",
69
+ )
70
+ output = self.capturedOutput.getvalue().strip()
71
+ self.assertEqual(output, "node a\nnode b")
72
+ self._del_session(session)
73
+
74
+ def test_entrypoint_non_root(self) -> None:
75
+ """Test entrypoint being non root node."""
76
+ session = self.fixture_abs_path("test_entrypoint_non_root.session")
77
+ cli.run(
78
+ filename=self.fixture_abs_path("simple_persistent.jac"),
79
+ session=session,
80
+ walker="create",
81
+ )
82
+ obj = cli.get_object(session=session, id="root")
83
+ edge_obj = cli.get_object(session=session, id=str(obj["_jac_"]["edge_ids"][0]))
84
+ a_obj = cli.get_object(session=session, id=str(edge_obj["_jac_"]["target_id"]))
85
+ self._output2buffer()
86
+ cli.run(
87
+ filename=self.fixture_abs_path("simple_persistent.jac"),
88
+ session=session,
89
+ node=str(a_obj["_jac_"]["id"]),
90
+ walker="traverse",
91
+ )
92
+ output = self.capturedOutput.getvalue().strip()
93
+ self.assertEqual(output, "node a\nnode b")
94
+ self._del_session(session)
95
+
96
+ def test_get_edge(self) -> None:
97
+ """Test get an edge object."""
98
+ session = self.fixture_abs_path("test_get_edge.session")
99
+ cli.run(
100
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
101
+ session=session,
102
+ )
103
+ obj = cli.get_object(session=session, id="root")
104
+ self.assertEqual(len(obj["_jac_"]["edge_ids"]), 2)
105
+ edge_objs = [
106
+ cli.get_object(session=session, id=str(e_id))
107
+ for e_id in obj["_jac_"]["edge_ids"]
108
+ ]
109
+ node_ids = [obj["_jac_"]["target_id"] for obj in edge_objs]
110
+ node_objs = [cli.get_object(session=session, id=str(n_id)) for n_id in node_ids]
111
+ self.assertEqual(len(node_objs), 2)
112
+ self.assertEqual({obj["tag"] for obj in node_objs}, {"first", "second"})
113
+ self._del_session(session)
114
+
115
+ def test_filter_on_edge_get_edge(self) -> None:
116
+ """Test filtering on edge."""
117
+ session = self.fixture_abs_path("test_filter_on_edge_get_edge.session")
118
+ cli.run(
119
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
120
+ session=session,
121
+ )
122
+ self._output2buffer()
123
+ cli.run(
124
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
125
+ session=session,
126
+ walker="filter_on_edge_get_edge",
127
+ )
128
+ self.assertEqual(
129
+ self.capturedOutput.getvalue().strip(), "[simple_edge(index=1)]"
130
+ )
131
+ self._del_session(session)
132
+
133
+ def test_filter_on_edge_get_node(self) -> None:
134
+ """Test filtering on edge, then get node."""
135
+ session = self.fixture_abs_path("test_filter_on_edge_get_node.session")
136
+ cli.run(
137
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
138
+ session=session,
139
+ )
140
+ self._output2buffer()
141
+ cli.run(
142
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
143
+ session=session,
144
+ walker="filter_on_edge_get_node",
145
+ )
146
+ self.assertEqual(
147
+ self.capturedOutput.getvalue().strip(), "[simple(tag='second')]"
148
+ )
149
+ self._del_session(session)
150
+
151
+ def test_filter_on_node_get_node(self) -> None:
152
+ """Test filtering on node, then get edge."""
153
+ session = self.fixture_abs_path("test_filter_on_node_get_node.session")
154
+ cli.run(
155
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
156
+ session=session,
157
+ )
158
+ self._output2buffer()
159
+ cli.run(
160
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
161
+ session=session,
162
+ walker="filter_on_node_get_node",
163
+ )
164
+ self.assertEqual(
165
+ self.capturedOutput.getvalue().strip(), "[simple(tag='second')]"
166
+ )
167
+ self._del_session(session)
168
+
169
+ def test_filter_on_edge_visit(self) -> None:
170
+ """Test filtering on edge, then visit."""
171
+ session = self.fixture_abs_path("test_filter_on_edge_visit.session")
172
+ cli.run(
173
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
174
+ session=session,
175
+ )
176
+ self._output2buffer()
177
+ cli.run(
178
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
179
+ session=session,
180
+ walker="filter_on_edge_visit",
181
+ )
182
+ self.assertEqual(self.capturedOutput.getvalue().strip(), "simple(tag='first')")
183
+ self._del_session(session)
184
+
185
+ def test_filter_on_node_visit(self) -> None:
186
+ """Test filtering on node, then visit."""
187
+ session = self.fixture_abs_path("test_filter_on_node_visit.session")
188
+ cli.run(
189
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
190
+ session=session,
191
+ )
192
+ self._output2buffer()
193
+ cli.run(
194
+ filename=self.fixture_abs_path("simple_node_connection.jac"),
195
+ session=session,
196
+ walker="filter_on_node_visit",
197
+ )
198
+ self.assertEqual(self.capturedOutput.getvalue().strip(), "simple(tag='first')")
199
+ self._del_session(session)
200
+
201
+ def test_indirect_reference_node(self) -> None:
202
+ """Test reference node indirectly without visiting."""
203
+ session = self.fixture_abs_path("test_indirect_reference_node.session")
204
+ cli.run(
205
+ filename=self.fixture_abs_path("simple_persistent.jac"),
206
+ session=session,
207
+ walker="create",
208
+ )
209
+ self._output2buffer()
210
+ cli.run(
211
+ filename=self.fixture_abs_path("simple_persistent.jac"),
212
+ session=session,
213
+ walker="indirect_ref",
214
+ )
215
+ self.assertEqual(
216
+ self.capturedOutput.getvalue().strip(),
217
+ "[b(name='node b')]\n[GenericEdge]",
218
+ )
219
+ self._del_session(session)
jaclang/settings.py CHANGED
@@ -10,7 +10,7 @@ class Settings:
10
10
  """Main settings of Jac lang."""
11
11
 
12
12
  fuse_type_info_debug: bool = False
13
- jac_proc_debug: bool = False
13
+ py_raise: bool = False
14
14
 
15
15
  def __post_init__(self) -> None:
16
16
  """Initialize settings."""
jaclang/utils/helpers.py CHANGED
@@ -131,7 +131,6 @@ def import_target_to_relative_path(
131
131
  import_level: int,
132
132
  import_target: str,
133
133
  base_path: Optional[str] = None,
134
- file_extension: str = ".jac",
135
134
  ) -> str:
136
135
  """Convert an import target string into a relative file path."""
137
136
  if not base_path:
@@ -141,7 +140,12 @@ def import_target_to_relative_path(
141
140
  actual_parts = parts[traversal_levels:]
142
141
  for _ in range(traversal_levels):
143
142
  base_path = os.path.dirname(base_path)
144
- relative_path = os.path.join(base_path, *actual_parts) + file_extension
143
+ relative_path = os.path.join(base_path, *actual_parts)
144
+ relative_path = (
145
+ relative_path + ".jac"
146
+ if os.path.exists(relative_path + ".jac")
147
+ else relative_path
148
+ )
145
149
  return relative_path
146
150
 
147
151
 
@@ -88,16 +88,24 @@ def print_ast_tree(
88
88
  from jaclang.compiler.absyntree import AstSymbolNode, Token
89
89
 
90
90
  def __node_repr_in_tree(node: AstNode) -> str:
91
+ access = (
92
+ f"Access: {node.access.tag.value}"
93
+ if isinstance(node, ast.AstAccessNode) and node.access is not None
94
+ else ""
95
+ )
96
+ sym_table_link = (
97
+ f", SymbolTable: {node.sym_info.typ_sym_table.name}"
98
+ if isinstance(node, AstSymbolNode) and node.sym_info.typ_sym_table
99
+ else ", SymbolTable: None" if isinstance(node, AstSymbolNode) else ""
100
+ )
91
101
  if isinstance(node, Token) and isinstance(node, AstSymbolNode):
92
- return (
93
- f"{node.__class__.__name__} - {node.value} - Type: {node.sym_info.typ}"
94
- )
102
+ return f"{node.__class__.__name__} - {node.value} - Type: {node.sym_info.typ}, {access} {sym_table_link}"
95
103
  elif isinstance(node, Token):
96
- return f"{node.__class__.__name__} - {node.value}"
104
+ return f"{node.__class__.__name__} - {node.value}, {access}"
97
105
  elif isinstance(node, AstSymbolNode):
98
- return f"{node.__class__.__name__} - {node.sym_name} - Type: {node.sym_info.typ}"
106
+ return f"{node.__class__.__name__} - {node.sym_name} - Type: {node.sym_info.typ}, {access} {sym_table_link}"
99
107
  else:
100
- return f"{node.__class__.__name__}"
108
+ return f"{node.__class__.__name__}, {access}"
101
109
 
102
110
  def __node_repr_in_py_tree(node: ast3.AST) -> str:
103
111
  if isinstance(node, ast3.Constant):
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: jaclang
3
+ Version: 0.6.1
4
+ Home-page: https://github.com/Jaseci-Labs/jaclang
5
+ Author: Jason Mars
6
+ Author-email: jason@jaseci.org
7
+ Provides-Extra: llms
8
+ Requires-Dist: transformers ; extra == 'llms'
9
+ Requires-Dist: accelerator ; extra == 'llms'
10
+ Requires-Dist: torch ; extra == 'llms'
11
+ Requires-Dist: ollama ; extra == 'llms'
12
+ Requires-Dist: anthropic ; extra == 'llms'
13
+ Requires-Dist: groq ; extra == 'llms'
14
+ Requires-Dist: openai ; extra == 'llms'
15
+ Requires-Dist: together ; extra == 'llms'
16
+ Requires-Dist: loguru ; extra == 'llms'
17
+
@@ -1,40 +1,42 @@
1
1
  jaclang/__init__.py,sha256=vTvt9LIz5RNKrLRueH3gUM3KTAjsqoanHQ_Pn9m4i9g,675
2
- jaclang/settings.py,sha256=qu17a7AenlX1vUnZTHWnaKvwqwKQxWiYueWjLr6MWKY,3162
2
+ jaclang/settings.py,sha256=2bLDsF1xiFI9VL8vEIPZ5A5Q-XQ9hfK9lIszH99nKkc,3156
3
3
  jaclang/cli/__init__.py,sha256=7aaPgYddIAHBvkdv36ngbfwsimMnfGaTDcaHYMg_vf4,23
4
- jaclang/cli/cli.py,sha256=_z3PmgTvLS_zkFe-BC7uvmKKJ2ZQqDhQAQpAAlebZOg,10687
5
- jaclang/cli/cmdreg.py,sha256=bn2UdOkNbE-4zfbomO2j8rTtkXhsltH4jE5rKqA5HbY,7862
6
- jaclang/compiler/__init__.py,sha256=X_n8G4KrjWePCGNC1Leo3d1is4MBer4xCHc0A4983-g,2937
7
- jaclang/compiler/absyntree.py,sha256=quVRgeMZl0AcZ5It5qwKOudLFl7MqOzHcHiERIjUBEo,126927
4
+ jaclang/cli/cli.py,sha256=ebyAI2if_uNOOnmr0fFWZfi0yDHrcHLs_64t_a7vccI,13114
5
+ jaclang/cli/cmdreg.py,sha256=u0jAd6A8czt7tBgPBBKBhYAG4By1FrjEGaTU2XFKeYs,8372
6
+ jaclang/compiler/__init__.py,sha256=Fq2rBjvbFxTbolEC872X5CicOjyJmKo0yZlnUcChg6k,3119
7
+ jaclang/compiler/absyntree.py,sha256=FdXLGp2FR5PqqEeDhZ-yidoA1xxontQrqTDZcmQmuvc,126904
8
8
  jaclang/compiler/codeloc.py,sha256=KMwf5OMQu3_uDjIdH7ta2piacUtXNPgUV1t8OuLjpzE,2828
9
9
  jaclang/compiler/compile.py,sha256=fS6Uvor93EavESKrwadqp7bstcpMRRACvBkqbr4En04,2682
10
10
  jaclang/compiler/constant.py,sha256=C8nOgWLAg-fRg8Qax_jRcYp6jGyWSSA1gwzk9Zdy7HE,6534
11
- jaclang/compiler/jac.lark,sha256=Xz6xlZ2-YVzshh6WJPh35AU8QispGy1zebr1htclf_Y,16995
12
- jaclang/compiler/parser.py,sha256=kwA6qJXxaZOnhkmNuXav03CH57RJXdohY-bw-jsjDWo,136544
13
- jaclang/compiler/symtable.py,sha256=SRYSwZtLHXLIOkE9CfdWDkkwx0vDLXvMeYiFfh6-wP4,5769
14
- jaclang/compiler/workspace.py,sha256=8r7vNhIKgct2eE7sXaSrfy3NzrE9V2rhnaIXDEArgc8,7381
11
+ jaclang/compiler/jac.lark,sha256=Kvq5zZbQMJ-1bdXLVuCafRVS9w91UfN-0nLnEq0gOSw,17019
12
+ jaclang/compiler/parser.py,sha256=7MCxaVZ_yyAR7YZ8zsFa4G_JkIUANh-HgB6v0MPjEfM,138178
13
+ jaclang/compiler/symtable.py,sha256=f-9c3eQJTDhEG22kYC3Vd4i5gRWf77_CsqFm7t8Wsng,6031
14
+ jaclang/compiler/workspace.py,sha256=I1MF2jaSylDOcQQV4Ez3svi4FdOyfmbNupuZT7q9aFQ,7797
15
15
  jaclang/compiler/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- jaclang/compiler/generated/jac_parser.py,sha256=wwJA422L2G8eor8eqgv04pshhDxsLnYyi5MAE4lDKQE,334286
16
+ jaclang/compiler/generated/jac_parser.py,sha256=UQAJYoyhoTtWbpZSyz5otTI7G30DaZWrtnj8RELvqDw,338438
17
17
  jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
18
18
  jaclang/compiler/passes/ir_pass.py,sha256=gh1Zd8ouu79FoxerW1sMxktmfeC9gHyp4H_MoAviYP8,5504
19
- jaclang/compiler/passes/transform.py,sha256=6t-bbX_s615i7_naOIBjT4wvAkvLFM4niRHYyF4my8A,2086
20
- jaclang/compiler/passes/main/__init__.py,sha256=jT0AZ3-Cp4VIoJUdUAfwEdjgB0mtMRaqMIw4cjlrLvs,905
21
- jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=_KgAVVzMAatigKDp1vAnhyY2GcWf0rRoD8MkfYg-POU,3297
19
+ jaclang/compiler/passes/transform.py,sha256=Z3TuHMJ7TyyBHt0XmRWEjMk8-t6logKs7XG_OTDJIvo,2162
20
+ jaclang/compiler/passes/main/__init__.py,sha256=m8vZ0F6EiwOm0e0DWKRYgc8JcgiT2ayBrY6GojZkTfY,945
21
+ jaclang/compiler/passes/main/access_modifier_pass.py,sha256=1tQJ9bNlOVX3sgL0DK4jv643Pu5xl68oL8LNsaHf-MY,4864
22
+ jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=L78FrCoUsflxGueKITda_idfwZOo4dbr68bzmwXyKUQ,3442
22
23
  jaclang/compiler/passes/main/def_use_pass.py,sha256=d2REmfme2HjUj8avDcXUuPbv3yKfvYHqpL49sxniLhQ,8576
23
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=9WrF78r4cNWnDqofx225b9cUZafTi3HwCffXINmgoZ0,15968
24
- jaclang/compiler/passes/main/import_pass.py,sha256=EgMoPDpDNucbh7s4WRkMEfOdEtXM6dtsN0Qorwh489A,6384
25
- jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=q1GM4zXA-33MsqMlvJhGa8z1ydcGA9hMRHVZle9O_aU,138177
26
- jaclang/compiler/passes/main/pyast_load_pass.py,sha256=WXq7Ahaev2ZIsPtmXnPgHn6sIGOpRJaAMHtNrJUSHRU,87133
24
+ jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=Y7pQSmeCxGcn3X912A_u-JqKV6pxn-7bwXsOhVmgYko,15944
25
+ jaclang/compiler/passes/main/import_pass.py,sha256=Ac_vpWDmGqg9Tv5OfOFjRrT43QHu2BdzVaLCmFnHxRc,7482
26
+ jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=sL5VIR2cT_NQYlyFopZz5XSXjQcisltVwdmLL8pXf3w,136197
27
+ jaclang/compiler/passes/main/pyast_load_pass.py,sha256=UDbosNQ88CcfSW1wKBYgLRz3ZBxpJ8cGwpn_KZaYvvk,89725
27
28
  jaclang/compiler/passes/main/pybc_gen_pass.py,sha256=CjA9AqyMO3Pv_b5Hh0YI6JmCqIru2ASonO6rhrkau-M,1336
28
- jaclang/compiler/passes/main/pyout_pass.py,sha256=jw-ApCvVyAqynBFCArPQ20wq2ou0s7lTCGqcUyxrJWI,3018
29
- jaclang/compiler/passes/main/registry_pass.py,sha256=VEaQKNNZZjRhgMf809X1HpytNzV2W9HyViB2SwQvxNI,4421
30
- jaclang/compiler/passes/main/schedules.py,sha256=Tn_jr6Lunm3t5tAluxvE493qfa4lF2kgIQPN0J42TEE,1048
29
+ jaclang/compiler/passes/main/pyjac_ast_link_pass.py,sha256=K5jNHRPrFcC_-RbgY7lngSNSDQLQr27N31_aUrGUACo,7864
30
+ jaclang/compiler/passes/main/pyout_pass.py,sha256=clJkASFiBiki5w0MQXYIwcdvahYETgqAjKlYOYVYKNQ,3137
31
+ jaclang/compiler/passes/main/registry_pass.py,sha256=Lp_EqlflXkSgQuJe_EVBtzC16YAJx70bDO6X0nJIX5U,4579
32
+ jaclang/compiler/passes/main/schedules.py,sha256=oTH2EvvopLdmrtPl8b-CENWAPviIZe7qNLOuODJ5Iuw,1253
31
33
  jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=fGgK0CBWsuD6BS4BsLwXPl1b5UC2N2YEOGa6jNMu8N8,1332
32
- jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=xLlcsntcVHVZ7YEyp1Jh_tKw93dQP2uqK5D5JFQtOyI,41678
34
+ jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=1bUU-p0zCoLoF7_HgLr2FKxUuc_4y2O7-5FSJD8mfWc,42020
33
35
  jaclang/compiler/passes/main/type_check_pass.py,sha256=-f41Ukr3B1w4rkQdZ2xJy6nozymgnVKjJ8E1fn7qJmI,3339
34
36
  jaclang/compiler/passes/main/tests/__init__.py,sha256=UBAATLUEH3yuBN4LYKnXXV79kokRc4XB-rX12qfu0ds,28
35
37
  jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py,sha256=QDsvTEpJt3AuS3GRwfq-1mezRCpx7rwEEyg1AbusaBs,1374
36
38
  jaclang/compiler/passes/main/tests/test_def_use_pass.py,sha256=dmyZgXugOCN-_YY7dxkNHgt8vqey8qzNJf8sWyLLZ5w,1013
37
- jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=KDTIhUnAVyp0iQ64lC6RQvOkdS7CNVtVbfPbG1aX1L8,580
39
+ jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=2oRz8lO1ORiTn36NkkshpXeT_K0L_jM8KZuvxgVzbbE,1141
38
40
  jaclang/compiler/passes/main/tests/test_pyast_build_pass.py,sha256=LIT4TP-nhtftRtY5rNySRQlim-dWMSlkfUvkhZTk4pc,1383
39
41
  jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py,sha256=fNL_FS26AQGlRCvwWfl-Qyt7iW2_A99GIHOAnnkpw9A,4731
40
42
  jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py,sha256=If8PE4exN5g9o1NRElNC0XdfIwJAp7M7f69rzmYRYUQ,655
@@ -45,40 +47,51 @@ jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=bzrVcsBZra2HkQ
45
47
  jaclang/compiler/passes/main/tests/test_typeinfo_pass.py,sha256=ehC0_giLg7NwB7fR10nW5Te8mZ76qmUFxkK1bEjtmrw,129
46
48
  jaclang/compiler/passes/tool/__init__.py,sha256=xekCOXysHIcthWm8NRmQoA1Ah1XV8vFbkfeHphJtUdc,223
47
49
  jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=N9a84qArNuTXX1iaXsBzqcufx6A3zYq2p-1ieH6FmHc,3133
48
- jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=PKG6jvJeqzPj3loytwymYwTXT-Dhq5opLmfFKXvwj30,83271
50
+ jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=oYXDWWlxYj0FGXxXUOPnmwnkFPmayd2fRoWngvDgXwc,86113
49
51
  jaclang/compiler/passes/tool/schedules.py,sha256=kmbsCazAMizGAdQuZpFky5BPlYlMXqNw7wOUzdi_wBo,432
50
52
  jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmOzW7pxGr4U1fOwgK_Y,24
51
53
  jaclang/compiler/passes/tool/tests/test_fuse_comments_pass.py,sha256=ZeWHsm7VIyyS8KKpoB2SdlHM4jF22fMfSrfTfxt2MQw,398
52
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=Ii5lDsAlS2cbTQPdU-BHL1Vbd_679_lcu4_IrNqBM1k,5869
54
+ jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=P4vBRbwVAkb8svFSAOf4VKioZS8BkoaVfYdn-LCrRqA,6144
53
55
  jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=Tg9k7BOSkWngAZLvSHmPt95ILJzdIvdHxKBT__mgpS0,2910
54
56
  jaclang/compiler/passes/utils/__init__.py,sha256=UsI5rUopTUiStAzup4kbPwIwrnC5ofCrqWBCBbM2-k4,35
55
57
  jaclang/compiler/passes/utils/mypy_ast_build.py,sha256=0EJGhsdcIQoXeUbHlqZrPMa9XD69BZ5RcamrfOLKdk4,26057
56
58
  jaclang/compiler/tests/__init__.py,sha256=qiXa5UNRBanGOcplFKTT9a_9GEyiv7goq1OzuCjDCFE,27
57
- jaclang/compiler/tests/test_importer.py,sha256=QSzwYYsAfyU-dcEsvKp1KWZ-gEanWdjIBy5bGY3vUfw,1334
59
+ jaclang/compiler/tests/test_importer.py,sha256=JNmte5FsHhnng9jzw7N5BenflAFCasuhezN1sytDVyg,1739
58
60
  jaclang/compiler/tests/test_parser.py,sha256=C81mUo8EGwypPTTLRVS9BglP0Dyye9xaPSQtw7cwnnI,4814
59
61
  jaclang/compiler/tests/test_workspace.py,sha256=SEBcvz_daTbonrLHK9FbjiH86TUbOtVGH-iZ3xkJSMk,3184
60
62
  jaclang/compiler/tests/fixtures/__init__.py,sha256=udQ0T6rajpW_nMiYKJNckqP8izZ-pH3P4PNTJEln2NU,36
61
63
  jaclang/compiler/tests/fixtures/activity.py,sha256=fSvxYDKufsPeQIrbuh031zHw_hdbRv5iK9mS7dD8E54,263
62
64
  jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
63
- jaclang/core/aott.py,sha256=_CdK1l37BK5ZCfA7NjOouH-xveWWbsBCRFz24dvsQZA,7716
64
- jaclang/core/construct.py,sha256=_mYHEbUPY3Dn0rcl21eJXLqAGYH_0_C-x1K9HDa2RKk,13633
65
- jaclang/core/importer.py,sha256=8aNHfUOx_Pw6Knox__n3Gq8uub0pWWmXWsW3kGPFv8k,5437
66
- jaclang/core/llms.py,sha256=bs0EoQcIZc_45HSxDHSEwUgyw-YhawfX4kQYM16UNnk,4139
65
+ jaclang/core/aott.py,sha256=MMFmel9cf1KrREjLUY9vV0b38pdb_4N3pxe5jMedBYA,7582
66
+ jaclang/core/construct.py,sha256=ZwgOO-P2OTv8d7mnxBkRg-AitrzYxsbFNqJZjRE9YqM,18649
67
+ jaclang/core/importer.py,sha256=JW_bxxEASklIBjezBiDaor95X6JLRUFspnN-zImtY8E,6100
68
+ jaclang/core/memory.py,sha256=QDOtAlxARQ_pg6NkmZ_QYKWhnIHzd2Mm1jzZUck7pRY,1415
67
69
  jaclang/core/registry.py,sha256=4uuXahPN4SMVEWwJ6Gjm5LM14rePMGoyjQtSbDQmQZs,4178
68
- jaclang/core/utils.py,sha256=Li35s4HuDreuNpsE1blv8RL0okK9wXFUqoF-XVgS6ro,7374
69
- jaclang/plugin/__init__.py,sha256=qLbQ2KjwyTvlV50Q7JTIznyIzuGDPjuwM_ZJjdk-avo,182
70
- jaclang/plugin/builtin.py,sha256=D1R4GGNHX96P-wZnGm9OI4dMeCJvuXuHkCw2Cl5vaAU,1201
71
- jaclang/plugin/default.py,sha256=o6sDfuahxK-MzLSXTJ5rfui1xXiK_g6s_6O54FpC7zs,23654
72
- jaclang/plugin/feature.py,sha256=mkU1YwlTTvTuZ4FpsLQZCUr3mQtlp5ICAuvEft2K5QA,8782
73
- jaclang/plugin/spec.py,sha256=AiJ-YJ1UiDNO7qjwdc9vK4aua2LYR7GprpVLze0O7to,7806
70
+ jaclang/core/shelve_storage.py,sha256=UsZRHM8KPGUlZTX_bfcxzabInNrTaQVNMatQifycMYg,1692
71
+ jaclang/core/utils.py,sha256=5e4DyjtSweFxKeIuEyeYGV2MsuTtfnncfIwRdoyFdys,7736
72
+ jaclang/core/llms/__init__.py,sha256=hxuxduH6ahhkXgJ9eUkhfn8LCS1KTz1ESuYgtspu_c0,371
73
+ jaclang/core/llms/anthropic.py,sha256=JmgKLUTk27Hg221rt4QBLRjonxE_qLkkSgZuLFZUrCg,1979
74
+ jaclang/core/llms/base.py,sha256=IOQWOP3zyPq05PVq7iYmh5wTd62m2W0husljvRtLYJo,6082
75
+ jaclang/core/llms/groq.py,sha256=jdcz8DMz4ResI2_0pfJB1rJ8Z8r9f0Av66D3ha0fCB4,2144
76
+ jaclang/core/llms/huggingface.py,sha256=8NqPScBFhodjONc4SbJ1OHyftQ1y9q_a7QevprDeArQ,2656
77
+ jaclang/core/llms/ollama.py,sha256=mlNf844qgiBizVRRBfQt-pM8sN6dX7ESqdo2SXu8aE0,2691
78
+ jaclang/core/llms/openai.py,sha256=uG4BIW8x9NhWMhy9taqb4esIa3POO_cezsZ7ZclLan8,1975
79
+ jaclang/core/llms/togetherai.py,sha256=MTPz7QasO2MjDn8hVCjOVU3SO6H6pF9Qoh7ZHmx46yw,2005
80
+ jaclang/core/llms/utils.py,sha256=mTpROnh4qS8fE26TkcotSt-mAqWoSeEeRBOu0SgoPmA,219
81
+ jaclang/plugin/__init__.py,sha256=5t2krHKt_44PrCTGojzxEimxpNHYVQcn89jAiCSXE_k,165
82
+ jaclang/plugin/builtin.py,sha256=PP2Vs4p_oDbGYEx0iBFDYH49I4uSRnNVWgx2aOzorVA,1187
83
+ jaclang/plugin/default.py,sha256=EegsveW7I41Pvkh261LVr3smC08rcbUXLBkrhLTh9mY,27142
84
+ jaclang/plugin/feature.py,sha256=Qi30JWJvt51s9nx3eJ0_BSTYIeTYLHe-e26y0IjJLz8,9444
85
+ jaclang/plugin/spec.py,sha256=mJRUMGaIhlHbZIvO2J-A1q3eNhnIWJ0iBCPmxhHiHx4,9043
74
86
  jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
75
87
  jaclang/plugin/tests/test_features.py,sha256=uNQ52HHc0GiOGg5xUZk-ddafdtud0IHN4H_EUAs4er4,3547
88
+ jaclang/plugin/tests/test_jaseci.py,sha256=XcVL-FOZMTsjJEZqCa-rcYyEPl1dxdFFu9vhvm8kUaI,7956
76
89
  jaclang/utils/__init__.py,sha256=86LQ_LDyWV-JFkYBpeVHpLaVxkqwFDP60XpWXOFZIQk,46
77
- jaclang/utils/helpers.py,sha256=RILfJ8Xm8XksHdsY1xQEQDvbw9Wk6jkE74vp6EvngKI,5746
90
+ jaclang/utils/helpers.py,sha256=6tfu2paCSSAUzJMZlMVl4ftbf9HOWN4TaJz7U-S0G1g,5831
78
91
  jaclang/utils/lang_tools.py,sha256=odv66Os8bJvw9JIUUkccGWvEPL98c-60veAiOiNyTy4,9956
79
92
  jaclang/utils/log.py,sha256=G8Y_DnETgTh9xzvlW5gh9zqJ1ap4YY_MDTwIMu5Uc0Y,262
80
93
  jaclang/utils/test.py,sha256=7-2Te0GQcKY3RJfNKa3cEJjG-RMC1r-0fHuOcFXrmE8,5383
81
- jaclang/utils/treeprinter.py,sha256=RV7mmnlUdla_dYxIrwxsV2F32ncgEnB9PdA3ZnKLxPE,10934
94
+ jaclang/utils/treeprinter.py,sha256=v9VSvo23fgyqwImpI07BbTMcIT9hIhP3qpKrUorQqMw,11414
82
95
  jaclang/utils/tests/__init__.py,sha256=8uwVqMsc6cxBAM1DuHLuNuTnzLXqOqM-WRa4ixOMF6w,23
83
96
  jaclang/utils/tests/test_lang_tools.py,sha256=YmV1AWieSoqcxWJYnxX1Lz3dZAR0rRvz6billsGJdHY,4144
84
97
  jaclang/vendor/__init__.py,sha256=pbflH5hBfDiKfTJEjIXId44Eof8CVmXQlZwFYDG6_4E,35
@@ -410,8 +423,8 @@ jaclang/vendor/pluggy/_manager.py,sha256=fcYU7VER0CplRym4jAJ7RCFYl6cfDSeVM589YHH
410
423
  jaclang/vendor/pluggy/_result.py,sha256=wXDoVy68bOaOrBzQ0bWFb3HTbpqhvdQMgYwaZvfzxfA,3239
411
424
  jaclang/vendor/pluggy/_tracing.py,sha256=kSBr25F_rNklV2QhLD6h1jx6Z1kcKDRbuYvF5jv35pU,2089
412
425
  jaclang/vendor/pluggy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
413
- jaclang-0.5.18.dist-info/METADATA,sha256=NTG7UE-l9XL9qa5ezDByBq7fSgiPYU9ffU6ZMLR5JEg,153
414
- jaclang-0.5.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
415
- jaclang-0.5.18.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
416
- jaclang-0.5.18.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
417
- jaclang-0.5.18.dist-info/RECORD,,
426
+ jaclang-0.6.1.dist-info/METADATA,sha256=S-qS3kFV3qS56zFcgi913MsaleTwimf3H-rfNgW-J6Y,546
427
+ jaclang-0.6.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
428
+ jaclang-0.6.1.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
429
+ jaclang-0.6.1.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
430
+ jaclang-0.6.1.dist-info/RECORD,,
jaclang/core/llms.py DELETED
@@ -1,111 +0,0 @@
1
- """LLMs (Large Language Models) module for Jaclang."""
2
-
3
-
4
- class Anthropic:
5
- """Anthropic API client for Large Language Models (LLMs)."""
6
-
7
- MTLLM_PROMPT: str = ""
8
- MTLLM_REASON_SUFFIX: str = ""
9
- MTLLM_WO_REASON_SUFFIX: str = ""
10
-
11
- def __init__(self, **kwargs: dict) -> None:
12
- """Initialize the Anthropic API client."""
13
- import anthropic
14
-
15
- self.client = anthropic.Anthropic()
16
- self.model_name = kwargs.get("model_name", "claude-3-sonnet-20240229")
17
- self.temperature = kwargs.get("temperature", 0.7)
18
- self.max_tokens = kwargs.get("max_tokens", 1024)
19
-
20
- def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
21
- """Infer a response from the input meaning."""
22
- messages = [{"role": "user", "content": meaning_in}]
23
- output = self.client.messages.create(
24
- model=kwargs.get("model_name", self.model_name),
25
- temperature=kwargs.get("temperature", self.temperature),
26
- max_tokens=kwargs.get("max_tokens", self.max_tokens),
27
- messages=messages,
28
- )
29
- return output.content[0].text
30
-
31
-
32
- class Huggingface:
33
- """Huggingface API client for Large Language Models (LLMs)."""
34
-
35
- MTLLM_PROMPT: str = ""
36
- MTLLM_REASON_SUFFIX: str = ""
37
- MTLLM_WO_REASON_SUFFIX: str = ""
38
-
39
- def __init__(self, **kwargs: dict) -> None:
40
- """Initialize the Huggingface API client."""
41
- import torch
42
- from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
43
-
44
- torch.random.manual_seed(0)
45
- model = AutoModelForCausalLM.from_pretrained(
46
- kwargs.get("model_name", "microsoft/Phi-3-mini-128k-instruct"),
47
- device_map=kwargs.get("device_map", "cuda"),
48
- torch_dtype="auto",
49
- trust_remote_code=True,
50
- )
51
- tokenizer = AutoTokenizer.from_pretrained(
52
- kwargs.get("model_name", "microsoft/Phi-3-mini-128k-instruct")
53
- )
54
- self.pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
55
- self.temperature = kwargs.get("temperature", 0.7)
56
- self.max_tokens = kwargs.get("max_new_tokens", 1024)
57
-
58
- def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
59
- """Infer a response from the input meaning."""
60
- messages = [{"role": "user", "content": meaning_in}]
61
- output = self.pipe(
62
- messages,
63
- temperature=kwargs.get("temperature", self.temperature),
64
- max_length=kwargs.get("max_new_tokens", self.max_tokens),
65
- **kwargs
66
- )
67
- return output[0]["generated_text"][-1]["content"]
68
-
69
-
70
- class Ollama:
71
- """Ollama API client for Large Language Models (LLMs)."""
72
-
73
- MTLLM_PROMPT: str = ""
74
- MTLLM_REASON_SUFFIX: str = ""
75
- MTLLM_WO_REASON_SUFFIX: str = ""
76
-
77
- def __init__(self, **kwargs: dict) -> None:
78
- """Initialize the Ollama API client."""
79
- import ollama
80
-
81
- self.client = ollama.Client(host=kwargs.get("host", "http://localhost:11434"))
82
- self.model_name = kwargs.get("model_name", "phi3")
83
- self.default_model_params = {
84
- k: v for k, v in kwargs.items() if k not in ["model_name", "host"]
85
- }
86
-
87
- def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
88
- """Infer a response from the input meaning."""
89
- model = str(kwargs.get("model_name", self.model_name))
90
- if not self.check_model(model):
91
- self.download_model(model)
92
- model_params = {k: v for k, v in kwargs.items() if k not in ["model_name"]}
93
- messages = [{"role": "user", "content": meaning_in}]
94
- output = self.client.chat(
95
- model=model,
96
- messages=messages,
97
- options={**self.default_model_params, **model_params},
98
- )
99
- return output["message"]["content"]
100
-
101
- def check_model(self, model_name: str) -> bool:
102
- """Check if the model is available."""
103
- try:
104
- self.client.show(model_name)
105
- return True
106
- except Exception:
107
- return False
108
-
109
- def download_model(self, model_name: str) -> None:
110
- """Download the model."""
111
- self.client.pull(model_name)
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: jaclang
3
- Version: 0.5.18
4
- Home-page: https://github.com/Jaseci-Labs/jaclang
5
- Author: Jason Mars
6
- Author-email: jason@jaseci.org
7
-