lionagi 0.9.19__py3-none-any.whl → 0.10.0__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/__init__.py +0 -7
- lionagi/_types.py +0 -1
- lionagi/libs/fields/__init__.py +36 -0
- lionagi/libs/fields/action.py +190 -0
- lionagi/libs/fields/file.py +135 -0
- lionagi/{operatives/instruct → libs/fields}/instruct.py +9 -9
- lionagi/{operatives/instruct → libs/fields}/reason.py +28 -49
- lionagi/libs/schema/function_to_schema.py +1 -1
- lionagi/models/__init__.py +19 -0
- lionagi/models/hashable_model.py +24 -0
- lionagi/{operatives/models → models}/operable_model.py +2 -1
- lionagi/{operatives/models → models}/schema_model.py +1 -1
- lionagi/operations/ReAct/ReAct.py +2 -3
- lionagi/operations/_act/act.py +2 -7
- lionagi/operations/brainstorm/brainstorm.py +1 -1
- lionagi/operations/instruct/instruct.py +1 -1
- lionagi/operations/operate/operate.py +6 -5
- lionagi/operations/parse/parse.py +1 -1
- lionagi/operations/plan/plan.py +1 -1
- lionagi/operations/select/select.py +1 -1
- lionagi/operations/utils.py +1 -1
- lionagi/{operatives → protocols}/action/function_calling.py +4 -1
- lionagi/{operatives → protocols}/action/manager.py +2 -9
- lionagi/{operatives → protocols}/action/tool.py +1 -6
- lionagi/{operatives → protocols}/forms/base.py +8 -2
- lionagi/{operatives → protocols}/forms/flow.py +6 -1
- lionagi/{operatives → protocols}/forms/form.py +6 -1
- lionagi/{operatives → protocols}/forms/report.py +7 -3
- lionagi/protocols/generic/pile.py +9 -5
- lionagi/protocols/graph/node.py +8 -4
- lionagi/protocols/mail/exchange.py +0 -6
- lionagi/protocols/mail/mail.py +0 -6
- lionagi/protocols/mail/mailbox.py +0 -5
- lionagi/protocols/mail/manager.py +0 -5
- lionagi/protocols/mail/package.py +0 -6
- lionagi/protocols/messages/action_request.py +0 -6
- lionagi/protocols/messages/action_response.py +0 -5
- lionagi/protocols/messages/assistant_response.py +0 -4
- lionagi/protocols/messages/base.py +0 -6
- lionagi/protocols/messages/instruction.py +0 -5
- lionagi/protocols/messages/manager.py +0 -6
- lionagi/protocols/messages/message.py +0 -5
- lionagi/protocols/messages/system.py +0 -5
- lionagi/{operatives → protocols/operatives}/operative.py +1 -3
- lionagi/{operatives → protocols/operatives}/step.py +5 -7
- lionagi/protocols/types.py +36 -21
- lionagi/service/endpoints/base.py +1 -1
- lionagi/service/endpoints/rate_limited_processor.py +1 -1
- lionagi/service/providers/ollama_/chat_completions.py +2 -2
- lionagi/session/branch.py +9 -10
- lionagi/session/session.py +24 -8
- lionagi/tools/base.py +1 -1
- lionagi/tools/file/reader.py +1 -1
- lionagi/utils.py +0 -22
- lionagi/version.py +1 -1
- {lionagi-0.9.19.dist-info → lionagi-0.10.0.dist-info}/METADATA +1 -1
- {lionagi-0.9.19.dist-info → lionagi-0.10.0.dist-info}/RECORD +75 -90
- lionagi/operatives/action/request_response_model.py +0 -121
- lionagi/operatives/action/utils.py +0 -147
- lionagi/operatives/instruct/__init__.py +0 -3
- lionagi/operatives/instruct/base.py +0 -81
- lionagi/operatives/instruct/instruct_collection.py +0 -52
- lionagi/operatives/instruct/node.py +0 -13
- lionagi/operatives/instruct/prompts.py +0 -51
- lionagi/operatives/manager.py +0 -9
- lionagi/operatives/models/__init__.py +0 -3
- lionagi/operatives/strategies/__init__.py +0 -3
- lionagi/operatives/strategies/base.py +0 -56
- lionagi/operatives/strategies/concurrent.py +0 -75
- lionagi/operatives/strategies/concurrent_chunk.py +0 -46
- lionagi/operatives/strategies/concurrent_sequential_chunk.py +0 -108
- lionagi/operatives/strategies/params.py +0 -151
- lionagi/operatives/strategies/sequential.py +0 -27
- lionagi/operatives/strategies/sequential_chunk.py +0 -93
- lionagi/operatives/strategies/sequential_concurrent_chunk.py +0 -105
- lionagi/operatives/strategies/utils.py +0 -52
- lionagi/operatives/types.py +0 -72
- /lionagi/{protocols/adapters → adapters}/__init__.py +0 -0
- /lionagi/{protocols/adapters → adapters}/adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/json_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/pandas_/__init__.py +0 -0
- /lionagi/{protocols/adapters → adapters}/pandas_/csv_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/pandas_/excel_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/pandas_/pd_dataframe_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/pandas_/pd_series_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/toml_adapter.py +0 -0
- /lionagi/{protocols/adapters → adapters}/types.py +0 -0
- /lionagi/{operatives/models → models}/field_model.py +0 -0
- /lionagi/{operatives/models → models}/model_params.py +0 -0
- /lionagi/{operatives/models → models}/note.py +0 -0
- /lionagi/{operatives → protocols/action}/__init__.py +0 -0
- /lionagi/{operatives/action → protocols/forms}/__init__.py +0 -0
- /lionagi/{operatives/forms → protocols/operatives}/__init__.py +0 -0
- {lionagi-0.9.19.dist-info → lionagi-0.10.0.dist-info}/WHEEL +0 -0
- {lionagi-0.9.19.dist-info → lionagi-0.10.0.dist-info}/licenses/LICENSE +0 -0
@@ -7,15 +7,16 @@ from typing import TYPE_CHECKING, Literal
|
|
7
7
|
|
8
8
|
from pydantic import BaseModel, JsonValue
|
9
9
|
|
10
|
-
from lionagi.
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
from lionagi.libs.fields.instruct import Instruct
|
11
|
+
from lionagi.models import FieldModel, ModelParams
|
12
|
+
from lionagi.protocols.types import (
|
13
|
+
Instruction,
|
14
14
|
Operative,
|
15
|
+
Progression,
|
16
|
+
SenderRecipient,
|
15
17
|
Step,
|
16
18
|
ToolRef,
|
17
19
|
)
|
18
|
-
from lionagi.protocols.types import Instruction, Progression, SenderRecipient
|
19
20
|
from lionagi.service.imodel import iModel
|
20
21
|
|
21
22
|
if TYPE_CHECKING:
|
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Any, Literal
|
|
7
7
|
from pydantic import BaseModel
|
8
8
|
|
9
9
|
from lionagi.libs.validate.fuzzy_validate_mapping import fuzzy_validate_mapping
|
10
|
-
from lionagi.
|
10
|
+
from lionagi.protocols.types import Operative
|
11
11
|
from lionagi.utils import breakdown_pydantic_annotation
|
12
12
|
|
13
13
|
if TYPE_CHECKING:
|
lionagi/operations/plan/plan.py
CHANGED
lionagi/operations/utils.py
CHANGED
@@ -8,9 +8,9 @@ from typing import Any
|
|
8
8
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
9
9
|
from typing_extensions import Self
|
10
10
|
|
11
|
-
from lionagi.protocols.generic.event import Event, EventStatus
|
12
11
|
from lionagi.utils import is_coro_func
|
13
12
|
|
13
|
+
from ..generic.event import Event, EventStatus
|
14
14
|
from .tool import Tool
|
15
15
|
|
16
16
|
|
@@ -145,3 +145,6 @@ class FunctionCalling(Event):
|
|
145
145
|
dict_["function"] = self.function
|
146
146
|
dict_["arguments"] = self.arguments
|
147
147
|
return dict_
|
148
|
+
|
149
|
+
|
150
|
+
# File: lionagi/protocols/action/function_calling.py
|
@@ -2,21 +2,14 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `ActionManager` class, a specialized Manager that registers
|
7
|
-
`Tool` objects (or callables) for function invocation. It can match
|
8
|
-
incoming requests (ActionRequest) to a registered tool, then run it.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from typing import Any
|
12
6
|
|
13
7
|
from lionagi.protocols._concepts import Manager
|
14
|
-
from lionagi.protocols.generic.event import Execution
|
15
8
|
from lionagi.protocols.messages.action_request import ActionRequest
|
16
9
|
from lionagi.utils import to_list
|
17
10
|
|
11
|
+
from ...libs.fields.action import ActionRequestModel
|
18
12
|
from .function_calling import FunctionCalling
|
19
|
-
from .request_response_model import ActionRequestModel
|
20
13
|
from .tool import FuncTool, FuncToolRef, Tool, ToolRef
|
21
14
|
|
22
15
|
__all__ = ("ActionManager",)
|
@@ -255,4 +248,4 @@ class ActionManager(Manager):
|
|
255
248
|
|
256
249
|
__all__ = ["ActionManager"]
|
257
250
|
|
258
|
-
# File: lionagi/
|
251
|
+
# File: lionagi/protocols/action/manager.py
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `Tool` class, which wraps a Python callable (function/method)
|
7
|
-
with optional pre/post-processing and schema auto-generation. Also includes
|
8
|
-
type aliases for function references.
|
9
|
-
"""
|
10
5
|
|
11
6
|
import inspect
|
12
7
|
from collections.abc import Callable
|
@@ -177,4 +172,4 @@ def func_to_tool(func: Callable[..., Any], **kwargs) -> Tool:
|
|
177
172
|
return Tool(func_callable=func, **kwargs)
|
178
173
|
|
179
174
|
|
180
|
-
# File: lionagi/
|
175
|
+
# File: lionagi/protocols/action/tool.py
|
@@ -1,13 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
4
|
|
3
5
|
from typing import Any, Literal
|
4
6
|
|
5
7
|
from pydantic import ConfigDict, Field
|
6
8
|
from pydantic_core import PydanticUndefined
|
7
9
|
|
8
|
-
from lionagi.protocols.generic.element import Element
|
9
10
|
from lionagi.utils import UNDEFINED
|
10
11
|
|
12
|
+
from ..generic.element import Element
|
13
|
+
|
11
14
|
|
12
15
|
class BaseForm(Element):
|
13
16
|
"""
|
@@ -78,3 +81,6 @@ class BaseForm(Element):
|
|
78
81
|
continue
|
79
82
|
results[f] = val
|
80
83
|
return results
|
84
|
+
|
85
|
+
|
86
|
+
# File: lionagi/protocols/forms/base.py
|
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
4
|
|
3
5
|
from pydantic import BaseModel, ConfigDict, Field
|
4
6
|
|
@@ -71,3 +73,6 @@ class FlowDefinition(BaseModel):
|
|
71
73
|
for st in self.steps:
|
72
74
|
result.update(st.outputs)
|
73
75
|
return result
|
76
|
+
|
77
|
+
|
78
|
+
# File: lionagi/protocols/forms/flow.py
|
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
4
|
|
3
5
|
from typing import Any
|
4
6
|
|
@@ -80,3 +82,6 @@ class Form(BaseForm):
|
|
80
82
|
"task": self.task,
|
81
83
|
"required_outputs": self.output_fields,
|
82
84
|
}
|
85
|
+
|
86
|
+
|
87
|
+
# File: lionagi/protocols/forms/form.py
|
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
4
|
|
3
5
|
from pydantic import Field
|
4
6
|
|
5
|
-
from
|
6
|
-
|
7
|
+
from ..generic.pile import Pile
|
7
8
|
from .base import BaseForm
|
8
9
|
from .form import Form
|
9
10
|
|
@@ -43,3 +44,6 @@ class Report(BaseForm):
|
|
43
44
|
for f_ in form.output_fields:
|
44
45
|
val = getattr(form, f_, None)
|
45
46
|
setattr(self, f_, val)
|
47
|
+
|
48
|
+
|
49
|
+
# File: lionagi/protocols/forms/report.py
|
@@ -24,14 +24,18 @@ from pydantic.fields import FieldInfo
|
|
24
24
|
from typing_extensions import Self, override
|
25
25
|
|
26
26
|
from lionagi._errors import ItemExistsError, ItemNotFoundError
|
27
|
+
from lionagi.adapters.types import (
|
28
|
+
Adapter,
|
29
|
+
AdapterRegistry,
|
30
|
+
CSVFileAdapter,
|
31
|
+
ExcelFileAdapter,
|
32
|
+
JsonAdapter,
|
33
|
+
JsonFileAdapter,
|
34
|
+
PandasDataFrameAdapter,
|
35
|
+
)
|
27
36
|
from lionagi.utils import UNDEFINED, is_same_dtype, to_list
|
28
37
|
|
29
38
|
from .._concepts import Observable
|
30
|
-
from ..adapters.adapter import Adapter, AdapterRegistry
|
31
|
-
from ..adapters.json_adapter import JsonAdapter, JsonFileAdapter
|
32
|
-
from ..adapters.pandas_.csv_adapter import CSVFileAdapter
|
33
|
-
from ..adapters.pandas_.excel_adapter import ExcelFileAdapter
|
34
|
-
from ..adapters.pandas_.pd_dataframe_adapter import PandasDataFrameAdapter
|
35
39
|
from .element import ID, Collective, E, Element, IDType, validate_order
|
36
40
|
from .progression import Progression
|
37
41
|
|
lionagi/protocols/graph/node.py
CHANGED
@@ -8,12 +8,16 @@ from typing import Any, ClassVar
|
|
8
8
|
from pydantic import field_validator
|
9
9
|
|
10
10
|
from lionagi._class_registry import LION_CLASS_REGISTRY
|
11
|
+
from lionagi.adapters.types import (
|
12
|
+
AdapterRegistry,
|
13
|
+
JsonAdapter,
|
14
|
+
JsonFileAdapter,
|
15
|
+
PandasSeriesAdapter,
|
16
|
+
TomlAdapter,
|
17
|
+
TomlFileAdapter,
|
18
|
+
)
|
11
19
|
|
12
20
|
from .._concepts import Relational
|
13
|
-
from ..adapters.adapter import AdapterRegistry
|
14
|
-
from ..adapters.json_adapter import JsonAdapter, JsonFileAdapter
|
15
|
-
from ..adapters.pandas_.pd_series_adapter import PandasSeriesAdapter
|
16
|
-
from ..adapters.toml_adapter import TomlAdapter, TomlFileAdapter
|
17
21
|
from ..generic.element import Element
|
18
22
|
|
19
23
|
NODE_DEFAULT_ADAPTERS = (
|
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Provides the `Exchange` class, which orchestrates mail flows among
|
7
|
-
sources that implement `Communicatable`. It collects pending outgoing
|
8
|
-
mail from each source and delivers them to the appropriate recipients.
|
9
|
-
"""
|
10
|
-
|
11
5
|
import asyncio
|
12
6
|
from typing import Any
|
13
7
|
|
lionagi/protocols/mail/mail.py
CHANGED
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `Mail` class, which is a `Sendable` element representing
|
7
|
-
a single piece of mail, carrying a `Package` between a sender
|
8
|
-
and recipient.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from pydantic import field_validator
|
12
6
|
|
13
7
|
from .._concepts import Sendable
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Implements a simple mailbox system for each Communicatable entity.
|
7
|
-
Holds inbound and outbound mail, stored internally in a `Pile`.
|
8
|
-
"""
|
9
|
-
|
10
5
|
from lionagi.protocols.generic.element import IDType
|
11
6
|
|
12
7
|
from ..generic.pile import Pile, Progression
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `MailManager` class, which coordinates mail operations
|
7
|
-
across multiple sources in a more abstract or high-level manner.
|
8
|
-
"""
|
9
|
-
|
10
5
|
import asyncio
|
11
6
|
from collections import deque
|
12
7
|
from typing import Any
|
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines `Package` and `PackageCategory`, encapsulating the contents
|
7
|
-
and classification of mail items. Also includes a simple validator
|
8
|
-
to ensure categories are valid.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from enum import Enum
|
12
6
|
from typing import Any
|
13
7
|
|
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `ActionRequest` class, a specific `RoledMessage` for requesting
|
7
|
-
a function or action call within LionAGI. It is typically accompanied by
|
8
|
-
arguments and can later be answered by an `ActionResponse`.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from collections.abc import Callable
|
12
6
|
from typing import Any
|
13
7
|
|
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Holds foundational enumerations and types for messages, including
|
7
|
-
roles like `SYSTEM`, `USER`, and helper functions for validating
|
8
|
-
sender/recipient fields.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from enum import Enum
|
12
6
|
from typing import Any, TypeAlias
|
13
7
|
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `Instruction` class, representing user commands or instructions
|
7
|
-
sent to the system. Supports optional context, images, and schema requests.
|
8
|
-
"""
|
9
|
-
|
10
5
|
from typing import Any, Literal
|
11
6
|
|
12
7
|
from pydantic import BaseModel, JsonValue, field_serializer
|
@@ -2,12 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Implements the `MessageManager` class, a manager for collecting or
|
7
|
-
manipulating sequences of `RoledMessage` objects, including system,
|
8
|
-
instructions, or action requests/responses.
|
9
|
-
"""
|
10
|
-
|
11
5
|
from typing import Any, Literal
|
12
6
|
|
13
7
|
from jinja2 import Template
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Implements the `RoledMessage` base for system, user, assistant,
|
7
|
-
and action messages, plus Jinja2 environment and template loading.
|
8
|
-
"""
|
9
|
-
|
10
5
|
import json
|
11
6
|
from pathlib import Path
|
12
7
|
from typing import Any
|
@@ -2,11 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
-
"""
|
6
|
-
Defines the `System` class, representing system-level instructions or
|
7
|
-
settings that guide the AI's behavior from a privileged role.
|
8
|
-
"""
|
9
|
-
|
10
5
|
from datetime import datetime
|
11
6
|
from typing import Any, NoReturn
|
12
7
|
|
@@ -7,11 +7,9 @@ from pydantic.fields import FieldInfo
|
|
7
7
|
from typing_extensions import Self
|
8
8
|
|
9
9
|
from lionagi.libs.validate.fuzzy_match_keys import fuzzy_match_keys
|
10
|
-
from lionagi.
|
10
|
+
from lionagi.models import FieldModel, ModelParams, SchemaModel
|
11
11
|
from lionagi.utils import UNDEFINED, to_json
|
12
12
|
|
13
|
-
from .models.model_params import FieldModel, ModelParams
|
14
|
-
|
15
13
|
|
16
14
|
class Operative(SchemaModel):
|
17
15
|
"""Class representing an operative that handles request and response models for operations."""
|
@@ -5,18 +5,16 @@
|
|
5
5
|
from pydantic import BaseModel, Field
|
6
6
|
from pydantic.fields import FieldInfo
|
7
7
|
|
8
|
-
from lionagi.
|
9
|
-
from lionagi.operatives.operative import Operative
|
10
|
-
|
11
|
-
from .action.request_response_model import (
|
8
|
+
from lionagi.libs.fields.action import (
|
12
9
|
ACTION_REQUESTS_FIELD,
|
10
|
+
ACTION_REQUIRED_FIELD,
|
13
11
|
ACTION_RESPONSES_FIELD,
|
14
12
|
ActionRequestModel,
|
15
13
|
ActionResponseModel,
|
16
14
|
)
|
17
|
-
from .
|
18
|
-
from .models
|
19
|
-
from .
|
15
|
+
from lionagi.libs.fields.reason import REASON_FIELD, Reason
|
16
|
+
from lionagi.models import FieldModel, ModelParams
|
17
|
+
from lionagi.protocols.operatives.operative import Operative
|
20
18
|
|
21
19
|
|
22
20
|
class StepModel(BaseModel):
|
lionagi/protocols/types.py
CHANGED
@@ -13,7 +13,9 @@ from ._concepts import (
|
|
13
13
|
Relational,
|
14
14
|
Sendable,
|
15
15
|
)
|
16
|
-
from .
|
16
|
+
from .action.manager import ActionManager, FunctionCalling, Tool, ToolRef
|
17
|
+
from .forms.flow import FlowDefinition, FlowStep
|
18
|
+
from .forms.report import BaseForm, Form, Report
|
17
19
|
from .generic.element import ID, Element, IDError, IDType, validate_order
|
18
20
|
from .generic.event import Event, EventStatus, Execution
|
19
21
|
from .generic.log import Log, LogManager, LogManagerConfig
|
@@ -23,6 +25,7 @@ from .generic.progression import Progression, prog
|
|
23
25
|
from .graph.edge import EdgeCondition
|
24
26
|
from .graph.graph import Edge, Graph, Node
|
25
27
|
from .mail.exchange import Exchange, Mail, Mailbox, Package, PackageCategory
|
28
|
+
from .mail.manager import MailManager
|
26
29
|
from .messages.base import (
|
27
30
|
MESSAGE_FIELDS,
|
28
31
|
MessageField,
|
@@ -40,19 +43,20 @@ from .messages.manager import (
|
|
40
43
|
SenderRecipient,
|
41
44
|
System,
|
42
45
|
)
|
46
|
+
from .operatives.step import Operative, Step, StepModel
|
43
47
|
|
44
48
|
__all__ = (
|
49
|
+
"Collective",
|
50
|
+
"Communicatable",
|
51
|
+
"Condition",
|
52
|
+
"Manager",
|
45
53
|
"Observable",
|
46
54
|
"Observer",
|
47
|
-
"
|
55
|
+
"Ordering",
|
48
56
|
"Relational",
|
49
57
|
"Sendable",
|
50
|
-
"Communicatable",
|
51
|
-
"Condition",
|
52
|
-
"Collective",
|
53
|
-
"Ordering",
|
54
|
-
"Element",
|
55
58
|
"ID",
|
59
|
+
"Element",
|
56
60
|
"IDError",
|
57
61
|
"IDType",
|
58
62
|
"validate_order",
|
@@ -64,33 +68,44 @@ __all__ = (
|
|
64
68
|
"LogManagerConfig",
|
65
69
|
"Pile",
|
66
70
|
"pile",
|
67
|
-
"
|
71
|
+
"to_list_type",
|
68
72
|
"Executor",
|
73
|
+
"Processor",
|
69
74
|
"Progression",
|
70
75
|
"prog",
|
76
|
+
"EdgeCondition",
|
77
|
+
"Edge",
|
71
78
|
"Graph",
|
72
79
|
"Node",
|
73
|
-
"Edge",
|
74
|
-
"EdgeCondition",
|
75
80
|
"Exchange",
|
76
81
|
"Mail",
|
77
82
|
"Mailbox",
|
78
83
|
"Package",
|
79
84
|
"PackageCategory",
|
85
|
+
"MESSAGE_FIELDS",
|
86
|
+
"MessageField",
|
87
|
+
"MessageFlag",
|
88
|
+
"MessageRole",
|
89
|
+
"validate_sender_recipient",
|
80
90
|
"ActionRequest",
|
81
91
|
"ActionResponse",
|
82
|
-
"RoledMessage",
|
83
92
|
"AssistantResponse",
|
84
93
|
"Instruction",
|
85
|
-
"System",
|
86
|
-
"SenderRecipient",
|
87
|
-
"MessageRole",
|
88
|
-
"MessageFlag",
|
89
|
-
"MessageField",
|
90
|
-
"MESSAGE_FIELDS",
|
91
|
-
"validate_sender_recipient",
|
92
94
|
"MessageManager",
|
93
|
-
"
|
94
|
-
"
|
95
|
-
"
|
95
|
+
"RoledMessage",
|
96
|
+
"SenderRecipient",
|
97
|
+
"System",
|
98
|
+
"FlowDefinition",
|
99
|
+
"FlowStep",
|
100
|
+
"BaseForm",
|
101
|
+
"Form",
|
102
|
+
"Report",
|
103
|
+
"Operative",
|
104
|
+
"Step",
|
105
|
+
"StepModel",
|
106
|
+
"ActionManager",
|
107
|
+
"Tool",
|
108
|
+
"FunctionCalling",
|
109
|
+
"ToolRef",
|
110
|
+
"MailManager",
|
96
111
|
)
|
@@ -15,7 +15,7 @@ from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
15
15
|
from typing_extensions import Self
|
16
16
|
|
17
17
|
from lionagi._errors import ExecutionError, RateLimitError
|
18
|
-
from lionagi.protocols.
|
18
|
+
from lionagi.protocols.types import Event, EventStatus
|
19
19
|
from lionagi.settings import Settings
|
20
20
|
|
21
21
|
from .token_calculator import TokenCalculator
|
@@ -53,8 +53,8 @@ class OllamaChatCompletionEndPoint(ChatCompletionEndPoint):
|
|
53
53
|
check_import("openai")
|
54
54
|
check_import("ollama")
|
55
55
|
|
56
|
-
from ollama import list, pull
|
57
|
-
from openai import AsyncOpenAI
|
56
|
+
from ollama import list, pull # type: ignore
|
57
|
+
from openai import AsyncOpenAI # type: ignore
|
58
58
|
|
59
59
|
super().__init__(config)
|
60
60
|
self.client = AsyncOpenAI(
|
lionagi/session/branch.py
CHANGED
@@ -11,16 +11,15 @@ from jinja2 import Template
|
|
11
11
|
from pydantic import BaseModel, Field, JsonValue, PrivateAttr
|
12
12
|
|
13
13
|
from lionagi.libs.schema.as_readable import as_readable
|
14
|
-
from lionagi.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
)
|
14
|
+
from lionagi.models.field_model import FieldModel
|
15
|
+
from lionagi.models.model_params import ModelParams
|
16
|
+
from lionagi.protocols.action.manager import ActionManager
|
17
|
+
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
|
24
23
|
from lionagi.protocols.types import (
|
25
24
|
ID,
|
26
25
|
MESSAGE_FIELDS,
|