lionagi 0.10.0__py3-none-any.whl → 0.10.2__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.
lionagi/_types.py CHANGED
@@ -1 +1,2 @@
1
+ from .fields import *
1
2
  from .protocols.types import *
@@ -0,0 +1,35 @@
1
+ from .action import (
2
+ ActionRequestModel,
3
+ ActionResponseModel,
4
+ )
5
+ from .base import (
6
+ CodeSnippet,
7
+ Outline,
8
+ OutlineItem,
9
+ Section,
10
+ Source,
11
+ TextSnippet,
12
+ )
13
+ from .file import CodeFile, Documentation, File
14
+ from .instruct import (
15
+ Instruct,
16
+ InstructResponse,
17
+ )
18
+ from .reason import Reason
19
+
20
+ __all__ = (
21
+ "ActionRequestModel",
22
+ "ActionResponseModel",
23
+ "Source",
24
+ "TextSnippet",
25
+ "CodeSnippet",
26
+ "Section",
27
+ "OutlineItem",
28
+ "Outline",
29
+ "File",
30
+ "CodeFile",
31
+ "Documentation",
32
+ "Instruct",
33
+ "InstructResponse",
34
+ "Reason",
35
+ )
@@ -16,9 +16,7 @@ from lionagi.utils import to_dict, to_json, to_list
16
16
 
17
17
  __all__ = (
18
18
  "ActionRequestModel",
19
- "ACTION_REQUESTS_FIELD",
20
19
  "ActionResponseModel",
21
- "ACTION_RESPONSES_FIELD",
22
20
  )
23
21
 
24
22
 
lionagi/fields/base.py ADDED
@@ -0,0 +1,151 @@
1
+ from enum import Enum
2
+
3
+ from pydantic import Field, HttpUrl
4
+
5
+ from lionagi.models import HashableModel
6
+
7
+ __all__ = (
8
+ "Source",
9
+ "TextSnippet",
10
+ "CodeSnippet",
11
+ "Section",
12
+ "OutlineItem",
13
+ "Outline",
14
+ )
15
+
16
+
17
+ class Source(HashableModel):
18
+ """
19
+ Represents a citation or external source, such as:
20
+ - a website,
21
+ - documentation link,
22
+ - research paper,
23
+ - or any external resource.
24
+ """
25
+
26
+ title: str = Field(
27
+ ...,
28
+ description="Short label or title for the reference (e.g. 'Pydantic Docs', 'RFC 3986').",
29
+ )
30
+
31
+ url: str | HttpUrl | None = Field(
32
+ None,
33
+ description="Full URL or local path pointing to the resource. Must conform to standard URL format.",
34
+ )
35
+
36
+ note: str | None = Field(
37
+ default=None,
38
+ description=(
39
+ "Optional additional note explaining why this reference is relevant or what it contains."
40
+ ),
41
+ )
42
+
43
+
44
+ class SnippetType(str, Enum):
45
+ TEXT = "text"
46
+ CODE = "code"
47
+
48
+
49
+ class TextSnippet(HashableModel):
50
+ """
51
+ Specialized snippet for textual/prose content.
52
+ """
53
+
54
+ type: SnippetType = Field(
55
+ SnippetType.TEXT,
56
+ description=(
57
+ "Must be 'text' for textual snippets. Ensures explicit type distinction."
58
+ ),
59
+ )
60
+ content: str = Field(
61
+ ...,
62
+ description=(
63
+ "The actual text. Can be a paragraph, bullet list, or any narrative content."
64
+ ),
65
+ )
66
+
67
+
68
+ class CodeSnippet(HashableModel):
69
+ """
70
+ Specialized snippet for source code or command-line examples.
71
+ """
72
+
73
+ type: SnippetType = Field(
74
+ SnippetType.CODE,
75
+ description=(
76
+ "Must be 'code' for code snippets. Allows separate handling or formatting."
77
+ ),
78
+ )
79
+ content: str = Field(
80
+ ...,
81
+ description=(
82
+ "The actual code or command sequence. Should be well-formatted so it can be rendered properly."
83
+ ),
84
+ )
85
+
86
+
87
+ class Section(HashableModel):
88
+ """
89
+ A single section of a document or article. Each section has:
90
+ - A title
91
+ - A sequential list of content snippets (text or code),
92
+ which appear in the intended reading order.
93
+ - Optional sources specifically cited in this section.
94
+ """
95
+
96
+ title: str = Field(
97
+ ...,
98
+ description=(
99
+ "The section heading or label, e.g., 'Introduction', 'Implementation Steps'."
100
+ ),
101
+ )
102
+ snippets: list[TextSnippet | CodeSnippet] = Field(
103
+ default_factory=list,
104
+ description=(
105
+ "Ordered list of content snippets. Could be multiple text blocks, code examples, etc."
106
+ ),
107
+ )
108
+
109
+ sources: list[Source] = Field(
110
+ default_factory=list,
111
+ description=(
112
+ "References specifically cited in this section. "
113
+ "If sources are stored at the doc-level, this can be omitted."
114
+ ),
115
+ )
116
+
117
+
118
+ class OutlineItem(HashableModel):
119
+ """
120
+ Represents a single outline item, which could become a full section later.
121
+ """
122
+
123
+ heading: str = Field(
124
+ ...,
125
+ description="Short name or label for this item, e.g., 'Chapter 1: Basics'.",
126
+ )
127
+ summary: str | None = Field(
128
+ default=None,
129
+ description=(
130
+ "A brief description of what this section will cover, if known."
131
+ ),
132
+ )
133
+
134
+
135
+ class Outline(HashableModel):
136
+ """
137
+ A top-level outline for a document or article.
138
+ Usually used in early planning stages.
139
+ """
140
+
141
+ topic: str = Field(
142
+ ..., description="Working title or overarching topic of the document."
143
+ )
144
+ items: list[OutlineItem] = Field(
145
+ default_factory=list,
146
+ description="List of major outline points or sections planned.",
147
+ )
148
+ notes: str | None = Field(
149
+ default=None,
150
+ description="Any additional remarks, questions, or brainstorming notes for the outline.",
151
+ )
@@ -1,11 +1,17 @@
1
1
  from pathlib import Path
2
2
 
3
- from pydantic import BaseModel, Field, field_validator
3
+ from pydantic import Field, field_validator
4
4
 
5
- from lionagi.models import FieldModel
5
+ from .base import HashableModel, Source
6
+
7
+ __all__ = (
8
+ "File",
9
+ "CodeFile",
10
+ "Documentation",
11
+ )
6
12
 
7
13
 
8
- class File(BaseModel):
14
+ class File(HashableModel):
9
15
  """
10
16
  Represents a generic file with an optional name, content, and brief description.
11
17
  Useful for capturing and validating metadata about any kind of file within a project.
@@ -112,24 +118,13 @@ class Documentation(File):
112
118
  "# API Reference\\n## Session Class\\n...",
113
119
  ],
114
120
  )
121
+ sources: list[Source] | None = Field(
122
+ default=None,
123
+ description=(
124
+ "List of sources or references used to create this documentation. "
125
+ "Each source should include a title and URL to the original content."
126
+ ),
127
+ )
115
128
 
116
129
 
117
- FILE_FIELD = FieldModel(
118
- name="file",
119
- annotation=File | None,
120
- default=None,
121
- )
122
-
123
- CODE_FILE_FIELD = FieldModel(
124
- name="code_file",
125
- annotation=CodeFile | None,
126
- default=None,
127
- )
128
-
129
- DOCUMENTATION_FIELD = FieldModel(
130
- name="documentation",
131
- annotation=Documentation | None,
132
- default=None,
133
- )
134
-
135
- # File: lionagi/libs/fields/file.py
130
+ # File: lionagi/fields/file.py
@@ -16,8 +16,6 @@ from lionagi.utils import to_num
16
16
  __all__ = (
17
17
  "Instruct",
18
18
  "InstructResponse",
19
- "INSTRUCT_FIELD",
20
- "LIST_INSTRUCT_FIELD",
21
19
  )
22
20
 
23
21
 
@@ -150,4 +148,4 @@ LIST_INSTRUCT_FIELD_MODEL = FieldModel(
150
148
  default=None,
151
149
  )
152
150
 
153
- # File: lionagi/libs/fields/instruct.py
151
+ # File: lionagi/fields/instruct.py
@@ -7,12 +7,7 @@ from pydantic import BaseModel, Field, field_validator
7
7
  from lionagi.models import FieldModel
8
8
  from lionagi.utils import to_num
9
9
 
10
- __all__ = (
11
- "Reason",
12
- "REASON_FIELD",
13
- "CONFIDENCE_SCORE_FIELD",
14
- "validate_confidence_score",
15
- )
10
+ __all__ = ("Reason",)
16
11
 
17
12
 
18
13
  class Reason(BaseModel):
@@ -51,15 +46,6 @@ def validate_confidence_score(cls, v):
51
46
  return -1
52
47
 
53
48
 
54
- CONFIDENCE_SCORE_FIELD = FieldModel(
55
- name="confidence_score",
56
- annotation=float | None,
57
- default=None,
58
- validator=validate_confidence_score,
59
- validator_kwargs={"mode": "before"},
60
- )
61
-
62
-
63
49
  REASON_FIELD = FieldModel(
64
50
  name="reason",
65
51
  annotation=Reason | None,
@@ -67,4 +53,4 @@ REASON_FIELD = FieldModel(
67
53
  description="**Provide a concise reason for the decision made.**",
68
54
  )
69
55
 
70
- # File: lionagi/libs/fields/reason.py
56
+ # File: lionagi/fields/reason.py
@@ -2,165 +2,20 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- import importlib.metadata
6
- import importlib.util
7
- import logging
8
- import subprocess
9
- from typing import Any
10
-
11
- from lionagi.utils import run_package_manager_command
12
-
13
-
14
- def check_import(
15
- package_name: str,
16
- module_name: str | None = None,
17
- import_name: str | None = None,
18
- pip_name: str | None = None,
19
- attempt_install: bool = True,
20
- error_message: str = "",
21
- ):
22
- """
23
- Check if a package is installed, attempt to install if not.
24
-
25
- Args:
26
- package_name: The name of the package to check.
27
- module_name: The specific module to import (if any).
28
- import_name: The specific name to import from the module (if any).
29
- pip_name: The name to use for pip installation (if different).
30
- attempt_install: Whether to attempt installation if not found.
31
- error_message: Custom error message to use if package not found.
32
-
33
- Raises:
34
- ImportError: If the package is not found and not installed.
35
- ValueError: If the import fails after installation attempt.
36
- """
37
- if not is_import_installed(package_name):
38
- if attempt_install:
39
- logging.info(
40
- f"Package {package_name} not found. Attempting " "to install.",
41
- )
42
- try:
43
- return install_import(
44
- package_name=package_name,
45
- module_name=module_name,
46
- import_name=import_name,
47
- pip_name=pip_name,
48
- )
49
- except ImportError as e:
50
- raise ValueError(
51
- f"Failed to install {package_name}: {e}"
52
- ) from e
53
- else:
54
- logging.info(
55
- f"Package {package_name} not found. {error_message}",
56
- )
57
- raise ImportError(
58
- f"Package {package_name} not found. {error_message}",
59
- )
60
-
61
- return import_module(
62
- package_name=package_name,
63
- module_name=module_name,
64
- import_name=import_name,
65
- )
66
-
67
-
68
- def import_module(
69
- package_name: str,
70
- module_name: str = None,
71
- import_name: str | list = None,
72
- ) -> Any:
73
- """
74
- Import a module by its path.
75
-
76
- Args:
77
- module_path: The path of the module to import.
78
-
79
- Returns:
80
- The imported module.
81
-
82
- Raises:
83
- ImportError: If the module cannot be imported.
84
- """
85
- try:
86
- full_import_path = (
87
- f"{package_name}.{module_name}" if module_name else package_name
88
- )
89
-
90
- if import_name:
91
- import_name = (
92
- [import_name]
93
- if not isinstance(import_name, list)
94
- else import_name
95
- )
96
- a = __import__(
97
- full_import_path,
98
- fromlist=import_name,
99
- )
100
- if len(import_name) == 1:
101
- return getattr(a, import_name[0])
102
- return [getattr(a, name) for name in import_name]
103
- else:
104
- return __import__(full_import_path)
105
-
106
- except ImportError as e:
107
- raise ImportError(
108
- f"Failed to import module {full_import_path}: {e}"
109
- ) from e
110
-
111
-
112
- def install_import(
113
- package_name: str,
114
- module_name: str | None = None,
115
- import_name: str | None = None,
116
- pip_name: str | None = None,
117
- ):
118
- """
119
- Attempt to import a package, installing it if not found.
120
-
121
- Args:
122
- package_name: The name of the package to import.
123
- module_name: The specific module to import (if any).
124
- import_name: The specific name to import from the module (if any).
125
- pip_name: The name to use for pip installation (if different).
126
-
127
- Raises:
128
- ImportError: If the package cannot be imported or installed.
129
- subprocess.CalledProcessError: If pip installation fails.
130
- """
131
- pip_name = pip_name or package_name
132
-
133
- try:
134
- return import_module(
135
- package_name=package_name,
136
- module_name=module_name,
137
- import_name=import_name,
138
- )
139
- except ImportError:
140
- logging.info(f"Installing {pip_name}...")
141
- try:
142
- run_package_manager_command(["install", pip_name])
143
- return import_module(
144
- package_name=package_name,
145
- module_name=module_name,
146
- import_name=import_name,
147
- )
148
- except subprocess.CalledProcessError as e:
149
- raise ImportError(f"Failed to install {pip_name}: {e}") from e
150
- except ImportError as e:
151
- raise ImportError(
152
- f"Failed to import {pip_name} after installation: {e}"
153
- ) from e
154
-
155
-
156
- def is_import_installed(package_name: str) -> bool:
157
- """
158
- Check if a package is installed.
159
-
160
- Args:
161
- package_name: The name of the package to check.
162
-
163
- Returns:
164
- bool: True if the package is installed, False otherwise.
165
- """
166
- return importlib.util.find_spec(package_name) is not None
5
+ from lionagi.utils import (
6
+ check_import,
7
+ import_module,
8
+ install_import,
9
+ is_import_installed,
10
+ run_package_manager_command,
11
+ )
12
+
13
+ # backward compatibility
14
+
15
+ __all__ = (
16
+ "run_package_manager_command",
17
+ "check_import",
18
+ "import_module",
19
+ "install_import",
20
+ "is_import_installed",
21
+ )
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Literal
8
8
 
9
9
  from pydantic import BaseModel
10
10
 
11
- from lionagi.libs.fields.instruct import Instruct
11
+ from lionagi.fields.instruct import Instruct
12
12
  from lionagi.libs.schema.as_readable import as_readable
13
13
  from lionagi.libs.validate.common_field_validators import (
14
14
  validate_model_to_type,
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
7
7
 
8
8
  from pydantic import BaseModel
9
9
 
10
- from lionagi.libs.fields.action import ActionResponseModel
10
+ from lionagi.fields.action import ActionResponseModel
11
11
  from lionagi.protocols.types import ActionRequest, Log
12
12
 
13
13
  if TYPE_CHECKING:
@@ -7,7 +7,7 @@ from typing import Any, Literal
7
7
 
8
8
  from pydantic import BaseModel
9
9
 
10
- from lionagi.libs.fields.instruct import (
10
+ from lionagi.fields.instruct import (
11
11
  LIST_INSTRUCT_FIELD_MODEL,
12
12
  Instruct,
13
13
  InstructResponse,
@@ -4,7 +4,7 @@
4
4
 
5
5
  from typing import TYPE_CHECKING, Any
6
6
 
7
- from lionagi.libs.fields.instruct import Instruct
7
+ from lionagi.fields.instruct import Instruct
8
8
 
9
9
  if TYPE_CHECKING:
10
10
  from lionagi.session.branch import Branch
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Literal
7
7
 
8
8
  from pydantic import BaseModel, JsonValue
9
9
 
10
- from lionagi.libs.fields.instruct import Instruct
10
+ from lionagi.fields.instruct import Instruct
11
11
  from lionagi.models import FieldModel, ModelParams
12
12
  from lionagi.protocols.types import (
13
13
  Instruction,
@@ -6,7 +6,7 @@ from typing import Any, Literal
6
6
 
7
7
  from pydantic import BaseModel
8
8
 
9
- from lionagi.libs.fields.instruct import (
9
+ from lionagi.fields.instruct import (
10
10
  LIST_INSTRUCT_FIELD_MODEL,
11
11
  Instruct,
12
12
  InstructResponse,
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Any
7
7
 
8
8
  from pydantic import BaseModel
9
9
 
10
- from lionagi.libs.fields.instruct import Instruct
10
+ from lionagi.fields.instruct import Instruct
11
11
 
12
12
  from .utils import SelectionModel
13
13
 
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- from lionagi.libs.fields.instruct import Instruct
5
+ from lionagi.fields.instruct import Instruct
6
6
  from lionagi.session.session import Branch, Session
7
7
 
8
8
 
@@ -4,11 +4,11 @@
4
4
 
5
5
  from typing import Any
6
6
 
7
+ from lionagi.fields.action import ActionRequestModel
7
8
  from lionagi.protocols._concepts import Manager
8
9
  from lionagi.protocols.messages.action_request import ActionRequest
9
10
  from lionagi.utils import to_list
10
11
 
11
- from ...libs.fields.action import ActionRequestModel
12
12
  from .function_calling import FunctionCalling
13
13
  from .tool import FuncTool, FuncToolRef, Tool, ToolRef
14
14
 
@@ -5,14 +5,14 @@
5
5
  from pydantic import BaseModel, Field
6
6
  from pydantic.fields import FieldInfo
7
7
 
8
- from lionagi.libs.fields.action import (
8
+ from lionagi.fields.action import (
9
9
  ACTION_REQUESTS_FIELD,
10
10
  ACTION_REQUIRED_FIELD,
11
11
  ACTION_RESPONSES_FIELD,
12
12
  ActionRequestModel,
13
13
  ActionResponseModel,
14
14
  )
15
- from lionagi.libs.fields.reason import REASON_FIELD, Reason
15
+ from lionagi.fields.reason import REASON_FIELD, Reason
16
16
  from lionagi.models import FieldModel, ModelParams
17
17
  from lionagi.protocols.operatives.operative import Operative
18
18
 
lionagi/session/branch.py CHANGED
@@ -4,25 +4,20 @@
4
4
 
5
5
  from collections.abc import AsyncGenerator
6
6
  from enum import Enum
7
- from typing import TYPE_CHECKING, Any, Literal
7
+ from typing import Any, Literal
8
8
 
9
9
  import pandas as pd
10
10
  from jinja2 import Template
11
11
  from pydantic import BaseModel, Field, JsonValue, PrivateAttr
12
12
 
13
+ from lionagi.fields import Instruct
13
14
  from lionagi.libs.schema.as_readable import as_readable
14
15
  from lionagi.models.field_model import FieldModel
15
- from lionagi.models.model_params import ModelParams
16
- from lionagi.protocols.action.manager import ActionManager
17
16
  from lionagi.protocols.action.tool import FuncTool, Tool, ToolRef
18
- from lionagi.protocols.operatives.operative import Operative
19
-
20
- # Forward reference for Instruct which will be imported in the methods that use it
21
- # to avoid circular imports
22
- Instruct = Any
23
17
  from lionagi.protocols.types import (
24
18
  ID,
25
19
  MESSAGE_FIELDS,
20
+ ActionManager,
26
21
  ActionRequest,
27
22
  ActionResponse,
28
23
  AssistantResponse,
@@ -37,6 +32,7 @@ from lionagi.protocols.types import (
37
32
  Mailbox,
38
33
  MessageManager,
39
34
  MessageRole,
35
+ Operative,
40
36
  Package,
41
37
  PackageCategory,
42
38
  Pile,
@@ -54,10 +50,6 @@ from lionagi.utils import UNDEFINED, alcall, bcall, copy
54
50
 
55
51
  from .prompts import LION_SYSTEM_MESSAGE
56
52
 
57
- if TYPE_CHECKING:
58
- # Forward references for type checking (e.g., in operations or extended modules)
59
- from lionagi.session.branch import Branch
60
-
61
53
  __all__ = ("Branch",)
62
54
 
63
55
 
@@ -907,7 +899,6 @@ class Branch(Element, Communicatable, Relational):
907
899
  sender: SenderRecipient = None,
908
900
  recipient: SenderRecipient = None,
909
901
  progression: Progression = None,
910
- imodel: iModel = None, # deprecated, alias of chat_model
911
902
  chat_model: iModel = None,
912
903
  invoke_actions: bool = True,
913
904
  tool_schemas: list[dict] = None,
@@ -920,7 +911,6 @@ class Branch(Element, Communicatable, Relational):
920
911
  response_format: type[
921
912
  BaseModel
922
913
  ] = None, # alias of operative.request_type
923
- return_operative: bool = False,
924
914
  actions: bool = False,
925
915
  reason: bool = False,
926
916
  action_kwargs: dict = None,
@@ -931,15 +921,9 @@ class Branch(Element, Communicatable, Relational):
931
921
  verbose_action: bool = False,
932
922
  field_models: list[FieldModel] = None,
933
923
  exclude_fields: list | dict | None = None,
934
- request_params: ModelParams = None,
935
- request_param_kwargs: dict = None,
936
- response_params: ModelParams = None,
937
- response_param_kwargs: dict = None,
938
924
  handle_validation: Literal[
939
925
  "raise", "return_value", "return_none"
940
926
  ] = "return_value",
941
- operative_model: type[BaseModel] = None,
942
- request_model: type[BaseModel] = None,
943
927
  include_token_usage_to_model: bool = False,
944
928
  **kwargs,
945
929
  ) -> list | BaseModel | None | dict | str:
@@ -973,8 +957,7 @@ class Branch(Element, Communicatable, Relational):
973
957
  The recipient ID for newly added messages.
974
958
  progression (Progression, optional):
975
959
  Custom ordering of conversation messages.
976
- imodel (iModel, deprecated):
977
- Alias of `chat_model`.
960
+
978
961
  chat_model (iModel, optional):
979
962
  The LLM used for the main chat operation. Defaults to `branch.chat_model`.
980
963
  invoke_actions (bool, optional):
@@ -995,8 +978,6 @@ class Branch(Element, Communicatable, Relational):
995
978
  If provided, reuses an existing operative's config for parsing/validation.
996
979
  response_format (type[BaseModel], optional):
997
980
  Expected Pydantic model for the final response (alias for `operative.request_type`).
998
- return_operative (bool, optional):
999
- If `True`, returns the entire `Operative` object after processing
1000
981
  rather than the structured or raw output.
1001
982
  actions (bool, optional):
1002
983
  If `True`, signals that function-calling or "action" usage is expected.
@@ -1014,20 +995,8 @@ class Branch(Element, Communicatable, Relational):
1014
995
  Field-level definitions or overrides for the model schema.
1015
996
  exclude_fields (list|dict|None, optional):
1016
997
  Which fields to exclude from final validation or model building.
1017
- request_params (ModelParams | None, optional):
1018
- Extra config for building the request model in the operative.
1019
- request_param_kwargs (dict|None, optional):
1020
- Additional kwargs passed to the `ModelParams` constructor for the request.
1021
- response_params (ModelParams | None, optional):
1022
- Config for building the response model after actions.
1023
- response_param_kwargs (dict|None, optional):
1024
- Additional kwargs passed to the `ModelParams` constructor for the response.
1025
998
  handle_validation (Literal["raise","return_value","return_none"], optional):
1026
999
  How to handle parsing failures (default: "return_value").
1027
- operative_model (type[BaseModel], deprecated):
1028
- Alias for `response_format`.
1029
- request_model (type[BaseModel], optional):
1030
- Another alias for `response_format`.
1031
1000
  include_token_usage_to_model:
1032
1001
  If `True`, includes token usage in the model messages.
1033
1002
  **kwargs:
@@ -1065,7 +1034,6 @@ class Branch(Element, Communicatable, Relational):
1065
1034
  tools=tools,
1066
1035
  operative=operative,
1067
1036
  response_format=response_format,
1068
- return_operative=return_operative,
1069
1037
  actions=actions,
1070
1038
  reason=reason,
1071
1039
  action_kwargs=action_kwargs,
@@ -1074,14 +1042,7 @@ class Branch(Element, Communicatable, Relational):
1074
1042
  verbose_action=verbose_action,
1075
1043
  field_models=field_models,
1076
1044
  exclude_fields=exclude_fields,
1077
- request_params=request_params,
1078
- request_param_kwargs=request_param_kwargs,
1079
- response_params=response_params,
1080
- response_param_kwargs=response_param_kwargs,
1081
1045
  handle_validation=handle_validation,
1082
- operative_model=operative_model,
1083
- request_model=request_model,
1084
- imodel=imodel,
1085
1046
  include_token_usage_to_model=include_token_usage_to_model,
1086
1047
  **kwargs,
1087
1048
  )
@@ -1096,19 +1057,15 @@ class Branch(Element, Communicatable, Relational):
1096
1057
  sender: SenderRecipient = None,
1097
1058
  recipient: SenderRecipient = None,
1098
1059
  progression: ID.IDSeq = None,
1099
- request_model: type[BaseModel] | BaseModel | None = None,
1100
1060
  response_format: type[BaseModel] = None,
1101
1061
  request_fields: dict | list[str] = None,
1102
- imodel: iModel = None, # alias of chat_model
1103
1062
  chat_model: iModel = None,
1104
1063
  parse_model: iModel = None,
1105
1064
  skip_validation: bool = False,
1106
1065
  images: list = None,
1107
1066
  image_detail: Literal["low", "high", "auto"] = None,
1108
1067
  num_parse_retries: int = 3,
1109
- fuzzy_match_kwargs: dict = None,
1110
1068
  clear_messages: bool = False,
1111
- operative_model: type[BaseModel] = None,
1112
1069
  include_token_usage_to_model: bool = False,
1113
1070
  **kwargs,
1114
1071
  ):
@@ -1135,14 +1092,10 @@ class Branch(Element, Communicatable, Relational):
1135
1092
  Recipient ID (defaults to `self.id`).
1136
1093
  progression (ID.IDSeq, optional):
1137
1094
  Custom ordering of messages.
1138
- request_model (type[BaseModel] | BaseModel | None, optional):
1139
- Model for validating or structuring the LLM's response.
1140
1095
  response_format (type[BaseModel], optional):
1141
1096
  Alias for `request_model`. If both are provided, raises ValueError.
1142
1097
  request_fields (dict|list[str], optional):
1143
1098
  If you only need certain fields from the LLM's response.
1144
- imodel (iModel, optional):
1145
- Deprecated alias for `chat_model`.
1146
1099
  chat_model (iModel, optional):
1147
1100
  An alternative to the default chat model.
1148
1101
  parse_model (iModel, optional):
@@ -1155,12 +1108,8 @@ class Branch(Element, Communicatable, Relational):
1155
1108
  Image detail level (if used).
1156
1109
  num_parse_retries (int, optional):
1157
1110
  Maximum parsing retries (capped at 5).
1158
- fuzzy_match_kwargs (dict, optional):
1159
- Additional settings for fuzzy field matching (if used).
1160
1111
  clear_messages (bool, optional):
1161
1112
  Whether to clear stored messages before sending.
1162
- operative_model (type[BaseModel], optional):
1163
- Deprecated, alias for `response_format`.
1164
1113
  **kwargs:
1165
1114
  Additional arguments for the underlying LLM call.
1166
1115
 
@@ -1182,18 +1131,15 @@ class Branch(Element, Communicatable, Relational):
1182
1131
  sender=sender,
1183
1132
  recipient=recipient,
1184
1133
  progression=progression,
1185
- request_model=request_model,
1186
1134
  response_format=response_format,
1187
1135
  request_fields=request_fields,
1188
- chat_model=kwargs.pop("chat_model", None) or chat_model or imodel,
1136
+ chat_model=chat_model,
1189
1137
  parse_model=parse_model,
1190
1138
  skip_validation=skip_validation,
1191
1139
  images=images,
1192
1140
  image_detail=image_detail,
1193
1141
  num_parse_retries=num_parse_retries,
1194
- fuzzy_match_kwargs=fuzzy_match_kwargs,
1195
1142
  clear_messages=clear_messages,
1196
- operative_model=operative_model,
1197
1143
  include_token_usage_to_model=include_token_usage_to_model,
1198
1144
  **kwargs,
1199
1145
  )
@@ -4,7 +4,7 @@
4
4
 
5
5
  from collections.abc import Callable
6
6
  from functools import partial
7
- from typing import TYPE_CHECKING, Any, ForwardRef
7
+ from typing import Any
8
8
 
9
9
  import pandas as pd
10
10
  from pydantic import Field, JsonValue, model_validator
@@ -32,12 +32,8 @@ from lionagi.protocols.types import (
32
32
  from .._errors import ItemNotFoundError
33
33
  from ..service.imodel import iModel
34
34
  from ..utils import lcall
35
+ from .branch import Branch
35
36
 
36
- if TYPE_CHECKING:
37
- from .branch import Branch
38
- else:
39
- # Forward reference to avoid circular import
40
- Branch = ForwardRef("Branch")
41
37
  msg_pile = partial(pile, item_type={RoledMessage}, strict_type=False)
42
38
 
43
39
 
lionagi/utils.py CHANGED
@@ -6,6 +6,8 @@ import asyncio
6
6
  import contextlib
7
7
  import copy as _copy
8
8
  import functools
9
+ import importlib.metadata
10
+ import importlib.util
9
11
  import json
10
12
  import logging
11
13
  import re
@@ -2367,3 +2369,215 @@ def run_package_manager_command(
2367
2369
  check=True,
2368
2370
  capture_output=True,
2369
2371
  )
2372
+
2373
+
2374
+ def check_import(
2375
+ package_name: str,
2376
+ module_name: str | None = None,
2377
+ import_name: str | None = None,
2378
+ pip_name: str | None = None,
2379
+ attempt_install: bool = True,
2380
+ error_message: str = "",
2381
+ ):
2382
+ """
2383
+ Check if a package is installed, attempt to install if not.
2384
+
2385
+ Args:
2386
+ package_name: The name of the package to check.
2387
+ module_name: The specific module to import (if any).
2388
+ import_name: The specific name to import from the module (if any).
2389
+ pip_name: The name to use for pip installation (if different).
2390
+ attempt_install: Whether to attempt installation if not found.
2391
+ error_message: Custom error message to use if package not found.
2392
+
2393
+ Raises:
2394
+ ImportError: If the package is not found and not installed.
2395
+ ValueError: If the import fails after installation attempt.
2396
+ """
2397
+ if not is_import_installed(package_name):
2398
+ if attempt_install:
2399
+ logging.info(
2400
+ f"Package {package_name} not found. Attempting " "to install.",
2401
+ )
2402
+ try:
2403
+ return install_import(
2404
+ package_name=package_name,
2405
+ module_name=module_name,
2406
+ import_name=import_name,
2407
+ pip_name=pip_name,
2408
+ )
2409
+ except ImportError as e:
2410
+ raise ValueError(
2411
+ f"Failed to install {package_name}: {e}"
2412
+ ) from e
2413
+ else:
2414
+ logging.info(
2415
+ f"Package {package_name} not found. {error_message}",
2416
+ )
2417
+ raise ImportError(
2418
+ f"Package {package_name} not found. {error_message}",
2419
+ )
2420
+
2421
+ return import_module(
2422
+ package_name=package_name,
2423
+ module_name=module_name,
2424
+ import_name=import_name,
2425
+ )
2426
+
2427
+
2428
+ def import_module(
2429
+ package_name: str,
2430
+ module_name: str = None,
2431
+ import_name: str | list = None,
2432
+ ) -> Any:
2433
+ """
2434
+ Import a module by its path.
2435
+
2436
+ Args:
2437
+ module_path: The path of the module to import.
2438
+
2439
+ Returns:
2440
+ The imported module.
2441
+
2442
+ Raises:
2443
+ ImportError: If the module cannot be imported.
2444
+ """
2445
+ try:
2446
+ full_import_path = (
2447
+ f"{package_name}.{module_name}" if module_name else package_name
2448
+ )
2449
+
2450
+ if import_name:
2451
+ import_name = (
2452
+ [import_name]
2453
+ if not isinstance(import_name, list)
2454
+ else import_name
2455
+ )
2456
+ a = __import__(
2457
+ full_import_path,
2458
+ fromlist=import_name,
2459
+ )
2460
+ if len(import_name) == 1:
2461
+ return getattr(a, import_name[0])
2462
+ return [getattr(a, name) for name in import_name]
2463
+ else:
2464
+ return __import__(full_import_path)
2465
+
2466
+ except ImportError as e:
2467
+ raise ImportError(
2468
+ f"Failed to import module {full_import_path}: {e}"
2469
+ ) from e
2470
+
2471
+
2472
+ def install_import(
2473
+ package_name: str,
2474
+ module_name: str | None = None,
2475
+ import_name: str | None = None,
2476
+ pip_name: str | None = None,
2477
+ ):
2478
+ """
2479
+ Attempt to import a package, installing it if not found.
2480
+
2481
+ Args:
2482
+ package_name: The name of the package to import.
2483
+ module_name: The specific module to import (if any).
2484
+ import_name: The specific name to import from the module (if any).
2485
+ pip_name: The name to use for pip installation (if different).
2486
+
2487
+ Raises:
2488
+ ImportError: If the package cannot be imported or installed.
2489
+ subprocess.CalledProcessError: If pip installation fails.
2490
+ """
2491
+ pip_name = pip_name or package_name
2492
+
2493
+ try:
2494
+ return import_module(
2495
+ package_name=package_name,
2496
+ module_name=module_name,
2497
+ import_name=import_name,
2498
+ )
2499
+ except ImportError:
2500
+ logging.info(f"Installing {pip_name}...")
2501
+ try:
2502
+ run_package_manager_command(["install", pip_name])
2503
+ return import_module(
2504
+ package_name=package_name,
2505
+ module_name=module_name,
2506
+ import_name=import_name,
2507
+ )
2508
+ except subprocess.CalledProcessError as e:
2509
+ raise ImportError(f"Failed to install {pip_name}: {e}") from e
2510
+ except ImportError as e:
2511
+ raise ImportError(
2512
+ f"Failed to import {pip_name} after installation: {e}"
2513
+ ) from e
2514
+
2515
+
2516
+ def is_import_installed(package_name: str) -> bool:
2517
+ """
2518
+ Check if a package is installed.
2519
+
2520
+ Args:
2521
+ package_name: The name of the package to check.
2522
+
2523
+ Returns:
2524
+ bool: True if the package is installed, False otherwise.
2525
+ """
2526
+ return importlib.util.find_spec(package_name) is not None
2527
+
2528
+
2529
+ def read_image_to_base64(image_path: str | Path) -> str:
2530
+ import base64
2531
+
2532
+ import cv2
2533
+
2534
+ image_path = str(image_path)
2535
+ image = cv2.imread(image_path, cv2.COLOR_BGR2RGB)
2536
+
2537
+ if image is None:
2538
+ raise ValueError(f"Could not read image from path: {image_path}")
2539
+
2540
+ file_extension = "." + image_path.split(".")[-1]
2541
+
2542
+ success, buffer = cv2.imencode(file_extension, image)
2543
+ if not success:
2544
+ raise ValueError(f"Could not encode image to {file_extension} format.")
2545
+ encoded_image = base64.b64encode(buffer).decode("utf-8")
2546
+ return encoded_image
2547
+
2548
+
2549
+ def pdf_to_images(
2550
+ pdf_path: str, output_folder: str, dpi: int = 300, fmt: str = "jpeg"
2551
+ ) -> list:
2552
+ """
2553
+ Convert a PDF file into images, one image per page.
2554
+
2555
+ Args:
2556
+ pdf_path (str): Path to the input PDF file.
2557
+ output_folder (str): Directory to save the output images.
2558
+ dpi (int): Dots per inch (resolution) for conversion (default: 300).
2559
+ fmt (str): Image format (default: 'jpeg'). Use 'png' if preferred.
2560
+
2561
+ Returns:
2562
+ list: A list of file paths for the saved images.
2563
+ """
2564
+ import os
2565
+
2566
+ convert_from_path = check_import(
2567
+ "pdf2image", import_name="convert_from_path"
2568
+ )
2569
+
2570
+ # Ensure the output folder exists
2571
+ os.makedirs(output_folder, exist_ok=True)
2572
+
2573
+ # Convert PDF to a list of PIL Image objects
2574
+ images = convert_from_path(pdf_path, dpi=dpi)
2575
+
2576
+ saved_paths = []
2577
+ for i, image in enumerate(images):
2578
+ # Construct the output file name
2579
+ image_file = os.path.join(output_folder, f"page_{i+1}.{fmt}")
2580
+ image.save(image_file, fmt.upper())
2581
+ saved_paths.append(image_file)
2582
+
2583
+ return saved_paths
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.0"
1
+ __version__ = "0.10.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>
6
6
  License: Apache License
@@ -1,10 +1,10 @@
1
1
  lionagi/__init__.py,sha256=wg2mLxXbJ5pQKrRMIEoQ0_BlHrxjuR1zmc3SAYN7PBc,513
2
2
  lionagi/_class_registry.py,sha256=pfUO1DjFZIqr3OwnNMkFqL_fiEBrrf8-swkGmP_KDLE,3112
3
3
  lionagi/_errors.py,sha256=JlBTFJnRWtVYcRxKb7fWFiJHLbykl1E19mSJ8sXYVxg,455
4
- lionagi/_types.py,sha256=Wo_bGC11sKRkxLwYKJNfX47EOWOpJWUWaPCRmIgf3II,31
4
+ lionagi/_types.py,sha256=iDdYewsP9rDrM7QY19_NDTcWUk7swp8vnGCrloHMtUM,53
5
5
  lionagi/settings.py,sha256=W52mM34E6jXF3GyqCFzVREKZrmnUqtZm_BVDsUiDI_s,1627
6
- lionagi/utils.py,sha256=yMqt3dwIpPd84FyaT2saVJRwYS-Z4m6yP3IzSPwIWpY,72451
7
- lionagi/version.py,sha256=v4zmKjsKOPZbp6BrWoz7iK4ST0sdZdUh9bQSJmluZ5o,23
6
+ lionagi/utils.py,sha256=uLTJKl7aTnFXV6ehA6zwiwEB7G2nQYKsO2pZ6mqFzUk,78908
7
+ lionagi/version.py,sha256=A_AARqtxTOj_AQTpjpgOxNx-UOBio5wYFfZ2mrdMKfs,23
8
8
  lionagi/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  lionagi/adapters/adapter.py,sha256=aW7s1OKAdxHd8HBv2UcThn-r2Q08EyArssNyFobMLuA,3357
10
10
  lionagi/adapters/json_adapter.py,sha256=EJj0Jev46ZhU3ZMnlYwyzN2rLxjLCVrMDpHkEuggBvk,4561
@@ -15,13 +15,14 @@ lionagi/adapters/pandas_/csv_adapter.py,sha256=HWie6Jlt8nR-EVJC_zmCFilaWszLNuk7E
15
15
  lionagi/adapters/pandas_/excel_adapter.py,sha256=ZqRT2xF93NLKNyMp16ePNzwUN3ntNkUy1dO3nbsrfak,2287
16
16
  lionagi/adapters/pandas_/pd_dataframe_adapter.py,sha256=ULGZVhK5aaOuTrmFq4x5SiuDScYetyYYUHeL8Hh13Eg,2279
17
17
  lionagi/adapters/pandas_/pd_series_adapter.py,sha256=TX3cqFtgEip8JqVqkjdJYOu4PQGpW1yYU6POhvz8Jeg,1388
18
+ lionagi/fields/__init__.py,sha256=kaKavoiVZ_S49DHr2uPzN3KiX5AHFsUs5JzWUJkbz4c,593
19
+ lionagi/fields/action.py,sha256=iWSApCM77jS0Oc28lb7G601Etkp-yjx5U1hfI_FQgfA,5792
20
+ lionagi/fields/base.py,sha256=5CJc7j8kTTWzXwpYzkSAFzx4BglABfx3AElIATKB7bg,3857
21
+ lionagi/fields/file.py,sha256=gzR2rZF2rU76AJJLjdD6TUJCj9VKXPaAH_Ow4oCsTfQ,4124
22
+ lionagi/fields/instruct.py,sha256=sMbCxEv0HQLa31JkJDmdrWWEzIfeKbcmN2hYOehz3Q0,4773
23
+ lionagi/fields/reason.py,sha256=TY2zQbounGU4DGDhbBqBW-jJPuJHmcoePSCKLgJxaL0,1460
18
24
  lionagi/libs/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
19
25
  lionagi/libs/parse.py,sha256=JRS3bql0InHJqATnAatl-hQv4N--XXw4P77JHhTFnrc,1011
20
- lionagi/libs/fields/__init__.py,sha256=S1DTFKZI7X1pYj1lDFiB3pQZvJF5U5wKdYYZYIJmK7E,757
21
- lionagi/libs/fields/action.py,sha256=JFf77sbVfTBjTHm2uayE19pmiDrzdYOMmZwzOb4cDno,5851
22
- lionagi/libs/fields/file.py,sha256=MzfZ0F2xZai2S9fmXI-iRtR0mwxcxNkWnnV7rSCGFCY,4119
23
- lionagi/libs/fields/instruct.py,sha256=I91ePfwXZLbQuWxWF_rbVtqwvDSjtEALTWDBlIO_DtY,4827
24
- lionagi/libs/fields/reason.py,sha256=dC6-L-xXRJ8L5eBPkinGmjHx1lxAjOiwEu6AE2Qwznc,1753
25
26
  lionagi/libs/file/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
26
27
  lionagi/libs/file/chunk.py,sha256=XeVMwM33JF0X1W6udz_nhlb3DCevA_EK6A50Hn_e5SY,9300
27
28
  lionagi/libs/file/concat_files.py,sha256=FoI983oWFzp9VfFDP7kmbRb3t1CPe5F5LCtsux0ASAs,3089
@@ -40,7 +41,7 @@ lionagi/libs/nested/nset.py,sha256=vkLR970hSzj8xCk-Z3RNQMJL2x0uMHmx1pw0VZQx2T0,3
40
41
  lionagi/libs/nested/unflatten.py,sha256=lTON1LfCyhZ3xeTEdBiIONcHLQouPcBNARTbXzHZ03U,2618
41
42
  lionagi/libs/nested/utils.py,sha256=r8xuBpH0qQaHMnCqXPF6unIKzw-TqwVbq-ARooWRERo,6090
42
43
  lionagi/libs/package/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
43
- lionagi/libs/package/imports.py,sha256=RgcbaZ5I7c7zFa2XGY83yUaK2kxqxj4MQhlLZESwqmk,4999
44
+ lionagi/libs/package/imports.py,sha256=wg6Ip9dnW5rNPxINu-AT3XQLp1EQLaAFdehVZAVB140,424
44
45
  lionagi/libs/package/management.py,sha256=zgzZ1lNpUhunu_QExiobSYWlvBbR0EORXW4jrtV0wuE,1684
45
46
  lionagi/libs/package/params.py,sha256=4dJiuaTlnhho6OHmBv-02cHx89XRCjnKqpMhVRvTse8,1056
46
47
  lionagi/libs/package/system.py,sha256=UW8Y6tEPRCy_pBv_Q8CXJAIbuo7CJDDoWEDdnP0ixp4,564
@@ -88,32 +89,32 @@ lionagi/models/schema_model.py,sha256=ng4uxMameETlqdS2OInb2LpxTiynzmLL36gfHIzlwp
88
89
  lionagi/operations/__init__.py,sha256=2HExKTx2J3iKWsvS9YaF6i5SZgqcpAJkVmWbi2H5A5U,134
89
90
  lionagi/operations/manager.py,sha256=H7UY86PIxvxKdzJY9YVsWyJcqlwLWhVyvm4sYePH_uY,565
90
91
  lionagi/operations/types.py,sha256=fM8HphnbBifMzhoKKvdl3JxGCBHlEGPJEYkLWj9b7vE,704
91
- lionagi/operations/utils.py,sha256=8AoQvQ1mR05hQ4Dbi8_aW111n1Kca1yRlJ1hdhSLeoQ,1224
92
- lionagi/operations/ReAct/ReAct.py,sha256=h290viJMN88JZJzuatkOAYJzu8flc8kfTfXYyMDeFyg,13509
92
+ lionagi/operations/utils.py,sha256=Cl4HuWQ1nCGkTexwOtDx7fpEWMc2L3ZQMCqylRBDy74,1219
93
+ lionagi/operations/ReAct/ReAct.py,sha256=uoJnFMoPP1kzzmgLDFNBwEbWdfGNfG37IT22N1AM-hE,13504
93
94
  lionagi/operations/ReAct/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
94
95
  lionagi/operations/ReAct/utils.py,sha256=84Giel5ToqfbN5F6Tm0uw8yZTTnxiM_jWuFEhnKOxM8,3800
95
96
  lionagi/operations/_act/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
96
- lionagi/operations/_act/act.py,sha256=lBYZtXXyPgnrl8JNtD1wlkSLm3B1h8_QfC6-y3xZI_k,2816
97
+ lionagi/operations/_act/act.py,sha256=l1-mrOoWLP0reATBD4PTqGyuSUSH41sL6YbfzzFfJMk,2811
97
98
  lionagi/operations/brainstorm/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
98
- lionagi/operations/brainstorm/brainstorm.py,sha256=sORt3tb_SHwdnYlHwqnVShYyYo83S7RWfNPkryLA-vw,18706
99
+ lionagi/operations/brainstorm/brainstorm.py,sha256=N9LpFZCdYn8L8AnTFOoMnjK7nkFrjgrfj2Vhz759dXM,18701
99
100
  lionagi/operations/brainstorm/prompt.py,sha256=Dqi4NNeztdI4iutggRqjnOrG4a4E2JtwIAtRnjZ_ghQ,610
100
101
  lionagi/operations/chat/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
101
102
  lionagi/operations/chat/chat.py,sha256=xJAH2H0zyVvxiL3XtW3MC6YrwCCB1uCkwcQIJ1YsIOk,5466
102
103
  lionagi/operations/communicate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
104
  lionagi/operations/communicate/communicate.py,sha256=dPaPqg898biY6j_FlgH4HEJxTK6T_87ixXWhD6kbk40,3077
104
105
  lionagi/operations/instruct/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
105
- lionagi/operations/instruct/instruct.py,sha256=wsjDpHbxlEoboWZ3b7Y-Xq_36Y6B9-8QgpNllq3fdPE,799
106
+ lionagi/operations/instruct/instruct.py,sha256=7pxhyP5jxwpgqjmQNb1rnGF4QAVlbMENpsyl22mbKRM,794
106
107
  lionagi/operations/interpret/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
107
108
  lionagi/operations/interpret/interpret.py,sha256=8_F3oYaoYK8MDcK4iCwksBP7sI0UlgBiZSrUusdlKNo,1528
108
109
  lionagi/operations/operate/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
109
- lionagi/operations/operate/operate.py,sha256=a87Jg1aNevb2P5N-12GriV5c_4TQq2hvY49mOl0VeVk,7363
110
+ lionagi/operations/operate/operate.py,sha256=cMc-n_uBPC8L8URIHHdR9N2LiwFlOiVv8yazmrFxX8g,7358
110
111
  lionagi/operations/parse/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
111
112
  lionagi/operations/parse/parse.py,sha256=Jvne8zuOqsgyXBxlH08EEEl-gb8-zkxvbihcwWKBW68,3295
112
113
  lionagi/operations/plan/__init__.py,sha256=yGBPll6lOqVjadbTvDLGrTlMx3FfBW-e00z7AMvg7Uo,156
113
- lionagi/operations/plan/plan.py,sha256=7Cfhmqx1JTPdS1nRlo5dYuXH_Jiz7DSDhj3a6mSzENs,15310
114
+ lionagi/operations/plan/plan.py,sha256=ndExZm_kE04i6npJq1rhyRdKaoXWpVk3F-dEN59I_94,15305
114
115
  lionagi/operations/plan/prompt.py,sha256=GUNZ8RpHIa89D-_y7GK--Spg0JADI3K13sjf_w3a2mI,993
115
116
  lionagi/operations/select/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
116
- lionagi/operations/select/select.py,sha256=obdu4rvNHv32ezaKawf5KBQjRG6vmSs8-QnKRGh8YXg,2496
117
+ lionagi/operations/select/select.py,sha256=2l16ySPiqp5vyAMYm0CNBpNRVB0zvS76QwNAyFQ7tB4,2491
117
118
  lionagi/operations/select/utils.py,sha256=Lh7oERHgdkNawG07BhvPcoi0fsdnQUDaz114iH7xzWE,3713
118
119
  lionagi/operations/translate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
120
  lionagi/operations/translate/translate.py,sha256=6eBVoQRarGEJ8Tfcl6Z__PLHQTTIbM5MaPVYNeKHRIs,1397
@@ -122,7 +123,7 @@ lionagi/protocols/_concepts.py,sha256=ZBN5OYpLMWLrl9uZqSg9GD4uwf60V4VHcxRnBTRWIR
122
123
  lionagi/protocols/types.py,sha256=bdnGl_oIlN-2J49MC-MqmcS5HeVZXOuBEW4SJnm4mLg,2454
123
124
  lionagi/protocols/action/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
124
125
  lionagi/protocols/action/function_calling.py,sha256=rfuzIowjJpyqO5Ynfs5fGnxsDIU5aKinTj1NI6bGlEU,5106
125
- lionagi/protocols/action/manager.py,sha256=PgnkpUTqOx9oMWwH0GbS9NVHhkoxb69M8YSI7sN_Q0Q,8549
126
+ lionagi/protocols/action/manager.py,sha256=XmdQIaVgSpmFBFW9kbW_rdwdQmlBteP4VRanxh_f918,8549
126
127
  lionagi/protocols/action/tool.py,sha256=h2FAY1b8y3LXrvAtfFhvdv1nu8cwz2knUeRCi2G9k1E,5243
127
128
  lionagi/protocols/forms/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
128
129
  lionagi/protocols/forms/base.py,sha256=1J8UU2LXm1Lax5McJos0xjZTzMVLYQWd_hwtxI2wSuM,2838
@@ -164,7 +165,7 @@ lionagi/protocols/messages/templates/system_message.jinja2,sha256=JRKJ0aFpYfaXSF
164
165
  lionagi/protocols/messages/templates/tool_schemas.jinja2,sha256=ozIaSDCRjIAhLyA8VM6S-YqS0w2NcctALSwx4LjDwII,126
165
166
  lionagi/protocols/operatives/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
166
167
  lionagi/protocols/operatives/operative.py,sha256=PXEMzD6tFM5PPK9kkPaSb7DBIzy7TNC3f2evuGhWhpg,6677
167
- lionagi/protocols/operatives/step.py,sha256=67BZb1jl_0x0TIqaKbElz9goQexXBFt87BTmfGy-v5g,9782
168
+ lionagi/protocols/operatives/step.py,sha256=AXXRhjsbWqkoMDQ_JyqsfQItQsjBJmldugJz36mA4N0,9772
168
169
  lionagi/service/__init__.py,sha256=DMGXIqPsmut9H5GT0ZeSzQIzYzzPwI-2gLXydpbwiV8,21
169
170
  lionagi/service/imodel.py,sha256=OaoEsL1SrltEqDR-dCDSKzEy2wF8BUNnCc-3fsJmESE,15289
170
171
  lionagi/service/manager.py,sha256=FkuqAtLErqLmXNnDtuAdTUFo4uuE_VL660BBGBhzInU,1435
@@ -196,9 +197,9 @@ lionagi/service/providers/perplexity_/__init__.py,sha256=5y5joOZzfFWERl75auAcNcK
196
197
  lionagi/service/providers/perplexity_/chat_completions.py,sha256=O4MIS_3xIINGjkAZdlw0Bu_jAfBDR4VZA1F8JW2EU1M,1197
197
198
  lionagi/service/providers/perplexity_/models.py,sha256=Fm5NbmWMdFkDKS0Cec__bNvs3St27lgqxFbHKyNCLsw,4945
198
199
  lionagi/session/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
199
- lionagi/session/branch.py,sha256=izQcxLiF8A-C17mW9a_LNeOWwa3j4_ZcB-UKaNy5xvk,72699
200
+ lionagi/session/branch.py,sha256=-4VZJna20HrftkVJoYiEgCb4HrUlP6aBRA-XlrHageQ,69722
200
201
  lionagi/session/prompts.py,sha256=AhuHL19s0TijVZX3tMKUKMi6l88xeVdpkuEn2vJSRyU,3236
201
- lionagi/session/session.py,sha256=BUEk1DCwk3vMSdI97hleQJ--xQqgXFmVupxlnGn5qbo,9310
202
+ lionagi/session/session.py,sha256=4Rk5_DB9y-yaqyfQ9tHYOMUy_0HCgCoGqeSc2Y5riu0,9172
202
203
  lionagi/tools/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
203
204
  lionagi/tools/base.py,sha256=cld32pyjaTUdyiqZ8hNyJjWKAhcJ8RQNhgImI7R8b-E,1940
204
205
  lionagi/tools/types.py,sha256=XtJLY0m-Yi_ZLWhm0KycayvqMCZd--HxfQ0x9vFUYDE,230
@@ -219,7 +220,7 @@ lionagi/tools/file/writer.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,
219
220
  lionagi/tools/file/providers/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
220
221
  lionagi/tools/file/providers/docling_.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
221
222
  lionagi/tools/query/__init__.py,sha256=5y5joOZzfFWERl75auAcNcKC3lImVJ5ZZGvvHZUFCJM,112
222
- lionagi-0.10.0.dist-info/METADATA,sha256=lJNFj2CynFHtdsEKL1cQB0b2tVmxbdfl4mywfQQTeo8,18464
223
- lionagi-0.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
224
- lionagi-0.10.0.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
225
- lionagi-0.10.0.dist-info/RECORD,,
223
+ lionagi-0.10.2.dist-info/METADATA,sha256=Z0QWQpl1aCFgNhWCem5QNx5BJmYPOG_gXyDpiiLQW3E,18464
224
+ lionagi-0.10.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
225
+ lionagi-0.10.2.dist-info/licenses/LICENSE,sha256=VXFWsdoN5AAknBCgFqQNgPWYx7OPp-PFEP961zGdOjc,11288
226
+ lionagi-0.10.2.dist-info/RECORD,,
@@ -1,36 +0,0 @@
1
- from .action import (
2
- ACTION_REQUESTS_FIELD,
3
- ACTION_REQUIRED_FIELD,
4
- ACTION_RESPONSES_FIELD,
5
- ActionRequestModel,
6
- ActionResponseModel,
7
- )
8
- from .file import (
9
- CODE_FILE_FIELD,
10
- DOCUMENTATION_FIELD,
11
- FILE_FIELD,
12
- CodeFile,
13
- Documentation,
14
- File,
15
- )
16
- from .instruct import INSTRUCT_FIELD, Instruct, InstructResponse
17
- from .reason import REASON_FIELD, Reason
18
-
19
- __all__ = (
20
- "ActionRequestModel",
21
- "ActionResponseModel",
22
- "ACTION_REQUESTS_FIELD",
23
- "ACTION_REQUIRED_FIELD",
24
- "ACTION_RESPONSES_FIELD",
25
- "File",
26
- "Documentation",
27
- "CodeFile",
28
- "CODE_FILE_FIELD",
29
- "DOCUMENTATION_FIELD",
30
- "FILE_FIELD",
31
- "Instruct",
32
- "InstructResponse",
33
- "INSTRUCT_FIELD",
34
- "Reason",
35
- "REASON_FIELD",
36
- )