lionagi 0.9.16__py3-none-any.whl → 0.9.18__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.
@@ -14,6 +14,7 @@ MAPPING_PATH = "synthlang_/resources/mapping"
14
14
  class TokenMappingTemplate(str, Enum):
15
15
  RUST_CHINESE = "rust_chinese"
16
16
  LION_EMOJI = "lion_emoji"
17
+ PYTHON_MATH = "python_math"
17
18
 
18
19
  @property
19
20
  def fp(self) -> Path:
@@ -5,16 +5,11 @@ category = "utility"
5
5
  [metadata]
6
6
  title = "LionAGI-Emoji Symbolic Encoding Mapping"
7
7
  domain = "Symbolic Compression"
8
- version = "1.0"
8
+ version = "1.1"
9
9
  overview = "This resource provides a mapping of lionagi emoji symbolic encoding for compressing lionagi python codebase. When using, should keep the semantic structure of original python codes, do not translate into emoji nor any natural language."
10
10
  lion_class = "lionagi.libs.token_transform.base.TokenMapping"
11
11
 
12
12
  [content]
13
- "..." = "⋯"
14
- --- = "⧦"
15
- "⧦⧦⧦" = "⧦"
16
- " " = "空"
17
- "###" = "井"
18
13
  lionagi = "🦁"
19
14
  LionAGI = "🦁"
20
15
  Branch = "β"
@@ -35,21 +30,32 @@ pile = "📚"
35
30
  progression = "䷢"
36
31
  Progression = "䷢"
37
32
  IDType = "🆔"
38
- "await " = "🕰️"
39
- "async " = "⋕"
40
- True = "✅"
41
- False = "❌"
42
33
  None = "🅾️"
34
+ "def " = "𝓓"
35
+ "async def " = "𝓐"
36
+ "class " = "𝑭"
37
+ Self = "𝖎"
38
+ kwargs = "𝓚"
39
+ "while " = "∲"
40
+ "for " = "𝓃"
41
+ "return " = "⇉"
42
+ "if " = "¿"
43
+ "with " = "ѿ"
44
+ "is not " = "≢"
45
+ "or " = "⨈"
46
+ "and " = "⨇"
47
+ "await " = "🕰️"
48
+ True = "⊨"
49
+ False = "⊭"
50
+ "in " = "∈"
43
51
  "->" = "→"
44
- "<=" = "≤"
45
- ">=" = "≥"
46
52
  "!=" = "≠"
47
- "=>" = ""
48
- "def " = ""
53
+ ">=" = ""
54
+ "<=" = ""
49
55
  "==" = "⩵"
50
- from = ""
51
- if = "¿"
52
- return = ""
53
- function = "ƒ"
54
- "```synthlang\n```synthlang\n```synthlang" = "```synthlang"
55
- "```synthlang\n```synthlang" = "```synthlang"
56
+ "..." = ""
57
+ --- = ""
58
+ "⧦⧦⧦" = ""
59
+ " " = "◻︎"
60
+ "◻︎◻︎" = "◼︎"
61
+ "###" = "#"
@@ -0,0 +1,39 @@
1
+ id = "cf8f1629-feab-456b-831a-4841a4ac95e6"
2
+ created_at = 1741016657.655462
3
+ category = "utility"
4
+
5
+ [metadata]
6
+ title = "Python Math Symbolic Encoding Mapping"
7
+ domain = "Symbolic Compression"
8
+ version = "1.1"
9
+ overview = "This resource provides a mapping of Python greek_math symbolic encoding for compressing python codebase. When using, should keep the semantic structure of original python codes, do not translate into any natural language."
10
+ lion_class = "lionagi.libs.token_transform.base.TokenMapping"
11
+
12
+ [content]
13
+ "def " = "𝓓"
14
+ "async def " = "𝓐"
15
+ "class " = "𝑭"
16
+ Self = "𝖎"
17
+ kwargs = "𝓚"
18
+ "while " = "∲"
19
+ "for " = "𝓃"
20
+ "return " = "⇉"
21
+ "if " = "¿"
22
+ "with " = "ѿ"
23
+ "is not " = "≢"
24
+ "or " = "⨈"
25
+ "and " = "⨇"
26
+ True = "⊨"
27
+ False = "⊭"
28
+ "in " = "∈"
29
+ "->" = "→"
30
+ "!=" = "≠"
31
+ ">=" = "≥"
32
+ "<=" = "≤"
33
+ "==" = "⩵"
34
+ "..." = "⋯"
35
+ --- = "⧦"
36
+ "⧦⧦⧦" = "⧦"
37
+ " " = "◻︎"
38
+ "◻︎◻︎" = "◼︎"
39
+ "###" = "#"
@@ -129,6 +129,49 @@ async def brainstorm(
129
129
  branch_as_default: bool = True,
130
130
  operative_model: type[BaseModel] | None = None,
131
131
  **kwargs: Any,
132
+ ):
133
+ out = []
134
+ async for res in brainstormStream(
135
+ instruct=instruct,
136
+ num_instruct=num_instruct,
137
+ session=session,
138
+ branch=branch,
139
+ auto_run=auto_run,
140
+ auto_explore=auto_explore,
141
+ explore_kwargs=explore_kwargs,
142
+ explore_strategy=explore_strategy,
143
+ branch_kwargs=branch_kwargs,
144
+ return_session=return_session,
145
+ verbose=verbose,
146
+ branch_as_default=branch_as_default,
147
+ operative_model=operative_model,
148
+ **kwargs,
149
+ ):
150
+ out.append(res)
151
+
152
+ return out[-1]
153
+
154
+
155
+ async def brainstormStream(
156
+ instruct: Instruct | dict[str, Any],
157
+ num_instruct: int = 2,
158
+ session: Session | None = None,
159
+ branch: Branch | ID.Ref | None = None,
160
+ auto_run: bool = True,
161
+ auto_explore: bool = False,
162
+ explore_kwargs: dict[str, Any] | None = None,
163
+ explore_strategy: Literal[
164
+ "concurrent",
165
+ "sequential",
166
+ "sequential_concurrent_chunk",
167
+ "concurrent_sequential_chunk",
168
+ ] = "concurrent",
169
+ branch_kwargs: dict[str, Any] | None = None,
170
+ return_session: bool = False,
171
+ verbose: bool = False,
172
+ branch_as_default: bool = True,
173
+ operative_model: type[BaseModel] | None = None,
174
+ **kwargs: Any,
132
175
  ) -> Any:
133
176
  """
134
177
  High-level function to perform a brainstorming session.
@@ -171,6 +214,8 @@ async def brainstorm(
171
214
  # 1. Initial Brainstorm
172
215
  # -----------------------------------------------------------------
173
216
  res1 = await branch.operate(**instruct, **kwargs)
217
+ yield res1
218
+
174
219
  out = BrainstormOperation(initial=res1)
175
220
 
176
221
  if verbose:
@@ -195,8 +240,10 @@ async def brainstorm(
195
240
  # -----------------------------------------------------------------
196
241
  if not auto_run:
197
242
  if return_session:
198
- return out, session
199
- return out
243
+ yield out, session
244
+ yield out
245
+
246
+ return
200
247
 
201
248
  # We run inside the context manager for branching
202
249
  async with session.branches:
@@ -227,6 +274,7 @@ async def brainstorm(
227
274
  # Insert the initial result at index 0 for reference
228
275
  filtered.insert(0, res1)
229
276
  response_ = filtered
277
+ yield response_
230
278
 
231
279
  # -----------------------------------------------------------------
232
280
  # 3. Explore the results (if auto_explore = True)
@@ -281,6 +329,7 @@ async def brainstorm(
281
329
  i.model_dump_json() for i in res_explore
282
330
  )
283
331
  )
332
+ yield res_explore
284
333
 
285
334
  # ---------------------------------------------------------
286
335
  # Strategy B: SEQUENTIAL
@@ -310,9 +359,11 @@ async def brainstorm(
310
359
  seq_res = await branch.instruct(
311
360
  i, **(explore_kwargs or {})
312
361
  )
313
- explore_results.append(
314
- InstructResponse(instruct=i, response=seq_res)
362
+ ins_res = InstructResponse(
363
+ instruct=i, response=seq_res
315
364
  )
365
+ explore_results.append(ins_res)
366
+ yield ins_res
316
367
 
317
368
  out.explore = explore_results
318
369
 
@@ -367,6 +418,7 @@ async def brainstorm(
367
418
  chunk, branch
368
419
  )
369
420
  all_responses.extend(chunk_result)
421
+ yield chunk_result
370
422
 
371
423
  out.explore = all_responses
372
424
 
@@ -431,6 +483,7 @@ async def brainstorm(
431
483
  i.model_dump_json() for i in all_responses
432
484
  )
433
485
  )
486
+ yield all_responses
434
487
 
435
488
  if branch_as_default:
436
489
  session.change_default_branch(branch)
@@ -439,5 +492,5 @@ async def brainstorm(
439
492
  # 4. Return Results
440
493
  # -----------------------------------------------------------------
441
494
  if return_session:
442
- return out, session
443
- return out
495
+ yield out, session
496
+ yield out
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.9.16"
1
+ __version__ = "0.9.18"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.9.16
3
+ Version: 0.9.18
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -4,7 +4,7 @@ lionagi/_errors.py,sha256=JlBTFJnRWtVYcRxKb7fWFiJHLbykl1E19mSJ8sXYVxg,455
4
4
  lionagi/_types.py,sha256=9g7iytvSj3UjZxD-jL06_fxuNfgZyWT3Qnp0XYp1wQU,63
5
5
  lionagi/settings.py,sha256=W52mM34E6jXF3GyqCFzVREKZrmnUqtZm_BVDsUiDI_s,1627
6
6
  lionagi/utils.py,sha256=K36D9AAGiMPR4eM9tYoiVgvH-NdPPSeMQPls09s7keQ,73223
7
- lionagi/version.py,sha256=acB0gualD_f0pAsWdbLFyA6FBMb_Gmat0K0kEn9R9AA,23
7
+ lionagi/version.py,sha256=haz_juir_la6004a7gfcu3E7WIh6CJDeJMm8bngcWUY,23
8
8
  lionagi/libs/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
9
9
  lionagi/libs/parse.py,sha256=JRS3bql0InHJqATnAatl-hQv4N--XXw4P77JHhTFnrc,1011
10
10
  lionagi/libs/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
@@ -36,7 +36,7 @@ lionagi/libs/schema/extract_docstring.py,sha256=aYyLSRlB8lTH9QF9-6a56uph3AAkNuTy
36
36
  lionagi/libs/schema/function_to_schema.py,sha256=Ak21_0xCFP71qgb6_wNzaRSVsdkf1ieRjJ92hXo7qPE,5628
37
37
  lionagi/libs/schema/json_schema.py,sha256=cuHcaMr748O9g6suNGmRx4tRXcidd5-c7AMGjTIZyHM,7670
38
38
  lionagi/libs/token_transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- lionagi/libs/token_transform/base.py,sha256=OiF2peDm39BNLJLq9uNREcM0-YfnP21B9y7BO9tKMFs,1513
39
+ lionagi/libs/token_transform/base.py,sha256=LBnaDgi4HNgaJJGwIzWcQjVMdu49i_93rRvOvMU22Rw,1545
40
40
  lionagi/libs/token_transform/llmlingua.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
41
41
  lionagi/libs/token_transform/perplexity.py,sha256=tcVRjPBX3nuVqsoTkowCf6RBXuybO--owH1lf2Ywj1s,14470
42
42
  lionagi/libs/token_transform/symbolic_compress_context.py,sha256=Nr4vSJSN6sUQgaA1QxHhidWH3pUG_5RnoYeLHjMsoLA,4603
@@ -53,7 +53,8 @@ lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml,sha
53
53
  lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml,sha256=LxBIVLHNLfvVdXjLAzqivrYaHNix514DLNYsbA-VSQ4,5730
54
54
  lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml,sha256=SZpBvUySZ3_0pIrRko24a3KfbPHd55LyNwzFHyznjs4,1457
55
55
  lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml,sha256=nnhfbIJQ5pTGlX7lo1XzjyOevaZOHuusvBuhwWHzbLk,1008
56
- lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml,sha256=HQFdI7WJ6Jwl9Y4O6Bz862UtzKIzDuYkhydC7Vt_2fw,1276
56
+ lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml,sha256=CPbqoh691wfZ3Xe49iLEWGJoaIbRUyDgn2_bFlvH72E,1322
57
+ lionagi/libs/token_transform/synthlang_/resources/mapping/python_math_mapping.toml,sha256=aXHxSMltWqCIeYAL3DouRNuwrJhsxeMUBik3psRMFPk,929
57
58
  lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml,sha256=IU5qOB-a_ZJI_wMOa0OJu3foAp6tIdvegnVt-yw5URM,1216
58
59
  lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml,sha256=8xhY14WdDRF6GIToqzRPM7EjM6-uO6-hQ9Muei1A2Iw,3458
59
60
  lionagi/libs/validate/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
@@ -72,7 +73,7 @@ lionagi/operations/ReAct/utils.py,sha256=84Giel5ToqfbN5F6Tm0uw8yZTTnxiM_jWuFEhnK
72
73
  lionagi/operations/_act/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
73
74
  lionagi/operations/_act/act.py,sha256=CunHTTZcS6xNUe0xKSDgtMJ7-ucSvHeW4BtmVjXnaxk,2958
74
75
  lionagi/operations/brainstorm/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
75
- lionagi/operations/brainstorm/brainstorm.py,sha256=_rkU5U-tNpOB3iyeP5gu0hLVIH2FKMCwCU8n2lsg_Do,17214
76
+ lionagi/operations/brainstorm/brainstorm.py,sha256=mwqXXbViFkzqI5cO7RDQEWMtS_Dvbqcua2rqlQLW7Hw,18714
76
77
  lionagi/operations/brainstorm/prompt.py,sha256=Dqi4NNeztdI4iutggRqjnOrG4a4E2JtwIAtRnjZ_ghQ,610
77
78
  lionagi/operations/chat/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
78
79
  lionagi/operations/chat/chat.py,sha256=xJAH2H0zyVvxiL3XtW3MC6YrwCCB1uCkwcQIJ1YsIOk,5466
@@ -233,7 +234,7 @@ lionagi/tools/file/writer.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,
233
234
  lionagi/tools/file/providers/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
234
235
  lionagi/tools/file/providers/docling_.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
235
236
  lionagi/tools/query/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
236
- lionagi-0.9.16.dist-info/METADATA,sha256=p6bDdHJ5ayzHFHGd3X2Sr2Em_nI4eE6TLNg1WBwqI_M,18464
237
- lionagi-0.9.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
238
- lionagi-0.9.16.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
239
- lionagi-0.9.16.dist-info/RECORD,,
237
+ lionagi-0.9.18.dist-info/METADATA,sha256=DF3Sqj5Qu09qtsaK88Bm6FiCXkR-dJkV24nS4AGNZak,18464
238
+ lionagi-0.9.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
239
+ lionagi-0.9.18.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
240
+ lionagi-0.9.18.dist-info/RECORD,,