lionagi 0.5.0__py3-none-any.whl → 0.5.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.
Files changed (79) hide show
  1. lionagi/__init__.py +0 -1
  2. lionagi/core/action/tool.py +3 -5
  3. lionagi/core/communication/action_request.py +3 -3
  4. lionagi/core/communication/message.py +3 -3
  5. lionagi/core/communication/utils.py +3 -3
  6. lionagi/core/generic/component.py +4 -4
  7. lionagi/core/generic/element.py +51 -47
  8. lionagi/core/generic/graph.py +1 -1
  9. lionagi/core/generic/log.py +2 -2
  10. lionagi/core/generic/pile.py +10 -11
  11. lionagi/core/generic/progression.py +19 -12
  12. lionagi/core/generic/utils.py +6 -3
  13. lionagi/core/models/base.py +11 -68
  14. lionagi/core/models/field_model.py +42 -19
  15. lionagi/core/models/{new_model_params.py → model_params.py} +5 -6
  16. lionagi/core/models/note.py +2 -2
  17. lionagi/core/models/operable_model.py +8 -4
  18. lionagi/core/models/schema_model.py +9 -31
  19. lionagi/core/models/types.py +15 -6
  20. lionagi/core/session/branch.py +10 -7
  21. lionagi/core/session/branch_mixins.py +52 -15
  22. lionagi/core/session/session.py +1 -2
  23. lionagi/core/typing/__init__.py +4 -4
  24. lionagi/core/typing/{concepts.py → _concepts.py} +43 -2
  25. lionagi/core/typing/_id.py +104 -0
  26. lionagi/integrations/anthropic_/AnthropicModel.py +8 -3
  27. lionagi/integrations/anthropic_/AnthropicService.py +4 -0
  28. lionagi/integrations/groq_/GroqModel.py +11 -4
  29. lionagi/integrations/groq_/GroqService.py +4 -0
  30. lionagi/integrations/litellm_/imodel.py +10 -8
  31. lionagi/integrations/ollama_/OllamaService.py +4 -0
  32. lionagi/integrations/openai_/OpenAIModel.py +12 -3
  33. lionagi/integrations/openai_/image_token_calculator/image_token_calculator.py +14 -8
  34. lionagi/integrations/perplexity_/PerplexityModel.py +8 -3
  35. lionagi/integrations/perplexity_/PerplexityService.py +4 -0
  36. lionagi/libs/func/async_calls/__init__.py +6 -3
  37. lionagi/libs/func/async_calls/alcall.py +46 -0
  38. lionagi/libs/func/async_calls/bcall.py +49 -1
  39. lionagi/libs/func/async_calls/rcall.py +32 -0
  40. lionagi/libs/utils.py +12 -1
  41. lionagi/operations/brainstorm/brainstorm.py +3 -3
  42. lionagi/operations/plan/plan.py +3 -3
  43. lionagi/protocols/__init__.py +3 -0
  44. lionagi/protocols/configs/__init__.py +0 -15
  45. lionagi/protocols/configs/branch_config.py +1 -1
  46. lionagi/protocols/configs/imodel_config.py +2 -2
  47. lionagi/protocols/configs/log_config.py +1 -1
  48. lionagi/protocols/configs/types.py +15 -0
  49. lionagi/protocols/operatives/__init__.py +3 -15
  50. lionagi/protocols/operatives/action.py +4 -0
  51. lionagi/protocols/operatives/instruct.py +6 -2
  52. lionagi/protocols/operatives/operative.py +9 -21
  53. lionagi/protocols/operatives/prompts.py +4 -0
  54. lionagi/protocols/operatives/reason.py +4 -0
  55. lionagi/protocols/operatives/step.py +11 -23
  56. lionagi/protocols/operatives/types.py +19 -0
  57. lionagi/protocols/registries/__init__.py +3 -0
  58. lionagi/protocols/registries/_component_registry.py +4 -0
  59. lionagi/protocols/registries/_pile_registry.py +4 -0
  60. lionagi/service/__init__.py +3 -0
  61. lionagi/service/imodel.py +22 -7
  62. lionagi/service/service.py +4 -0
  63. lionagi/service/service_match_util.py +4 -4
  64. lionagi/settings.py +10 -18
  65. lionagi/strategies/base.py +4 -5
  66. lionagi/strategies/concurrent.py +4 -3
  67. lionagi/strategies/concurrent_chunk.py +3 -3
  68. lionagi/strategies/concurrent_sequential_chunk.py +3 -3
  69. lionagi/strategies/params.py +7 -4
  70. lionagi/version.py +1 -1
  71. {lionagi-0.5.0.dist-info → lionagi-0.5.2.dist-info}/METADATA +214 -15
  72. {lionagi-0.5.0.dist-info → lionagi-0.5.2.dist-info}/RECORD +77 -76
  73. lionagi/core/typing/config.py +0 -15
  74. lionagi/core/typing/id.py +0 -221
  75. /lionagi/core/typing/{pydantic_.py → _pydantic.py} +0 -0
  76. /lionagi/core/typing/{typing_.py → _typing.py} +0 -0
  77. /lionagi/integrations/{services.py → _services.py} +0 -0
  78. {lionagi-0.5.0.dist-info → lionagi-0.5.2.dist-info}/WHEEL +0 -0
  79. {lionagi-0.5.0.dist-info → lionagi-0.5.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  """Field definitions and validation for InstructModel components."""
2
6
 
3
7
  from typing import Any, ClassVar
@@ -169,7 +173,7 @@ class OperationInstruct(Instruct):
169
173
  return ACTIONS_FIELD.validator(cls, v)
170
174
 
171
175
 
172
- INSTRUCT_MODEL_FIELD = FieldModel(
176
+ INSTRUCT_FIELD_MODEL = FieldModel(
173
177
  name="instruct_models",
174
178
  annotation=list[Instruct],
175
179
  default_factory=list,
@@ -191,6 +195,6 @@ __all__ = [
191
195
  "REASON_FIELD",
192
196
  "ACTIONS_FIELD",
193
197
  "Instruct",
194
- "INSTRUCT_MODEL_FIELD",
198
+ "INSTRUCT_FIELD_MODEL",
195
199
  "InstructResponse",
196
200
  ]
@@ -1,25 +1,13 @@
1
- """
2
- Copyright 2024 HaiyangLi
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- """
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
16
4
 
17
5
  from typing import Self
18
6
 
19
7
  from pydantic import BaseModel, Field, PrivateAttr, model_validator
20
8
  from pydantic.fields import FieldInfo
21
9
 
22
- from lionagi.core.models import FieldModel, NewModelParams, OperableModel
10
+ from lionagi.core.models import FieldModel, ModelParams, OperableModel
23
11
  from lionagi.core.typing import UNDEFINED
24
12
  from lionagi.libs.parse import to_json, validate_keys
25
13
 
@@ -29,10 +17,10 @@ class Operative(OperableModel):
29
17
 
30
18
  name: str | None = None
31
19
 
32
- request_params: NewModelParams | None = Field(default=None)
20
+ request_params: ModelParams | None = Field(default=None)
33
21
  request_type: type[BaseModel] | None = Field(default=None)
34
22
 
35
- response_params: NewModelParams | None = Field(default=None)
23
+ response_params: ModelParams | None = Field(default=None)
36
24
  response_type: type[BaseModel] | None = Field(default=None)
37
25
  response_model: OperableModel | None = Field(default=None)
38
26
  response_str_dict: dict | str | None = Field(default=None)
@@ -140,7 +128,7 @@ class Operative(OperableModel):
140
128
 
141
129
  def create_response_type(
142
130
  self,
143
- response_params: NewModelParams | None = None,
131
+ response_params: ModelParams | None = None,
144
132
  field_models: list[FieldModel] | None = None,
145
133
  parameter_fields: dict[str, FieldInfo] | None = None,
146
134
  exclude_fields: list[str] | None = None,
@@ -154,7 +142,7 @@ class Operative(OperableModel):
154
142
  """Creates a new response type based on the provided parameters.
155
143
 
156
144
  Args:
157
- response_params (NewModelParams, optional): Parameters for the new response model.
145
+ response_params (ModelParams, optional): Parameters for the new response model.
158
146
  field_models (list[FieldModel], optional): List of field models.
159
147
  parameter_fields (dict[str, FieldInfo], optional): Dictionary of parameter fields.
160
148
  exclude_fields (list, optional): List of fields to exclude.
@@ -165,7 +153,7 @@ class Operative(OperableModel):
165
153
  frozen (bool, optional): Whether the model is frozen.
166
154
  validators (dict, optional): Dictionary of validators.
167
155
  """
168
- self.response_params = response_params or NewModelParams(
156
+ self.response_params = response_params or ModelParams(
169
157
  parameter_fields=parameter_fields,
170
158
  field_models=field_models,
171
159
  exclude_fields=exclude_fields,
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  from pydantic import JsonValue
2
6
 
3
7
  function_field_description = (
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  from pydantic import BaseModel, field_validator
2
6
 
3
7
  from lionagi.core.models import FieldModel
@@ -1,23 +1,11 @@
1
- """
2
- Copyright 2024 HaiyangLi
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- """
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
16
4
 
17
5
  from pydantic import BaseModel
18
6
  from pydantic.fields import FieldInfo
19
7
 
20
- from lionagi.core.typing import FieldModel, NewModelParams
8
+ from lionagi.core.typing import FieldModel, ModelParams
21
9
  from lionagi.protocols.operatives.operative import Operative
22
10
 
23
11
  from .action import (
@@ -54,7 +42,7 @@ class Step:
54
42
  operative_name: str | None = None,
55
43
  reason: bool = False,
56
44
  actions: bool = False,
57
- request_params: NewModelParams | None = None,
45
+ request_params: ModelParams | None = None,
58
46
  parameter_fields: dict[str, FieldInfo] | None = None,
59
47
  base_type: type[BaseModel] | None = None,
60
48
  field_models: list[FieldModel] | None = None,
@@ -72,7 +60,7 @@ class Step:
72
60
  operative_name (str, optional): Name of the operative.
73
61
  reason (bool, optional): Whether to include reason field.
74
62
  actions (bool, optional): Whether to include action fields.
75
- request_params (NewModelParams, optional): Parameters for the new model.
63
+ request_params (ModelParams, optional): Parameters for the new model.
76
64
  parameter_fields (dict[str, FieldInfo], optional): Parameter fields for the model.
77
65
  base_type (type[BaseModel], optional): Base type for the model.
78
66
  field_models (list[FieldModel], optional): List of field models.
@@ -100,7 +88,7 @@ class Step:
100
88
  ACTION_REQUIRED_FIELD,
101
89
  ]
102
90
  )
103
- request_params = request_params or NewModelParams(
91
+ request_params = request_params or ModelParams(
104
92
  parameter_fields=parameter_fields,
105
93
  base_type=base_type,
106
94
  field_models=field_models,
@@ -119,7 +107,7 @@ class Step:
119
107
  *,
120
108
  operative: Operative,
121
109
  additional_data: dict | None = None,
122
- response_params: NewModelParams | None = None,
110
+ response_params: ModelParams | None = None,
123
111
  field_models: list[FieldModel] | None = None,
124
112
  frozen_response: bool = False,
125
113
  response_config_dict: dict | None = None,
@@ -131,7 +119,7 @@ class Step:
131
119
  Args:
132
120
  operative (Operative): The operative instance to update.
133
121
  additional_data (dict | None, optional): Additional data to include in the response.
134
- response_params (NewModelParams | None, optional): Parameters for the response model.
122
+ response_params (ModelParams | None, optional): Parameters for the response model.
135
123
  field_models (list[FieldModel] | None, optional): List of field models.
136
124
  frozen_response (bool, optional): Whether the response model is frozen.
137
125
  response_config_dict (dict | None, optional): Configuration dictionary for the response.
@@ -162,7 +150,7 @@ class Step:
162
150
  @staticmethod
163
151
  def _create_response_type(
164
152
  operative: Operative,
165
- response_params: NewModelParams | None = None,
153
+ response_params: ModelParams | None = None,
166
154
  response_validators: dict | None = None,
167
155
  frozen_response: bool = False,
168
156
  response_config_dict: dict | None = None,
@@ -174,7 +162,7 @@ class Step:
174
162
 
175
163
  Args:
176
164
  operative (Operative): The operative instance.
177
- response_params (NewModelParams | None, optional): Parameters for the response model.
165
+ response_params (ModelParams | None, optional): Parameters for the response model.
178
166
  response_validators (dict | None, optional): Validators for the response model.
179
167
  frozen_response (bool, optional): Whether the response model is frozen.
180
168
  response_config_dict (dict | None, optional): Configuration dictionary for the response.
@@ -0,0 +1,19 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from .action import ActionRequestModel, ActionResponseModel
6
+ from .instruct import Instruct
7
+ from .operative import Operative
8
+ from .reason import ReasonModel
9
+ from .step import Step, StepModel
10
+
11
+ __all__: list[str] = [
12
+ "Operative",
13
+ "Step",
14
+ "ActionRequestModel",
15
+ "ActionResponseModel",
16
+ "StepModel",
17
+ "Instruct",
18
+ "ReasonModel",
19
+ ]
@@ -0,0 +1,3 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  from lionagi.protocols.adapters.adapter import AdapterRegistry
2
6
  from lionagi.protocols.adapters.json_adapter import (
3
7
  JsonAdapter,
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2023 - 2024, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  from lionagi.protocols.adapters.adapter import AdapterRegistry
2
6
  from lionagi.protocols.adapters.json_adapter import (
3
7
  JsonAdapter,
@@ -1,3 +1,5 @@
1
+ from lionagi.integrations.litellm_.imodel import LiteiModel
2
+
1
3
  from .imodel import iModel
2
4
  from .rate_limiter import RateLimiter, RateLimitError
3
5
  from .service import Service, register_service
@@ -10,4 +12,5 @@ __all__ = [
10
12
  "RateLimitError",
11
13
  "invoke_retry",
12
14
  "iModel",
15
+ "LiteiModel",
13
16
  ]
lionagi/service/imodel.py CHANGED
@@ -9,6 +9,7 @@ from lionagi.service.service_match_util import (
9
9
 
10
10
 
11
11
  class iModel:
12
+
12
13
  def __init__(
13
14
  self,
14
15
  provider: str | Service,
@@ -20,25 +21,34 @@ class iModel:
20
21
  interval_requests: int = None,
21
22
  **kwargs,
22
23
  ):
23
-
24
24
  if api_key is not None:
25
25
  api_key = api_key
26
26
  elif api_key_schema is not None:
27
27
  api_key = api_key_schema
28
28
 
29
- if api_key is None:
30
- if isinstance(provider, str):
29
+ if task == "chat":
30
+ match provider:
31
+ case "openai":
32
+ task = "create_chat_completion"
33
+ case "anthropic":
34
+ task = "create_message"
35
+ case "groq":
36
+ task = "create_chat_completion"
37
+ case "perplexity":
38
+ task = "create_chat_completion"
39
+
40
+ if isinstance(provider, str):
41
+ if api_key is None:
31
42
  match provider:
32
43
  case "openai":
33
44
  api_key = "OPENAI_API_KEY"
34
45
  case "anthropic":
35
46
  api_key = "ANTHROPIC_API_KEY"
36
- case "grok":
37
- api_key = "GROK_API_KEY"
47
+ case "groq":
48
+ api_key = "GROQ_API_KEY"
38
49
  case "perplexity":
39
- api_key = "PERPLEXITY_API_KEY"
50
+ api_key = "PERPLEXIY_API_KEY"
40
51
 
41
- if isinstance(provider, str):
42
52
  self.service = match_service(provider, api_key=api_key, **kwargs)
43
53
  elif isinstance(provider, Service):
44
54
  self.service = provider
@@ -80,6 +90,7 @@ class iModel:
80
90
  self.data_model = self.service.match_data_model(self.task)
81
91
 
82
92
  def parse_to_data_model(self, **kwargs):
93
+
83
94
  if kwargs.get("model") and self.model:
84
95
  if kwargs.get("model") != self.model:
85
96
  raise ValueError(
@@ -106,5 +117,9 @@ class iModel:
106
117
  def list_tasks(self):
107
118
  return self.service.list_tasks()
108
119
 
120
+ @property
121
+ def allowed_roles(self):
122
+ return self.service.allowed_roles
123
+
109
124
 
110
125
  __all__ = ["iModel"]
@@ -3,6 +3,10 @@ class Service:
3
3
  def list_tasks(self):
4
4
  pass
5
5
 
6
+ @property
7
+ def allowed_roles(self):
8
+ return ["user", "assistant", "system"]
9
+
6
10
 
7
11
  def register_service(cls):
8
12
  original_init = cls.__init__
@@ -19,7 +19,7 @@ def match_service(service_name: str, **kwargs):
19
19
  return key1 == key2
20
20
 
21
21
  if service_name == "openai":
22
- from lionagi.integrations.services import OpenAIService
22
+ from lionagi.integrations._services import OpenAIService
23
23
 
24
24
  api_key = kwargs.get("api_key")
25
25
  openai_organization = kwargs.get("openai_organization")
@@ -44,7 +44,7 @@ def match_service(service_name: str, **kwargs):
44
44
  )
45
45
 
46
46
  elif service_name == "anthropic":
47
- from lionagi.integrations.services import AnthropicService
47
+ from lionagi.integrations._services import AnthropicService
48
48
 
49
49
  api_key = kwargs.get("api_key")
50
50
  api_version = kwargs.get("api_version", "2023-06-01")
@@ -63,7 +63,7 @@ def match_service(service_name: str, **kwargs):
63
63
  )
64
64
 
65
65
  elif service_name == "perplexity":
66
- from lionagi.integrations.services import PerplexityService
66
+ from lionagi.integrations._services import PerplexityService
67
67
 
68
68
  api_key = kwargs.get("api_key")
69
69
  api_version = kwargs.get("api_version", "2023-06-01")
@@ -77,7 +77,7 @@ def match_service(service_name: str, **kwargs):
77
77
  return PerplexityService(api_key=api_key)
78
78
 
79
79
  elif service_name == "groq":
80
- from lionagi.integrations.services import GroqService
80
+ from lionagi.integrations._services import GroqService
81
81
 
82
82
  api_key = kwargs.get("api_key")
83
83
  for service in ServiceSetting.services.values():
lionagi/settings.py CHANGED
@@ -1,19 +1,18 @@
1
1
  from datetime import timezone
2
2
  from enum import Enum
3
3
 
4
- from lionagi.protocols.configs import (
4
+ from lionagi.protocols.configs.types import (
5
5
  BranchConfig,
6
- LionIDConfig,
6
+ LogConfig,
7
7
  MessageConfig,
8
8
  RetryConfig,
9
9
  TimedFuncCallConfig,
10
10
  iModelConfig,
11
11
  )
12
- from lionagi.protocols.configs.log_config import LogConfig
13
12
 
14
13
 
15
14
  class BaseSystemFields(str, Enum):
16
- ln_id = "ln_id"
15
+ LN_ID = "ln_id"
17
16
  TIMESTAMP = "timestamp"
18
17
  METADATA = "metadata"
19
18
  EXTRA_FIELDS = "extra_fields"
@@ -22,15 +21,8 @@ class BaseSystemFields(str, Enum):
22
21
  EMBEDDING = "embedding"
23
22
 
24
23
 
25
- DEFAULT_ID_CONFIG = LionIDConfig(
26
- n=36,
27
- random_hyphen=True,
28
- num_hyphens=4,
29
- hyphen_start_index=6,
30
- hyphen_end_index=-6,
31
- prefix="ao",
32
- postfix="",
33
- )
24
+ UUID_VERSION = 4
25
+
34
26
 
35
27
  DEFAULT_TIMED_FUNC_CALL_CONFIG = TimedFuncCallConfig(
36
28
  initial_delay=0,
@@ -61,7 +53,7 @@ DEFAULT_CHAT_CONFIG = iModelConfig(
61
53
  )
62
54
 
63
55
 
64
- DEFAULT_RETRY_iMODEL_CONFIG = iModelConfig(
56
+ DEFAULT_PARSE_CONFIG = iModelConfig(
65
57
  provider="openai",
66
58
  task="chat",
67
59
  model="gpt-4o-mini",
@@ -109,7 +101,7 @@ DEFAULT_BRANCH_CONFIG = BranchConfig(
109
101
  auto_register_tools=True,
110
102
  action_call_config=DEFAULT_TIMED_FUNC_CALL_CONFIG,
111
103
  imodel_config=DEFAULT_CHAT_CONFIG,
112
- retry_imodel_config=DEFAULT_RETRY_iMODEL_CONFIG,
104
+ retry_imodel_config=DEFAULT_PARSE_CONFIG,
113
105
  )
114
106
 
115
107
 
@@ -120,7 +112,7 @@ BASE_LION_FIELDS = set(BaseSystemFields.__members__.values())
120
112
  class Settings:
121
113
 
122
114
  class Config:
123
- ID: LionIDConfig = DEFAULT_ID_CONFIG
115
+ UUID_VERSION: int = UUID_VERSION
124
116
  RETRY: RetryConfig = DEFAULT_RETRY_CONFIG
125
117
  TIMED_CALL: TimedFuncCallConfig = DEFAULT_TIMED_FUNC_CALL_CONFIG
126
118
  TIMEZONE: timezone = DEFAULT_TIMEZONE
@@ -129,8 +121,8 @@ class Settings:
129
121
  BRANCH: BranchConfig = DEFAULT_BRANCH_CONFIG
130
122
 
131
123
  class iModel:
132
- CHAT: dict = {"model": "openai/gpt-4o"}
133
- PARSE: iModelConfig = DEFAULT_CHAT_CONFIG
124
+ CHAT: iModelConfig = DEFAULT_CHAT_CONFIG
125
+ PARSE: iModelConfig = DEFAULT_PARSE_CONFIG
134
126
 
135
127
 
136
128
  # File: autoos/setting.py
@@ -1,15 +1,14 @@
1
1
  from typing import ClassVar
2
2
 
3
- from pydantic import model_validator
3
+ from pydantic import BaseModel, model_validator
4
4
 
5
- from lionagi.fields.instruct import Instruct, InstructResponse
5
+ from lionagi.core.session.types import Branch, Session
6
+ from lionagi.protocols.operatives.instruct import Instruct, InstructResponse
6
7
 
7
- from ..protocols.types import BaseLionModel
8
- from ..session.types import Branch, Session
9
8
  from .params import StrategyParams
10
9
 
11
10
 
12
- class StrategyExecutor(BaseLionModel):
11
+ class StrategyExecutor(BaseModel):
13
12
  """Base class for different execution strategies.
14
13
 
15
14
  Each concrete executor should implement `execute()` to run instructions
@@ -1,6 +1,7 @@
1
- from lionagi.fields.instruct import Instruct, InstructResponse
2
- from lionagi.session.types import Branch
3
- from lionagi.utils import alcall, to_list
1
+ from lionagi.core.session.types import Branch
2
+ from lionagi.libs.func.types import alcall
3
+ from lionagi.libs.parse.types import to_list
4
+ from lionagi.protocols.operatives.instruct import Instruct, InstructResponse
4
5
 
5
6
  from .base import StrategyExecutor
6
7
 
@@ -1,9 +1,9 @@
1
1
  from typing import ClassVar
2
2
 
3
- from lionagi.fields.instruct import Instruct, InstructResponse
4
- from lionagi.utils import to_list
3
+ from lionagi.libs.func.types import bcall
4
+ from lionagi.libs.parse.types import to_list
5
+ from lionagi.protocols.operatives.instruct import Instruct, InstructResponse
5
6
 
6
- from ..libs.async_utils import bcall
7
7
  from .concurrent import ConcurrentExecutor
8
8
  from .params import ChunkStrategyParams
9
9
 
@@ -1,8 +1,8 @@
1
1
  from pydantic import model_validator
2
2
 
3
- from lionagi.fields.instruct import Instruct, InstructResponse
4
- from lionagi.session.types import Branch, Session
5
- from lionagi.utils import alcall
3
+ from lionagi.core.session.types import Branch, Session
4
+ from lionagi.libs.func.types import alcall
5
+ from lionagi.protocols.operatives.instruct import Instruct, InstructResponse
6
6
 
7
7
  from .base import StrategyExecutor
8
8
  from .params import HybridStrategyParams
@@ -2,10 +2,13 @@ from typing import Any, Literal
2
2
 
3
3
  from pydantic import Field, field_validator, model_validator
4
4
 
5
- from lionagi.fields.instruct import INSTRUCT_FIELD_MODEL, Instruct
6
- from lionagi.libs.async_utils import RCallParams
7
- from lionagi.protocols.types import FieldModel, SchemaModel
8
- from lionagi.session.types import Branch, Session
5
+ from lionagi.core.models.types import FieldModel, SchemaModel
6
+ from lionagi.core.session.types import Branch, Session
7
+ from lionagi.libs.func.types import RCallParams
8
+ from lionagi.protocols.operatives.instruct import (
9
+ INSTRUCT_FIELD_MODEL,
10
+ Instruct,
11
+ )
9
12
 
10
13
 
11
14
  class StrategyParams(SchemaModel):
lionagi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.5.2"