lionagi 0.7.3__py3-none-any.whl → 0.7.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
lionagi/__init__.py CHANGED
@@ -2,12 +2,12 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- from lionagi.operations import types as op
6
- from lionagi.operatives import types as ops_types
7
- from lionagi.protocols import types as types
8
- from lionagi.service.imodel import iModel
9
- from lionagi.session.session import Branch, Session
10
- from lionagi.version import __version__
5
+ from . import _types as types
6
+ from .operations import types as op
7
+ from .operatives import types as ops_types # deprecated
8
+ from .service.imodel import iModel
9
+ from .session.session import Branch, Session
10
+ from .version import __version__
11
11
 
12
12
  LiteiModel = iModel
13
13
 
lionagi/_types.py ADDED
@@ -0,0 +1,2 @@
1
+ from .operatives.types import *
2
+ from .protocols.types import *
@@ -112,7 +112,7 @@ async def ReAct(
112
112
  if extensions:
113
113
  extensions -= 1
114
114
 
115
- # Step 3: Produce final answer by calling branch._instruct with an answer prompt
115
+ # Step 3: Produce final answer by calling branch.instruct with an answer prompt
116
116
  answer_prompt = ReActAnalysis.ANSWER_PROMPT.format(
117
117
  instruction=instruct_dict["instruction"]
118
118
  )
@@ -75,7 +75,7 @@ async def run_instruct(
75
75
  if verbose:
76
76
  snippet = (
77
77
  child_ins.guidance[:100] + "..."
78
- if len(child_ins.guidance) > 100
78
+ if len(child_ins.guidance or "") > 100
79
79
  else child_ins.guidance
80
80
  )
81
81
  print(f"\n-----Running instruction-----\n{snippet}")
@@ -181,7 +181,7 @@ async def brainstorm(
181
181
  if verbose:
182
182
  snippet = (
183
183
  ins_.guidance[:100] + "..."
184
- if len(ins_.guidance) > 100
184
+ if len(ins_.guidance or "") > 100
185
185
  else ins_.guidance
186
186
  )
187
187
  print(f"\n-----Running instruction-----\n{snippet}")
@@ -255,12 +255,12 @@ async def brainstorm(
255
255
  if verbose:
256
256
  snippet = (
257
257
  ins_.guidance[:100] + "..."
258
- if len(ins_.guidance) > 100
258
+ if len(ins_.guidance or "") > 100
259
259
  else ins_.guidance
260
260
  )
261
261
  print(f"\n-----Exploring Idea-----\n{snippet}")
262
262
  new_branch = session.split(branch)
263
- resp = await new_branch._instruct(
263
+ resp = await new_branch.instruct(
264
264
  ins_, **(explore_kwargs or {})
265
265
  )
266
266
  return InstructResponse(instruct=ins_, response=resp)
@@ -303,11 +303,11 @@ async def brainstorm(
303
303
  if verbose:
304
304
  snippet = (
305
305
  i.guidance[:100] + "..."
306
- if len(i.guidance) > 100
306
+ if len(i.guidance or "") > 100
307
307
  else i.guidance
308
308
  )
309
309
  print(f"\n-----Exploring Idea-----\n{snippet}")
310
- seq_res = await branch._instruct(
310
+ seq_res = await branch.instruct(
311
311
  i, **(explore_kwargs or {})
312
312
  )
313
313
  explore_results.append(
@@ -337,7 +337,7 @@ async def brainstorm(
337
337
 
338
338
  async def _explore(ins_: Instruct):
339
339
  child_branch = session.split(base_branch)
340
- child_resp = await child_branch._instruct(
340
+ child_resp = await child_branch.instruct(
341
341
  ins_, **(explore_kwargs or {})
342
342
  )
343
343
  return InstructResponse(
@@ -393,14 +393,14 @@ async def brainstorm(
393
393
  if verbose:
394
394
  snippet = (
395
395
  ins_.guidance[:100] + "..."
396
- if len(ins_.guidance) > 100
396
+ if len(ins_.guidance or "") > 100
397
397
  else ins_.guidance
398
398
  )
399
399
  print(
400
400
  f"\n-----Exploring Idea (sequential in chunk)-----\n{snippet}"
401
401
  )
402
402
 
403
- seq_resp = await local_branch._instruct(
403
+ seq_resp = await local_branch.instruct(
404
404
  ins_, **(explore_kwargs or {})
405
405
  )
406
406
  chunk_results.append(
@@ -249,7 +249,7 @@ async def plan(
249
249
  )
250
250
  print(f"Instruction: {snippet}")
251
251
 
252
- step_response = await execute_branch._instruct(
252
+ step_response = await execute_branch.instruct(
253
253
  plan_step, **(execution_kwargs or {})
254
254
  )
255
255
  seq_results.append(
@@ -277,7 +277,7 @@ async def plan(
277
277
  print(f"\n------ Executing step (concurrently) ------")
278
278
  print(f"Instruction: {snippet}")
279
279
  local_branch = session.split(execute_branch)
280
- resp = await local_branch._instruct(
280
+ resp = await local_branch.instruct(
281
281
  plan_step, **(execution_kwargs or {})
282
282
  )
283
283
  return InstructResponse(instruct=plan_step, response=resp)
@@ -309,7 +309,7 @@ async def plan(
309
309
 
310
310
  async def _execute(plan_step: Instruct):
311
311
  local_branch = session.split(execute_branch)
312
- resp = await local_branch._instruct(
312
+ resp = await local_branch.instruct(
313
313
  plan_step, **(execution_kwargs or {})
314
314
  )
315
315
  return InstructResponse(
@@ -355,7 +355,7 @@ async def plan(
355
355
  print(
356
356
  f"\n--- Executing step (sequential in chunk) ---\nInstruction: {snippet}"
357
357
  )
358
- resp = await local_branch._instruct(
358
+ resp = await local_branch.instruct(
359
359
  plan_step, **(execution_kwargs or {})
360
360
  )
361
361
  chunk_result.append(
@@ -25,7 +25,7 @@ class ConcurrentExecutor(StrategyExecutor):
25
25
  return await self.execute_instruct(ins_, b_, False, **kwargs)
26
26
 
27
27
  config = {**ins.model_dump(), **kwargs}
28
- res = await branch._instruct(**config)
28
+ res = await branch.instruct(**config)
29
29
  branch.msgs.logger.dump()
30
30
  instructs = (
31
31
  res.instruct_models if hasattr(res, "instruct_models") else []
@@ -68,7 +68,7 @@ class ConcurrentSequentialChunkExecutor(StrategyExecutor):
68
68
  else f"\n-----Executing Instruct {idx}-----\n{msg_}"
69
69
  )
70
70
 
71
- res = await self.branch._instruct(ins_, **self.params.execute_kwargs)
71
+ res = await self.branch.instruct(ins_, **self.params.execute_kwargs)
72
72
  return InstructResponse(instruct=ins_, response=res)
73
73
 
74
74
  async def _execute_chunk(
@@ -20,7 +20,7 @@ class SequentialExecutor(StrategyExecutor):
20
20
  for idx, item in enumerate(instructs, start=1):
21
21
  if self.params.verbose:
22
22
  print(f"\nExecuting step {idx}/{len(instructs)}")
23
- out = await self.execute_branch._instruct(
23
+ out = await self.execute_branch.instruct(
24
24
  item, **self.params.execute_kwargs
25
25
  )
26
26
  ress.append(InstructResponse(instruct=item, response=out))
@@ -60,7 +60,7 @@ class SequentialChunkExecutor(StrategyExecutor):
60
60
  else:
61
61
  print(f"\n-----Executing Instruct-----\n{msg_}")
62
62
 
63
- res = await self.branch._instruct(ins_, **self.params.execute_kwargs)
63
+ res = await self.branch.instruct(ins_, **self.params.execute_kwargs)
64
64
  return InstructResponse(instruct=ins_, response=res)
65
65
 
66
66
  async def _execute_chunk(
@@ -71,7 +71,7 @@ class SequentialConcurrentChunkExecutor(StrategyExecutor):
71
71
  )
72
72
 
73
73
  branch = self.session.split(self.branch)
74
- res = await branch._instruct(ins_, **self.params.execute_kwargs)
74
+ res = await branch.instruct(ins_, **self.params.execute_kwargs)
75
75
  return InstructResponse(instruct=ins_, response=res)
76
76
 
77
77
  async def _execute_chunk(
lionagi/session/branch.py CHANGED
@@ -611,6 +611,24 @@ class Branch(Element, Communicatable, Relational):
611
611
  # Remove placeholders (UNDEFINED) so we don't incorrectly assign them
612
612
  return cls(**{k: v for k, v in params.items() if v is not UNDEFINED})
613
613
 
614
+ def dump_logs(self, clear: bool = True, persist_path=None):
615
+ """
616
+ Dumps the log to a file or clears it.
617
+
618
+ Args:
619
+ clear (bool, optional):
620
+ If `True`, clears the log after dumping.
621
+ persist_path (str, optional):
622
+ The file path to save the log to.
623
+ """
624
+ self._log_manager.dump(clear=clear, persist_path=persist_path)
625
+
626
+ async def adump_logs(self, clear: bool = True, persist_path=None):
627
+ """
628
+ Asynchronously dumps the log to a file or clears it.
629
+ """
630
+ await self._log_manager.adump(clear=clear, persist_path=persist_path)
631
+
614
632
  # -------------------------------------------------------------------------
615
633
  # Asynchronous Operations (chat, parse, operate, etc.)
616
634
  # -------------------------------------------------------------------------
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.7.3"
1
+ __version__ = "0.7.5"
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.7.3
4
- Summary: An AGentic Intelligence Operating System.
3
+ Version: 0.7.5
4
+ Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
7
7
  Version 2.0, January 2004
@@ -1,9 +1,10 @@
1
- lionagi/__init__.py,sha256=sBS47lQGuXNAdfSoVLW8szKbCfDWrfAceMMUVYNK3IU,541
1
+ lionagi/__init__.py,sha256=Z_cWmXAAYFrUDQsB9xJR8SqCrc7fKShllJFQd1N11BI,505
2
2
  lionagi/_class_registry.py,sha256=dutMsw-FQNqVV5gGH-NEIv90uBkSr8fERJ_x3swbb-s,3112
3
3
  lionagi/_errors.py,sha256=wNKdnVQvE_CHEstK7htrrj334RA_vbGcIds-3pUiRkc,455
4
+ lionagi/_types.py,sha256=9g7iytvSj3UjZxD-jL06_fxuNfgZyWT3Qnp0XYp1wQU,63
4
5
  lionagi/settings.py,sha256=k9zRJXv57TveyfHO3Vr9VGiKrSwlRUUVKt5zf6v9RU4,1627
5
6
  lionagi/utils.py,sha256=X12H-O8Lx9tUOKGtjpoxHjRsKYHRqty0qD9i2W12kpI,73121
6
- lionagi/version.py,sha256=G0rwkDLSytonr7idr8ma7KaTUnRCn3-Ripum70RSeh0,22
7
+ lionagi/version.py,sha256=6qL_qyowXO9Pc6v11Zx2s-yd28_548ZZC-OsfzO_Pjc,22
7
8
  lionagi/libs/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
8
9
  lionagi/libs/parse.py,sha256=tpEbmIRGuHhLCJlUlm6fjmqm_Z6XJLAXGNFHNuk422I,1011
9
10
  lionagi/libs/file/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
@@ -46,13 +47,13 @@ lionagi/libs/validate/validate_boolean.py,sha256=h3d7Dn7asJokBozWaKxaV_3Y6vUWBc0
46
47
  lionagi/operations/__init__.py,sha256=O7nV0tedpUe7_OlUWmCcduGPFtqtzWZcR_SIOnjLsro,134
47
48
  lionagi/operations/types.py,sha256=LIa68xcyKLVafof-DSFwKtSkneuYPFqrtGyClohYI6o,704
48
49
  lionagi/operations/utils.py,sha256=Twy6L_UFt9JqJFRYuKKTKVZIXsePidNl5ipcYcCbesI,1220
49
- lionagi/operations/ReAct/ReAct.py,sha256=ICQROuVqYhUMUyzXao7oTewp8YZsdk-jI9Bn5eJpWpA,3955
50
+ lionagi/operations/ReAct/ReAct.py,sha256=tAZ-3Ya68tVUa112wgOMUJpBVw-RWBSYTfgicbInRuQ,3954
50
51
  lionagi/operations/ReAct/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
51
52
  lionagi/operations/ReAct/utils.py,sha256=0OhZhoc8QsTsMFo2Jmys1mgpnMwHsldKuLVSbev9uZM,994
52
53
  lionagi/operations/_act/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
53
54
  lionagi/operations/_act/act.py,sha256=HBp-sNwNigLDNkuEZqGU_98UCaJXPZsaokkFAXwOMn0,2454
54
55
  lionagi/operations/brainstorm/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
55
- lionagi/operations/brainstorm/brainstorm.py,sha256=88Cq2IBrUs5du9q_8rf_VmhLYBfGKJv4rCeDTcJ07_g,17196
56
+ lionagi/operations/brainstorm/brainstorm.py,sha256=OwByrh6E-rTU_u6fDNTwWOlkJ4ycYJB9ZF-x-HYOs8I,17222
56
57
  lionagi/operations/brainstorm/prompt.py,sha256=f-Eh6pO606dT2TrX9BFv_einRDpYwFi6Gep9Strd1cM,610
57
58
  lionagi/operations/chat/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
58
59
  lionagi/operations/chat/chat.py,sha256=Ji3covyt64EFoBFbvPhxAGl8bGMwRQqmHtb7tY9jP54,5229
@@ -67,7 +68,7 @@ lionagi/operations/operate/operate.py,sha256=jgVV9CjtnVLmR5ZdDmunicS5Pp9dT3hV5kM
67
68
  lionagi/operations/parse/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
68
69
  lionagi/operations/parse/parse.py,sha256=LpF6LVAvCVoE8n63BkhSxXSHYgSx7CNkN7yXUwaNpQo,3003
69
70
  lionagi/operations/plan/__init__.py,sha256=AFkAmOJBTqPlYuqFRRn7rCvIw3CGh9XXH_22cNWbfig,156
70
- lionagi/operations/plan/plan.py,sha256=wcvQFFh9bF1pa754OpILrCPnMuMOO6suPrhrgRiZHXM,15317
71
+ lionagi/operations/plan/plan.py,sha256=vo995UHEHLCBM9t0xr_9yO8TDaOFcRscbemcK18UaO4,15313
71
72
  lionagi/operations/plan/prompt.py,sha256=ig4JjJR5gV-lXPRVbiaJuL9qeoahM_afYvWphpY1lWA,993
72
73
  lionagi/operations/select/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
73
74
  lionagi/operations/select/select.py,sha256=qCxgsqNSDQVmtINHTee2973UU6VuBuAsO7fdhQ0VYjQ,2492
@@ -105,13 +106,13 @@ lionagi/operatives/models/operable_model.py,sha256=Br9vCo_Z3iqqE8Zdfy_n4fqu7xfIo
105
106
  lionagi/operatives/models/schema_model.py,sha256=-BeCwW_1Rle--w-f7MajbOYH7t_8SPWw0_qK0fpTsRg,666
106
107
  lionagi/operatives/strategies/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
107
108
  lionagi/operatives/strategies/base.py,sha256=cfZXUZYPypW-hFZJj7HDtTPc-x99XB6dO_S5os1srTk,1820
108
- lionagi/operatives/strategies/concurrent.py,sha256=bLLL90LYywkxGlMY8XXGsZ1GRZrtB_8lsfkqspLgQ6o,2721
109
+ lionagi/operatives/strategies/concurrent.py,sha256=SV-zQNhUb1uSaVXzF_sHRYwklVL1Pa8yjfG9XjigsK0,2720
109
110
  lionagi/operatives/strategies/concurrent_chunk.py,sha256=9qwYoqO0LO1BMIyxU-tc_9ppBK0J94cnWs3e7wx7PR0,1678
110
- lionagi/operatives/strategies/concurrent_sequential_chunk.py,sha256=5Zw9fO1YWSj81w6IjOdEPzHE-4TxIdui-ljjrAsbEEI,3658
111
+ lionagi/operatives/strategies/concurrent_sequential_chunk.py,sha256=PBNsJDZwd36ocVwkm3QKNBUYhsWINhAZoKPHHZlqkHw,3657
111
112
  lionagi/operatives/strategies/params.py,sha256=XNCD8sQJCm7xk0yGFKSQ14FuUNV1f8wLfNNJg_NYsn8,5407
112
- lionagi/operatives/strategies/sequential.py,sha256=nSMtYy10P4W8U2SoARfKCBDN6y8_WoubKjoORUnewjY,949
113
- lionagi/operatives/strategies/sequential_chunk.py,sha256=bs_0zZJjJpYdmEEWx3mwh3it5ErQYfZr-ImahyKEy8Y,3161
114
- lionagi/operatives/strategies/sequential_concurrent_chunk.py,sha256=GJurnTuu6U7FOPR9mZxkjoJMIiQbgvRGt5iZZtmB2mY,3559
113
+ lionagi/operatives/strategies/sequential.py,sha256=NvcREg-DhMPZx6-4yXjm1z1bVKmAO9w3VDTpdZ0mu74,948
114
+ lionagi/operatives/strategies/sequential_chunk.py,sha256=66m6LW2NkMDyLUYL-4m15_9_b6765aOww-uzMqgJVaY,3160
115
+ lionagi/operatives/strategies/sequential_concurrent_chunk.py,sha256=v3pQyJRRfnWKy1RUvrXIkvqgt_PIXQ63ol5lZtj1-V8,3558
115
116
  lionagi/operatives/strategies/utils.py,sha256=plZg84Yqba5GAmNPvsiUjbAavdDmCfwZkKnK_c_aORw,1414
116
117
  lionagi/protocols/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
117
118
  lionagi/protocols/_concepts.py,sha256=2vHkG_Zbh4y3YAOqgJw0HXa2HS0VogjjvV3o1oXG7HM,1555
@@ -180,9 +181,9 @@ lionagi/service/providers/openrouter_/chat_completions.py,sha256=MRf4ZbMCgzNIL4g
180
181
  lionagi/service/providers/perplexity_/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
181
182
  lionagi/service/providers/perplexity_/chat_completions.py,sha256=SsDbrtXwQsR4Yu2VMU43KfeS86QWI8UTNhDth5lNWNs,1055
182
183
  lionagi/session/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
183
- lionagi/session/branch.py,sha256=ogCp8ybyrm1bspmtovcvrzUmBh8Nu_Q5RBBu2uYAl6U,58678
184
+ lionagi/session/branch.py,sha256=2KMMl-YVVfbgbz1qtyXpw3SrRZ5yAfoqm44s-gnbjyU,59319
184
185
  lionagi/session/session.py,sha256=po6C7PnM0iu_ISHUo4PBzzQ61HFOgcsAUfPoO--eLak,8987
185
- lionagi-0.7.3.dist-info/METADATA,sha256=DRvNYxsLZQBHfGy4niyl48KxbI7eB7z2YbhabbtJRD0,22776
186
- lionagi-0.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
187
- lionagi-0.7.3.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
188
- lionagi-0.7.3.dist-info/RECORD,,
186
+ lionagi-0.7.5.dist-info/METADATA,sha256=BzOxAvQTuo7KixBKczhR3Ne6LPcWNDo1zOV36Y0fZo4,22768
187
+ lionagi-0.7.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
188
+ lionagi-0.7.5.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
189
+ lionagi-0.7.5.dist-info/RECORD,,