unique_orchestrator 0.0.1__py3-none-any.whl → 0.0.3__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.
- unique_orchestrator/config.py +0 -253
- {unique_orchestrator-0.0.1.dist-info → unique_orchestrator-0.0.3.dist-info}/METADATA +9 -4
- {unique_orchestrator-0.0.1.dist-info → unique_orchestrator-0.0.3.dist-info}/RECORD +5 -5
- {unique_orchestrator-0.0.1.dist-info → unique_orchestrator-0.0.3.dist-info}/LICENSE +0 -0
- {unique_orchestrator-0.0.1.dist-info → unique_orchestrator-0.0.3.dist-info}/WHEEL +0 -0
unique_orchestrator/config.py
CHANGED
|
@@ -20,13 +20,7 @@ from unique_toolkit.evals.schemas import EvaluationMetricName
|
|
|
20
20
|
from unique_toolkit.history_manager.history_manager import (
|
|
21
21
|
UploadedContentConfig,
|
|
22
22
|
)
|
|
23
|
-
from unique_toolkit.language_model import LanguageModelName
|
|
24
|
-
from unique_toolkit.language_model.infos import (
|
|
25
|
-
LanguageModelInfo,
|
|
26
|
-
)
|
|
27
23
|
from unique_toolkit.tools.config import get_configuration_dict
|
|
28
|
-
from unique_toolkit.tools.factory import ToolFactory
|
|
29
|
-
from unique_toolkit.tools.schemas import BaseToolConfig
|
|
30
24
|
from unique_toolkit.tools.tool import ToolBuildConfig
|
|
31
25
|
from unique_web_search.config import WebSearchConfig
|
|
32
26
|
from unique_web_search.service import WebSearchTool
|
|
@@ -104,7 +98,6 @@ class UniqueAISpaceConfig(SpaceConfigBase):
|
|
|
104
98
|
|
|
105
99
|
UniqueAISpaceConfig.model_rebuild()
|
|
106
100
|
|
|
107
|
-
LIMIT_LOOP_ITERATIONS = 50
|
|
108
101
|
LIMIT_MAX_TOOL_CALLS_PER_ITERATION = 50
|
|
109
102
|
|
|
110
103
|
|
|
@@ -123,135 +116,6 @@ class EvaluationConfig(BaseModel):
|
|
|
123
116
|
hallucination_config: HallucinationConfig = HallucinationConfig()
|
|
124
117
|
|
|
125
118
|
|
|
126
|
-
class LoopAgentTokenLimitsConfig(BaseModel):
|
|
127
|
-
model_config = get_configuration_dict()
|
|
128
|
-
|
|
129
|
-
language_model: LMI = LanguageModelInfo.from_name(
|
|
130
|
-
LanguageModelName.AZURE_GPT_4o_2024_1120
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
percent_of_max_tokens_for_history: float = Field(
|
|
134
|
-
default=0.2,
|
|
135
|
-
ge=0.0,
|
|
136
|
-
lt=1.0,
|
|
137
|
-
description="The fraction of the max input tokens that will be reserved for the history.",
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
@property
|
|
141
|
-
def max_history_tokens(self) -> int:
|
|
142
|
-
return int(
|
|
143
|
-
self.language_model.token_limits.token_limit_input
|
|
144
|
-
* self.percent_of_max_tokens_for_history,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
class SearchAgentConfig(BaseModel):
|
|
149
|
-
"""Configure the search agent."""
|
|
150
|
-
|
|
151
|
-
model_config = get_configuration_dict(frozen=True)
|
|
152
|
-
|
|
153
|
-
language_model: LMI = LanguageModelInfo.from_name(DEFAULT_GPT_4o)
|
|
154
|
-
|
|
155
|
-
token_limits: LoopAgentTokenLimitsConfig = Field(
|
|
156
|
-
default=LoopAgentTokenLimitsConfig(percent_of_max_tokens_for_history=0.6)
|
|
157
|
-
)
|
|
158
|
-
temperature: float = 0.0
|
|
159
|
-
additional_llm_options: dict[str, Any] = Field(
|
|
160
|
-
default={},
|
|
161
|
-
description="Additional options to pass to the language model.",
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
# Space 2.0
|
|
165
|
-
project_name: str = Field(
|
|
166
|
-
default="Unique AI",
|
|
167
|
-
description="The project name as optained from spaces 2.0",
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
# Space 2.0
|
|
171
|
-
custom_instructions: str = Field(
|
|
172
|
-
default="",
|
|
173
|
-
description="A custom instruction provided by the system admin.",
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
thinking_steps_display: bool = False
|
|
177
|
-
|
|
178
|
-
##############################
|
|
179
|
-
### General Configurations
|
|
180
|
-
##############################
|
|
181
|
-
max_loop_iterations: Annotated[
|
|
182
|
-
int, *ClipInt(min_value=1, max_value=LIMIT_LOOP_ITERATIONS)
|
|
183
|
-
] = 8
|
|
184
|
-
|
|
185
|
-
loop_configuration: LoopConfiguration = LoopConfiguration()
|
|
186
|
-
|
|
187
|
-
tools: list[ToolBuildConfig] = Field(
|
|
188
|
-
default=[
|
|
189
|
-
ToolBuildConfig(
|
|
190
|
-
name=InternalSearchTool.name,
|
|
191
|
-
configuration=InternalSearchConfig(
|
|
192
|
-
exclude_uploaded_files=True,
|
|
193
|
-
),
|
|
194
|
-
),
|
|
195
|
-
ToolBuildConfig(
|
|
196
|
-
name=WebSearchTool.name,
|
|
197
|
-
configuration=WebSearchConfig(),
|
|
198
|
-
),
|
|
199
|
-
ToolBuildConfig(
|
|
200
|
-
name=DeepResearchTool.name,
|
|
201
|
-
configuration=DeepResearchToolConfig(),
|
|
202
|
-
),
|
|
203
|
-
],
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
system_prompt_template: str = Field(
|
|
207
|
-
default_factory=lambda: (
|
|
208
|
-
Path(__file__).parent / "prompts" / "system_prompt.jinja2"
|
|
209
|
-
).read_text(),
|
|
210
|
-
description="The system prompt template as a Jinja2 template string.",
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
user_message_prompt_template: str = Field(
|
|
214
|
-
default_factory=lambda: (
|
|
215
|
-
Path(__file__).parent / "prompts" / "user_message_prompt.jinja2"
|
|
216
|
-
).read_text(),
|
|
217
|
-
description="The user message prompt template as a Jinja2 template string.",
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
##############################
|
|
221
|
-
### Follow-up Questions
|
|
222
|
-
##############################
|
|
223
|
-
follow_up_questions_config: FollowUpQuestionsConfig = FollowUpQuestionsConfig()
|
|
224
|
-
|
|
225
|
-
##############################
|
|
226
|
-
### Evaluation
|
|
227
|
-
##############################
|
|
228
|
-
evaluation_config: EvaluationConfig = EvaluationConfig(
|
|
229
|
-
hallucination_config=HallucinationConfig(),
|
|
230
|
-
max_review_steps=0,
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
##############################
|
|
234
|
-
### Stock Ticker
|
|
235
|
-
##############################
|
|
236
|
-
stock_ticker_config: StockTickerConfig = StockTickerConfig()
|
|
237
|
-
|
|
238
|
-
# TODO: generalize this there should only be 1 point in the code where we do the tool check.
|
|
239
|
-
def get_tool_config(self, tool: str) -> BaseToolConfig:
|
|
240
|
-
"""Get the tool configuration by name."""
|
|
241
|
-
return ToolFactory.build_tool_config(tool)
|
|
242
|
-
|
|
243
|
-
# TODO: @gustavhartz, the Hallucination check should be triggered if enabled and the answer contains references.
|
|
244
|
-
force_checks_on_stream_response_references: list[EvaluationMetricName] = Field(
|
|
245
|
-
default=[EvaluationMetricName.HALLUCINATION],
|
|
246
|
-
description="A list of checks to force on references. This is used to add hallucination check to references without new tool calls.",
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
uploaded_content_config: UploadedContentConfig = Field(
|
|
250
|
-
default_factory=UploadedContentConfig,
|
|
251
|
-
description="The uploaded content config.",
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
|
|
255
119
|
# ------------------------------------------------------------
|
|
256
120
|
# Space 2.0 Config
|
|
257
121
|
# ------------------------------------------------------------
|
|
@@ -386,120 +250,3 @@ class UniqueAIConfig(BaseModel):
|
|
|
386
250
|
space: UniqueAISpaceConfig = UniqueAISpaceConfig()
|
|
387
251
|
|
|
388
252
|
agent: UniqueAIAgentConfig = UniqueAIAgentConfig()
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
# ---
|
|
392
|
-
# Configuration adapter SearchAgentConfig -> UniqueAISpaceConfig
|
|
393
|
-
# --
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
def search_agent_config_to_unique_ai_space_config(
|
|
397
|
-
search_agent_config: SearchAgentConfig,
|
|
398
|
-
) -> UniqueAIConfig:
|
|
399
|
-
space = UniqueAISpaceConfig(
|
|
400
|
-
project_name=search_agent_config.project_name,
|
|
401
|
-
custom_instructions=search_agent_config.custom_instructions,
|
|
402
|
-
tools=search_agent_config.tools,
|
|
403
|
-
language_model=search_agent_config.language_model,
|
|
404
|
-
type=SpaceType.UNIQUE_AI,
|
|
405
|
-
)
|
|
406
|
-
|
|
407
|
-
prompt_config = UniqueAIPromptConfig(
|
|
408
|
-
system_prompt_template=search_agent_config.system_prompt_template,
|
|
409
|
-
user_message_prompt_template=search_agent_config.user_message_prompt_template,
|
|
410
|
-
)
|
|
411
|
-
|
|
412
|
-
services = UniqueAIServices(
|
|
413
|
-
follow_up_questions_config=search_agent_config.follow_up_questions_config,
|
|
414
|
-
evaluation_config=search_agent_config.evaluation_config,
|
|
415
|
-
stock_ticker_config=search_agent_config.stock_ticker_config,
|
|
416
|
-
uploaded_content_config=search_agent_config.uploaded_content_config,
|
|
417
|
-
)
|
|
418
|
-
|
|
419
|
-
experimental = ExperimentalConfig(
|
|
420
|
-
thinking_steps_display=search_agent_config.thinking_steps_display,
|
|
421
|
-
force_checks_on_stream_response_references=search_agent_config.force_checks_on_stream_response_references,
|
|
422
|
-
temperature=search_agent_config.temperature,
|
|
423
|
-
additional_llm_options=search_agent_config.additional_llm_options,
|
|
424
|
-
loop_configuration=search_agent_config.loop_configuration,
|
|
425
|
-
)
|
|
426
|
-
|
|
427
|
-
# Calculate remaining token percentages based on history percentage
|
|
428
|
-
|
|
429
|
-
history_percent = search_agent_config.token_limits.percent_of_max_tokens_for_history
|
|
430
|
-
|
|
431
|
-
agent = UniqueAIAgentConfig(
|
|
432
|
-
max_loop_iterations=search_agent_config.max_loop_iterations,
|
|
433
|
-
input_token_distribution=InputTokenDistributionConfig(
|
|
434
|
-
percent_for_history=history_percent,
|
|
435
|
-
),
|
|
436
|
-
prompt_config=prompt_config,
|
|
437
|
-
services=services,
|
|
438
|
-
experimental=experimental,
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
return UniqueAIConfig(
|
|
442
|
-
space=space,
|
|
443
|
-
agent=agent,
|
|
444
|
-
)
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
def needs_conversion_to_unique_ai_space_config(
|
|
448
|
-
configuration: dict[str, Any],
|
|
449
|
-
) -> bool:
|
|
450
|
-
"""Check if the configuration needs to be converted to the new UniqueAISpaceConfig."""
|
|
451
|
-
if (
|
|
452
|
-
"space_two_point_zero" in configuration
|
|
453
|
-
or "SpaceTwoPointZeroConfig" in configuration
|
|
454
|
-
or ("space" in configuration and "agent" in configuration)
|
|
455
|
-
):
|
|
456
|
-
return False
|
|
457
|
-
|
|
458
|
-
return True
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if __name__ == "__main__":
|
|
462
|
-
import json
|
|
463
|
-
|
|
464
|
-
from unique_toolkit._common.utils.write_configuration import (
|
|
465
|
-
write_service_configuration,
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
write_service_configuration(
|
|
469
|
-
service_folderpath=Path(__file__).parent.parent,
|
|
470
|
-
write_folderpath=Path(__file__).parent,
|
|
471
|
-
config=UniqueAIConfig(),
|
|
472
|
-
sub_name="unique_ai_config",
|
|
473
|
-
)
|
|
474
|
-
|
|
475
|
-
# TODO: @cdkl Delete these models
|
|
476
|
-
# This model is only used to have the old and new models in the same json
|
|
477
|
-
# schema for the data migration in the node chat backend
|
|
478
|
-
|
|
479
|
-
# The types can be generated with quicktype.io with the following command:
|
|
480
|
-
# quicktype unique_ai_old_and_new_config.json \
|
|
481
|
-
# --src-lang schema --lang typescript \
|
|
482
|
-
# --just-types --prefer-types --explicit-unions \
|
|
483
|
-
# -o unique_ai_old_new_configuration.ts \
|
|
484
|
-
# --top-level UniqueAIOldAndNewConfig \
|
|
485
|
-
# --raw-type any
|
|
486
|
-
|
|
487
|
-
# You will need to replace the `any` type with `unknown` in the generated file.
|
|
488
|
-
# On the branch `feat/unique-ai-configuration-migration-node-chat-part`.
|
|
489
|
-
# I you further update the types you will need to adapt both branches
|
|
490
|
-
# - feat/unique-ai-configuration-migration-next-admin-part
|
|
491
|
-
# - feat/unique-ai-configuration-migration-node-chat-part
|
|
492
|
-
|
|
493
|
-
class UniqueAIOldAndNewConfig(BaseModel):
|
|
494
|
-
new: UniqueAIConfig = UniqueAIConfig()
|
|
495
|
-
old: SearchAgentConfig = SearchAgentConfig()
|
|
496
|
-
|
|
497
|
-
with open(
|
|
498
|
-
Path(__file__).parent / "unique_ai_old_and_new_config.json",
|
|
499
|
-
"w",
|
|
500
|
-
) as f:
|
|
501
|
-
json.dump(
|
|
502
|
-
UniqueAIOldAndNewConfig().model_json_schema(by_alias=True),
|
|
503
|
-
f,
|
|
504
|
-
indent=4,
|
|
505
|
-
)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_orchestrator
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary:
|
|
5
5
|
License: Proprietary
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: Andreas Hauri
|
|
7
|
+
Author-email: andreas.hauri@unique.ai
|
|
8
8
|
Requires-Python: >=3.11,<4.0
|
|
9
9
|
Classifier: License :: Other/Proprietary License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -17,7 +17,7 @@ Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
|
17
17
|
Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
|
|
18
18
|
Requires-Dist: unique-deep-research (>=0.0.10,<0.0.11)
|
|
19
19
|
Requires-Dist: unique-follow-up-questions (>=0.0.4,<0.0.5)
|
|
20
|
-
Requires-Dist: unique-internal-search (
|
|
20
|
+
Requires-Dist: unique-internal-search (>=0.0.6,<0.0.7)
|
|
21
21
|
Requires-Dist: unique-sdk (>=0.10.0,<0.11.0)
|
|
22
22
|
Requires-Dist: unique-stock-ticker (>=0.0.5,<0.0.6)
|
|
23
23
|
Requires-Dist: unique-toolkit (>=0.8.57,<0.9.0)
|
|
@@ -34,6 +34,11 @@ All notable changes to this project will be documented in this file.
|
|
|
34
34
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
35
35
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
36
36
|
|
|
37
|
+
## [0.0.3] - 2025-09-16
|
|
38
|
+
- Cleaned configuration
|
|
39
|
+
|
|
40
|
+
## [0.0.2] - 2025-09-15
|
|
41
|
+
- Resolve dependency bug
|
|
37
42
|
|
|
38
43
|
## [0.0.1] - 2025-08-18
|
|
39
44
|
- Initial release of `orchestrator`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
unique_orchestrator/config.py,sha256=
|
|
1
|
+
unique_orchestrator/config.py,sha256=SV5jBkGlRg4BrFiDlAIMXVSRy0k_EMnZE8dmhvBtfIQ,8004
|
|
2
2
|
unique_orchestrator/prompts/generic_reference_prompt.jinja2,sha256=fYPaiE-N1gSoOqu85OeEBa_ttAim8grOhHuOHJjSHNU,2663
|
|
3
3
|
unique_orchestrator/prompts/system_prompt.jinja2,sha256=2Dy8GHrT018Sj9UkYGxSfjt7fvTTDvD53BxjDMZRPVY,6897
|
|
4
4
|
unique_orchestrator/prompts/user_message_prompt.jinja2,sha256=KLCfbxMu5R7_V8-AHkdXEmVorcSHNej_xM_7xJyNkl0,692
|
|
@@ -6,7 +6,7 @@ unique_orchestrator/tests/test_config.py,sha256=P7QkVlVv0ppiK77s5i4rE4IOzdtdBCZZ
|
|
|
6
6
|
unique_orchestrator/tests/test_unique_ai_reference_order.py,sha256=8mZeVP1k8neH4qrFW3oa3zwIdaq2c7R1VvurC7kjBU8,4445
|
|
7
7
|
unique_orchestrator/unique_ai.py,sha256=xGQogDbxA7qjfk8R85t5m8PI_XDY7tk-s4tkvp8on_Q,15574
|
|
8
8
|
unique_orchestrator/unique_ai_builder.py,sha256=J73_Lg3XjI9JKirUmC6juWTefk7gPkG67NPLdUL4zr0,5991
|
|
9
|
-
unique_orchestrator-0.0.
|
|
10
|
-
unique_orchestrator-0.0.
|
|
11
|
-
unique_orchestrator-0.0.
|
|
12
|
-
unique_orchestrator-0.0.
|
|
9
|
+
unique_orchestrator-0.0.3.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
|
10
|
+
unique_orchestrator-0.0.3.dist-info/METADATA,sha256=gFcyRvlvxIjS_8Id75q-fTcxqGp829PMGH6GDj-q76s,1513
|
|
11
|
+
unique_orchestrator-0.0.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
unique_orchestrator-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|