lionagi 0.9.15__py3-none-any.whl → 0.9.17__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.
@@ -13,6 +13,7 @@ MAPPING_PATH = "synthlang_/resources/mapping"
13
13
 
14
14
  class TokenMappingTemplate(str, Enum):
15
15
  RUST_CHINESE = "rust_chinese"
16
+ LION_EMOJI = "lion_emoji"
16
17
 
17
18
  @property
18
19
  def fp(self) -> Path:
@@ -11,6 +11,9 @@ from .synthlang_.base import SynthlangFramework, SynthlangTemplate
11
11
 
12
12
  FRAMEWORK_OPTIONS = SynthlangFramework.load_framework_options()
13
13
  FRAMEWORK_CHOICES = Literal["math", "optim", "custom_algebra"]
14
+ DEFAULT_INVOKATION_PROMPT = (
15
+ "The light-speed brown fox jumps over the lazy dog with great agility."
16
+ )
14
17
 
15
18
 
16
19
  async def symbolic_compress_context(
@@ -127,7 +130,7 @@ async def symbolic_compress_context(
127
130
  _inner,
128
131
  max_concurrent=max_concurrent,
129
132
  retry_default=None,
130
- num_retries=2,
133
+ num_retries=3,
131
134
  throttle_period=throttle_period,
132
135
  retry_delay=1,
133
136
  backoff_factor=2,
@@ -136,6 +139,7 @@ async def symbolic_compress_context(
136
139
  unique_output=True,
137
140
  )
138
141
  text = "\n".join(results)
142
+ text = DEFAULT_INVOKATION_PROMPT + text
139
143
 
140
144
  if output_path:
141
145
  fp = Path(output_path)
@@ -0,0 +1,55 @@
1
+ id = "8d3c0f4a-5bbb-4426-99fb-1a37c6a72b38"
2
+ created_at = 1740946382.550635
3
+ category = "utility"
4
+
5
+ [metadata]
6
+ title = "LionAGI-Emoji Symbolic Encoding Mapping"
7
+ domain = "Symbolic Compression"
8
+ version = "1.0"
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
+ lion_class = "lionagi.libs.token_transform.base.TokenMapping"
11
+
12
+ [content]
13
+ "..." = "⋯"
14
+ --- = "⧦"
15
+ "⧦⧦⧦" = "⧦"
16
+ " " = "空"
17
+ "###" = "井"
18
+ lionagi = "🦁"
19
+ LionAGI = "🦁"
20
+ Branch = "β"
21
+ branch = "β"
22
+ iModel = "🧠"
23
+ imodel = "🧠"
24
+ operatives = "Ṓ"
25
+ operative = "Ṓ"
26
+ operations = "⨔"
27
+ operation = "⨔"
28
+ protocols = "🔏"
29
+ manager = "👑"
30
+ Manager = "👑"
31
+ Element = "🧱"
32
+ element = "🧱"
33
+ Pile = "📚"
34
+ pile = "📚"
35
+ progression = "䷢"
36
+ Progression = "䷢"
37
+ IDType = "🆔"
38
+ "await " = "🕰️"
39
+ "async " = "⋕"
40
+ True = "✅"
41
+ False = "❌"
42
+ None = "🅾️"
43
+ "->" = "→"
44
+ "<=" = "≤"
45
+ ">=" = "≥"
46
+ "!=" = "≠"
47
+ "=>" = "⇒"
48
+ "def " = "∂"
49
+ "==" = "⩵"
50
+ from = "从"
51
+ if = "¿"
52
+ return = "⟲"
53
+ function = "ƒ"
54
+ "```synthlang\n```synthlang\n```synthlang" = "```synthlang"
55
+ "```synthlang\n```synthlang" = "```synthlang"
@@ -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.15"
1
+ __version__ = "0.9.17"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.9.15
3
+ Version: 0.9.17
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=PPxUSD_g1KMh3wdAtX6CMb4gLw5y0_nXjKdNFQVNkvc,23
7
+ lionagi/version.py,sha256=XwPQTH78g0lcbaME-GxlYwHf1_OQPmK9ZRuevk-I_Yw,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,10 +36,10 @@ 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=1rLtfKK9pG8jEykcPG7a3o58lMTXOazgWn9Ff6BX3Wo,1483
39
+ lionagi/libs/token_transform/base.py,sha256=OiF2peDm39BNLJLq9uNREcM0-YfnP21B9y7BO9tKMFs,1513
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
- lionagi/libs/token_transform/symbolic_compress_context.py,sha256=YLrdxesFfsbuGucBjvr9XM4u5f0KQ62I_SK_XSmLB1I,4451
42
+ lionagi/libs/token_transform/symbolic_compress_context.py,sha256=Nr4vSJSN6sUQgaA1QxHhidWH3pUG_5RnoYeLHjMsoLA,4603
43
43
  lionagi/libs/token_transform/synthlang.py,sha256=W6e-_265UXqVosM9X0TLKW53rNHvWCKhsWbVAop49Ac,259
44
44
  lionagi/libs/token_transform/types.py,sha256=4HgAfNDlJ_Hu18kLt59GHr_76eF3xLpNCTbOXlAYVlA,491
45
45
  lionagi/libs/token_transform/synthlang_/base.py,sha256=diDFrm-1Zf3PerKjODo-uFQMEjxPeaGtbZ5N1lK59Kg,4114
@@ -53,6 +53,7 @@ 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
57
  lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml,sha256=IU5qOB-a_ZJI_wMOa0OJu3foAp6tIdvegnVt-yw5URM,1216
57
58
  lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml,sha256=8xhY14WdDRF6GIToqzRPM7EjM6-uO6-hQ9Muei1A2Iw,3458
58
59
  lionagi/libs/validate/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
@@ -71,7 +72,7 @@ lionagi/operations/ReAct/utils.py,sha256=84Giel5ToqfbN5F6Tm0uw8yZTTnxiM_jWuFEhnK
71
72
  lionagi/operations/_act/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
72
73
  lionagi/operations/_act/act.py,sha256=CunHTTZcS6xNUe0xKSDgtMJ7-ucSvHeW4BtmVjXnaxk,2958
73
74
  lionagi/operations/brainstorm/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
74
- lionagi/operations/brainstorm/brainstorm.py,sha256=_rkU5U-tNpOB3iyeP5gu0hLVIH2FKMCwCU8n2lsg_Do,17214
75
+ lionagi/operations/brainstorm/brainstorm.py,sha256=mwqXXbViFkzqI5cO7RDQEWMtS_Dvbqcua2rqlQLW7Hw,18714
75
76
  lionagi/operations/brainstorm/prompt.py,sha256=Dqi4NNeztdI4iutggRqjnOrG4a4E2JtwIAtRnjZ_ghQ,610
76
77
  lionagi/operations/chat/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
77
78
  lionagi/operations/chat/chat.py,sha256=xJAH2H0zyVvxiL3XtW3MC6YrwCCB1uCkwcQIJ1YsIOk,5466
@@ -232,7 +233,7 @@ lionagi/tools/file/writer.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,
232
233
  lionagi/tools/file/providers/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
233
234
  lionagi/tools/file/providers/docling_.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
234
235
  lionagi/tools/query/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
235
- lionagi-0.9.15.dist-info/METADATA,sha256=pmtvUHZCxF3WoXCoIpW_LF4cj4BeaBhY0GtBtPMYWG0,18464
236
- lionagi-0.9.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
237
- lionagi-0.9.15.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
238
- lionagi-0.9.15.dist-info/RECORD,,
236
+ lionagi-0.9.17.dist-info/METADATA,sha256=szJDMZDdO86xE67qwsXyV6pd-ZQkTUoagO3h6pg98KQ,18464
237
+ lionagi-0.9.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
238
+ lionagi-0.9.17.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
239
+ lionagi-0.9.17.dist-info/RECORD,,