lionagi 0.8.3__py3-none-any.whl → 0.8.4__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.
@@ -12,7 +12,6 @@ import inspect
12
12
  from collections.abc import Callable
13
13
  from typing import Any, TypeAlias
14
14
 
15
- from openai import BaseModel
16
15
  from pydantic import Field, field_validator, model_validator
17
16
  from typing_extensions import Self
18
17
 
@@ -1,5 +1,4 @@
1
1
  # forms/flow.py
2
- from typing import List
3
2
 
4
3
  from pydantic import BaseModel, ConfigDict, Field
5
4
 
@@ -1,6 +1,6 @@
1
1
  # forms/form.py
2
2
 
3
- from typing import Any, Optional
3
+ from typing import Any
4
4
 
5
5
  from pydantic import ConfigDict, Field, model_validator
6
6
  from typing_extensions import Self
lionagi/session/branch.py CHANGED
@@ -345,6 +345,20 @@ class Branch(Element, Communicatable, Relational):
345
345
 
346
346
  return branch_clone
347
347
 
348
+ def register_tools(
349
+ self, tools: FuncTool | list[FuncTool], update: bool = False
350
+ ):
351
+ """
352
+ Registers one or more tools in the ActionManager.
353
+
354
+ Args:
355
+ tools (FuncTool | list[FuncTool]):
356
+ A single tool or a list of tools to register.
357
+ update (bool, optional):
358
+ If `True`, updates existing tools with the same name.
359
+ """
360
+ self._action_manager.register_tools(tools, update=update)
361
+
348
362
  # -------------------------------------------------------------------------
349
363
  # Conversion / Serialization
350
364
  # -------------------------------------------------------------------------
@@ -532,6 +546,33 @@ class Branch(Element, Communicatable, Relational):
532
546
  for key in self.mailbox.pending_ins:
533
547
  self.receive(key)
534
548
 
549
+ def connect(
550
+ self,
551
+ name: str,
552
+ imodel: iModel,
553
+ request_options: type[BaseModel],
554
+ description: str = None,
555
+ update: bool = False,
556
+ ):
557
+ if not update and name in self.tools:
558
+ raise ValueError(f"Tool with name '{name}' already exists.")
559
+
560
+ async def _connect(**kwargs):
561
+ """connect to an api endpoint"""
562
+ api_call = await imodel.invoke(**kwargs)
563
+ self._log_manager.log(Log.create(api_call))
564
+ return api_call.response
565
+
566
+ _connect.__name__ = name
567
+ if description:
568
+ _connect.__doc__ = description
569
+
570
+ tool = Tool(
571
+ func_callable=_connect,
572
+ request_options=request_options,
573
+ )
574
+ self._action_manager.register_tools(tool, update=update)
575
+
535
576
  # -------------------------------------------------------------------------
536
577
  # Dictionary Conversion
537
578
  # -------------------------------------------------------------------------
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.8.3"
1
+ __version__ = "0.8.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.8.3
3
+ Version: 0.8.4
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=wNKdnVQvE_CHEstK7htrrj334RA_vbGcIds-3pUiRkc,455
4
4
  lionagi/_types.py,sha256=9g7iytvSj3UjZxD-jL06_fxuNfgZyWT3Qnp0XYp1wQU,63
5
5
  lionagi/settings.py,sha256=k9zRJXv57TveyfHO3Vr9VGiKrSwlRUUVKt5zf6v9RU4,1627
6
6
  lionagi/utils.py,sha256=QbF4E1PG-BaRcEVH3kJIYCJVNq-oRNoTxjda5k8NYW4,73177
7
- lionagi/version.py,sha256=otnwfmvJLUamPajTPUaIekiO9mA-2HPi-_h_E0N-uOQ,22
7
+ lionagi/version.py,sha256=jhHEJFZWhkQDemoZMomBYq-RNrKXknYzUaeIU9A6XsI,22
8
8
  lionagi/libs/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
9
9
  lionagi/libs/parse.py,sha256=tpEbmIRGuHhLCJlUlm6fjmqm_Z6XJLAXGNFHNuk422I,1011
10
10
  lionagi/libs/file/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
@@ -85,12 +85,12 @@ lionagi/operatives/action/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQp
85
85
  lionagi/operatives/action/function_calling.py,sha256=dFNldEuV77quaM2M4VGXPQRhh3yGCAA5WucyipRu13M,5067
86
86
  lionagi/operatives/action/manager.py,sha256=FXfWhQMSFE5qJNZPpgdz4ePvthLafZfnmak2PImCrsc,8824
87
87
  lionagi/operatives/action/request_response_model.py,sha256=mCyKub_WoEttJ_mqLhGoOoPVBQHOhr7sswy_jN6-620,3378
88
- lionagi/operatives/action/tool.py,sha256=G63P1Q9Kmq6wtK3OJy7G8lqzLo6AsmLa7Yk4fGgida4,5613
88
+ lionagi/operatives/action/tool.py,sha256=39Z2beUUdG0ngoK1r2ynmX4yIiDIyHv_dxb4X53In24,5584
89
89
  lionagi/operatives/action/utils.py,sha256=vUe7Aysuzbg16rAfe2Ttp5QUz5_L6mMedBVAWzGAHwk,4330
90
90
  lionagi/operatives/forms/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
91
91
  lionagi/operatives/forms/base.py,sha256=hitr0eKk7Yts2VfpuBGl0YxpClMJEpsy7xWodhg2AhQ,2720
92
- lionagi/operatives/forms/flow.py,sha256=JRHY_t8yZNN2p_spPvoFG1hD--2YVtAiA8h3hrK7Vt0,2556
93
- lionagi/operatives/forms/form.py,sha256=GJTE_PrlHT_bgWf-zOQaIFdEkx1CUDTzgAyRofPXoOE,2934
92
+ lionagi/operatives/forms/flow.py,sha256=Em0AIiSQT5r45wKjoq57J_wuDZ9fecKZxf6FzmmamQM,2532
93
+ lionagi/operatives/forms/form.py,sha256=j5Mf9DCblJYtN_uCgBhXzE4IkrZHWc7jyzog3tXqeW4,2924
94
94
  lionagi/operatives/forms/report.py,sha256=ZQsM5nDnmF3WdCSurDUBTMI-PEy8yTnRA_uN6tyRneA,1488
95
95
  lionagi/operatives/instruct/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
96
96
  lionagi/operatives/instruct/base.py,sha256=Vw9u3BGzjNRGcPfW1ROr2uCZcZsjrm4WU6491P6ecCI,1895
@@ -187,9 +187,9 @@ lionagi/service/providers/openrouter_/chat_completions.py,sha256=MRf4ZbMCgzNIL4g
187
187
  lionagi/service/providers/perplexity_/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
188
188
  lionagi/service/providers/perplexity_/chat_completions.py,sha256=SsDbrtXwQsR4Yu2VMU43KfeS86QWI8UTNhDth5lNWNs,1055
189
189
  lionagi/session/__init__.py,sha256=v8vNyJVIVj8_Oz9RJdVe6ZKUQMYTgDh1VQpnr1KdLaw,112
190
- lionagi/session/branch.py,sha256=JvErd9YUuGdWyLj37rtKOteSqV0ltn9lg0R2G8GO40c,62539
190
+ lionagi/session/branch.py,sha256=ZLItnjW66__85s0brxhq1LZisjDoVS4HBJSHUpFaxsg,63834
191
191
  lionagi/session/session.py,sha256=po6C7PnM0iu_ISHUo4PBzzQ61HFOgcsAUfPoO--eLak,8987
192
- lionagi-0.8.3.dist-info/METADATA,sha256=uWD1Rcqe1Qknq4Fcroot2pVTsFNyPxM0UrbyZZaa8NY,22819
193
- lionagi-0.8.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
194
- lionagi-0.8.3.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
195
- lionagi-0.8.3.dist-info/RECORD,,
192
+ lionagi-0.8.4.dist-info/METADATA,sha256=MHgfVuup5176MSrXlfX2B_tQUaiKNdGAjtITrJVLCWY,22819
193
+ lionagi-0.8.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
194
+ lionagi-0.8.4.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
195
+ lionagi-0.8.4.dist-info/RECORD,,