unique_toolkit 1.38.2__tar.gz → 1.38.4__tar.gz
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_toolkit-1.38.2 → unique_toolkit-1.38.4}/CHANGELOG.md +6 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/PKG-INFO +7 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/pyproject.toml +1 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/evaluation_manager.py +4 -4
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/__init__.py +15 -5
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/_iteration_handler_utils.py +95 -0
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/middleware/__init__.py +11 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/middleware/planning/planning.py +1 -1
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/runners/__init__.py +19 -0
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/runners/basic.py +46 -0
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/runners/qwen/__init__.py +15 -0
- {unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/middleware/qwen_forced_tool_call → unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/runners/qwen}/helpers.py +15 -0
- unique_toolkit-1.38.4/unique_toolkit/agentic/loop_runner/runners/qwen/qwen_runner.py +118 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/postprocessor/postprocessor_manager.py +1 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/responses_api/postprocessors/generated_files.py +1 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/short_term_memory_manager/persistent_short_term_memory_manager.py +1 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/evaluation/evaluator.py +1 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/tool_manager.py +4 -4
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/responses_api.py +1 -1
- unique_toolkit-1.38.4/unique_toolkit/smart_rules/__init__.py +0 -0
- unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/middleware/__init__.py +0 -19
- unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/middleware/qwen_forced_tool_call/__init__.py +0 -13
- unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/middleware/qwen_forced_tool_call/qwen_forced_tool_call.py +0 -50
- unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/runners/__init__.py +0 -6
- unique_toolkit-1.38.2/unique_toolkit/agentic/loop_runner/runners/basic.py +0 -96
- unique_toolkit-1.38.2/unique_toolkit/agentic/tools/utils/__init__.py +0 -19
- unique_toolkit-1.38.2/unique_toolkit/agentic/tools/utils/execution/__init__.py +0 -1
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/LICENSE +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/README.md +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/_base_service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/_time_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/api_calling/human_verification_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/base_model_type_attribute.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/chunk_relevancy_sorter/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/chunk_relevancy_sorter/exception.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/chunk_relevancy_sorter/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/chunk_relevancy_sorter/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/chunk_relevancy_sorter/tests/test_service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/default_language_model.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/docx_generator/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/docx_generator/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/docx_generator/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/docx_generator/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/docx_generator/template/Doc Template.docx +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/endpoint_builder.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/endpoint_requestor.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/exception.py +0 -0
- {unique_toolkit-1.38.2/unique_toolkit/agentic/tools/utils/execution → unique_toolkit-1.38.4/unique_toolkit/_common}/execution.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/experimental/endpoint_builder.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/experimental/endpoint_requestor.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/feature_flags/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/pydantic/rjsf_tags.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/pydantic_helpers.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/referencing.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/string_utilities.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/tests/test_referencing.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/tests/test_string_utilities.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/token/image_token_counting.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/token/token_counting.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/files.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/image/encode.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/jinja/helpers.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/jinja/render.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/jinja/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/jinja/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/structured_output/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/structured_output/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/utils/write_configuration.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/validate_required_values.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/_common/validators.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/debug_info_manager/debug_info_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/debug_info_manager/test/test_debug_info_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/context_relevancy/prompts.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/context_relevancy/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/context_relevancy/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/exception.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/hallucination/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/hallucination/prompts.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/hallucination/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/hallucination/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/output_parser.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/evaluation/tests/test_output_parser.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/history_manager/history_construction_with_contents.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/history_manager/history_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/history_manager/loop_token_reducer.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/history_manager/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/_stream_handler_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/base.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/middleware/planning/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/middleware/planning/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/message_log_manager/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/message_log_manager/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/reference_manager/reference_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/responses_api/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/responses_api/postprocessors/code_display.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/responses_api/stream_handler.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/thinking_manager/thinking_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/evaluation/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/evaluation/_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/evaluation/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/evaluation/summarization_user_message.j2 +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/_display_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/_ref_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/display.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/references.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_ref_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/prompts.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/response_watcher/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/response_watcher/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/_memory.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/_schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/a2a/tool/test/test_service_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/agent_chunks_hanlder.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/factory.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/mcp/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/mcp/manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/mcp/models.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/mcp/tool_wrapper.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/base.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/openai_builtin/manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/test/test_mcp_manager.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/test/test_tool_progress_reporter.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/tool.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/tool_progress_reporter.py +0 -0
- {unique_toolkit-1.38.2/unique_toolkit/agentic/tools/utils/source_handling → unique_toolkit-1.38.4/unique_toolkit/agentic/tools/utils}/__init__.py +0 -0
- {unique_toolkit-1.38.2/unique_toolkit/smart_rules → unique_toolkit-1.38.4/unique_toolkit/agentic/tools/utils/source_handling}/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/utils/source_handling/schema.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/utils/source_handling/source_formatting.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/utils/source_handling/tests/test_source_formatting.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/dev_util.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/fast_api_factory.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/init_logging.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/init_sdk.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/performance/async_tasks.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/performance/async_wrapper.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/unique_settings.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/verification.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/app/webhook.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/deprecated/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/functions.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/rendering.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/state.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/chat/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/functions.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/smart_rules.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/content/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/README.md +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/augmented/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/augmented/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/base.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/basic/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/basic/config.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/basic/prompt.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/data_extraction/basic/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/functions.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/embedding/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/langchain/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/langchain/client.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/langchain/history.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/openai/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/openai/client.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/openai/message_builder.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/framework_utilities/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/_responses_api_utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/builder.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/default_language_model.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/functions.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/infos.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/prompt.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/reference.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/language_model/utils.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/protocols/support.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/services/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/services/chat_service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/services/knowledge_base.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/short_term_memory/__init__.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/short_term_memory/constants.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/short_term_memory/functions.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/short_term_memory/schemas.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/short_term_memory/service.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/smart_rules/compile.py +0 -0
- {unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/test_utilities/events.py +0 -0
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.38.4] - 2025-12-17
|
|
9
|
+
- Improving handling of tool calls with Qwen models
|
|
10
|
+
|
|
11
|
+
## [1.38.3] - 2025-12-17
|
|
12
|
+
- Move the failsafe exception to root folder of unique_toolkit from agentic tools
|
|
13
|
+
|
|
8
14
|
## [1.38.2] - 2025-12-17
|
|
9
15
|
- Fixing bug that language model infos were not loaded correctly
|
|
10
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_toolkit
|
|
3
|
-
Version: 1.38.
|
|
3
|
+
Version: 1.38.4
|
|
4
4
|
Summary:
|
|
5
5
|
License: Proprietary
|
|
6
6
|
Author: Cedric Klinkert
|
|
@@ -121,6 +121,12 @@ All notable changes to this project will be documented in this file.
|
|
|
121
121
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
122
122
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
123
123
|
|
|
124
|
+
## [1.38.4] - 2025-12-17
|
|
125
|
+
- Improving handling of tool calls with Qwen models
|
|
126
|
+
|
|
127
|
+
## [1.38.3] - 2025-12-17
|
|
128
|
+
- Move the failsafe exception to root folder of unique_toolkit from agentic tools
|
|
129
|
+
|
|
124
130
|
## [1.38.2] - 2025-12-17
|
|
125
131
|
- Fixing bug that language model infos were not loaded correctly
|
|
126
132
|
|
|
@@ -2,15 +2,15 @@ import asyncio
|
|
|
2
2
|
from abc import ABC
|
|
3
3
|
from logging import Logger
|
|
4
4
|
|
|
5
|
+
from unique_toolkit._common.execution import (
|
|
6
|
+
Result,
|
|
7
|
+
SafeTaskExecutor,
|
|
8
|
+
)
|
|
5
9
|
from unique_toolkit.agentic.evaluation.schemas import (
|
|
6
10
|
EvaluationAssessmentMessage,
|
|
7
11
|
EvaluationMetricName,
|
|
8
12
|
EvaluationMetricResult,
|
|
9
13
|
)
|
|
10
|
-
from unique_toolkit.agentic.tools.utils.execution.execution import (
|
|
11
|
-
Result,
|
|
12
|
-
SafeTaskExecutor,
|
|
13
|
-
)
|
|
14
14
|
from unique_toolkit.chat.schemas import (
|
|
15
15
|
ChatMessageAssessmentStatus,
|
|
16
16
|
ChatMessageAssessmentType,
|
{unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/loop_runner/__init__.py
RENAMED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
+
from unique_toolkit.agentic.loop_runner._iteration_handler_utils import (
|
|
2
|
+
handle_forced_tools_iteration,
|
|
3
|
+
handle_last_iteration,
|
|
4
|
+
handle_normal_iteration,
|
|
5
|
+
)
|
|
1
6
|
from unique_toolkit.agentic.loop_runner.base import LoopIterationRunner
|
|
2
7
|
from unique_toolkit.agentic.loop_runner.middleware import (
|
|
3
|
-
QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION,
|
|
4
8
|
PlanningConfig,
|
|
5
9
|
PlanningMiddleware,
|
|
6
10
|
PlanningSchemaConfig,
|
|
7
|
-
QwenForcedToolCallMiddleware,
|
|
8
|
-
is_qwen_model,
|
|
9
11
|
)
|
|
10
12
|
from unique_toolkit.agentic.loop_runner.runners import (
|
|
13
|
+
QWEN_FORCED_TOOL_CALL_INSTRUCTION,
|
|
14
|
+
QWEN_LAST_ITERATION_INSTRUCTION,
|
|
11
15
|
BasicLoopIterationRunner,
|
|
12
16
|
BasicLoopIterationRunnerConfig,
|
|
17
|
+
QwenLoopIterationRunner,
|
|
18
|
+
is_qwen_model,
|
|
13
19
|
)
|
|
14
20
|
|
|
15
21
|
__all__ = [
|
|
16
22
|
"LoopIterationRunner",
|
|
17
|
-
"QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION",
|
|
18
23
|
"PlanningConfig",
|
|
19
24
|
"PlanningMiddleware",
|
|
20
25
|
"PlanningSchemaConfig",
|
|
21
|
-
"
|
|
26
|
+
"QwenLoopIterationRunner",
|
|
22
27
|
"is_qwen_model",
|
|
23
28
|
"BasicLoopIterationRunnerConfig",
|
|
24
29
|
"BasicLoopIterationRunner",
|
|
30
|
+
"handle_forced_tools_iteration",
|
|
31
|
+
"handle_last_iteration",
|
|
32
|
+
"handle_normal_iteration",
|
|
33
|
+
"QWEN_FORCED_TOOL_CALL_INSTRUCTION",
|
|
34
|
+
"QWEN_LAST_ITERATION_INSTRUCTION",
|
|
25
35
|
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Protocol, Unpack, cast
|
|
3
|
+
|
|
4
|
+
from unique_toolkit.agentic.loop_runner._stream_handler_utils import stream_response
|
|
5
|
+
from unique_toolkit.agentic.loop_runner.base import (
|
|
6
|
+
_LoopIterationRunnerKwargs,
|
|
7
|
+
)
|
|
8
|
+
from unique_toolkit.chat.functions import LanguageModelStreamResponse
|
|
9
|
+
|
|
10
|
+
_LOGGER = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PrepareForcedToolIterationKwargs(Protocol):
|
|
14
|
+
def __call__(
|
|
15
|
+
self,
|
|
16
|
+
func_name: str | None,
|
|
17
|
+
per_choice_kwargs: _LoopIterationRunnerKwargs,
|
|
18
|
+
) -> _LoopIterationRunnerKwargs: ...
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def handle_last_iteration(
|
|
22
|
+
**kwargs: Unpack[_LoopIterationRunnerKwargs],
|
|
23
|
+
) -> LanguageModelStreamResponse:
|
|
24
|
+
_LOGGER.info("Reached last iteration, removing tools and producing final response")
|
|
25
|
+
|
|
26
|
+
return await stream_response(
|
|
27
|
+
loop_runner_kwargs=kwargs,
|
|
28
|
+
tools=None,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def handle_normal_iteration(
|
|
33
|
+
**kwargs: Unpack[_LoopIterationRunnerKwargs],
|
|
34
|
+
) -> LanguageModelStreamResponse:
|
|
35
|
+
_LOGGER.info("Running loop iteration %d", kwargs["iteration_index"])
|
|
36
|
+
|
|
37
|
+
return await stream_response(loop_runner_kwargs=kwargs)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
async def handle_forced_tools_iteration(
|
|
41
|
+
**kwargs: Unpack[_LoopIterationRunnerKwargs],
|
|
42
|
+
) -> LanguageModelStreamResponse:
|
|
43
|
+
return await run_forced_tools_iteration(loop_runner_kwargs=kwargs)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def run_forced_tools_iteration(
|
|
47
|
+
*,
|
|
48
|
+
loop_runner_kwargs: _LoopIterationRunnerKwargs,
|
|
49
|
+
prepare_loop_runner_kwargs: PrepareForcedToolIterationKwargs | None = None,
|
|
50
|
+
) -> LanguageModelStreamResponse:
|
|
51
|
+
"""
|
|
52
|
+
Execute a "forced tools" iteration by running one stream_response per tool choice,
|
|
53
|
+
then merging tool calls and references into a single response.
|
|
54
|
+
|
|
55
|
+
Some models (e.g. Qwen) need per-tool-choice message rewriting; this can be done
|
|
56
|
+
via prepare_loop_runner_kwargs (called once per tool choice, on a copy of kwargs).
|
|
57
|
+
"""
|
|
58
|
+
assert "tool_choices" in loop_runner_kwargs
|
|
59
|
+
|
|
60
|
+
tool_choices = loop_runner_kwargs["tool_choices"]
|
|
61
|
+
assert len(tool_choices) > 0, (
|
|
62
|
+
"run_forced_tools_iteration requires at least one tool choice"
|
|
63
|
+
)
|
|
64
|
+
_LOGGER.info("Forcing tools calls: %s", tool_choices)
|
|
65
|
+
|
|
66
|
+
responses: list[LanguageModelStreamResponse] = []
|
|
67
|
+
|
|
68
|
+
available_tools = {t.name: t for t in loop_runner_kwargs.get("tools") or []}
|
|
69
|
+
|
|
70
|
+
for opt in tool_choices:
|
|
71
|
+
func_name = opt.get("function", {}).get("name")
|
|
72
|
+
|
|
73
|
+
per_choice_kwargs = cast(_LoopIterationRunnerKwargs, dict(loop_runner_kwargs))
|
|
74
|
+
if prepare_loop_runner_kwargs:
|
|
75
|
+
per_choice_kwargs = prepare_loop_runner_kwargs(func_name, per_choice_kwargs)
|
|
76
|
+
|
|
77
|
+
limited_tool = available_tools.get(func_name) if func_name else None
|
|
78
|
+
stream_kwargs = {"loop_runner_kwargs": per_choice_kwargs, "tool_choice": opt}
|
|
79
|
+
if limited_tool:
|
|
80
|
+
stream_kwargs["tools"] = [limited_tool]
|
|
81
|
+
responses.append(await stream_response(**stream_kwargs))
|
|
82
|
+
|
|
83
|
+
# Merge responses and refs:
|
|
84
|
+
tool_calls = []
|
|
85
|
+
references = []
|
|
86
|
+
for r in responses:
|
|
87
|
+
if r.tool_calls:
|
|
88
|
+
tool_calls.extend(r.tool_calls)
|
|
89
|
+
references.extend(r.message.references)
|
|
90
|
+
|
|
91
|
+
response = responses[0]
|
|
92
|
+
response.tool_calls = tool_calls if len(tool_calls) > 0 else None
|
|
93
|
+
response.message.references = references
|
|
94
|
+
|
|
95
|
+
return response
|
|
@@ -5,6 +5,7 @@ from typing import Unpack
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
7
|
from unique_toolkit import LanguageModelService
|
|
8
|
+
from unique_toolkit._common.execution import failsafe_async
|
|
8
9
|
from unique_toolkit._common.pydantic_helpers import get_configuration_dict
|
|
9
10
|
from unique_toolkit.agentic.history_manager.history_manager import HistoryManager
|
|
10
11
|
from unique_toolkit.agentic.loop_runner.base import (
|
|
@@ -15,7 +16,6 @@ from unique_toolkit.agentic.loop_runner.middleware.planning.schema import (
|
|
|
15
16
|
PlanningSchemaConfig,
|
|
16
17
|
get_planning_schema,
|
|
17
18
|
)
|
|
18
|
-
from unique_toolkit.agentic.tools.utils import failsafe_async
|
|
19
19
|
from unique_toolkit.chat.service import LanguageModelStreamResponse
|
|
20
20
|
from unique_toolkit.language_model import (
|
|
21
21
|
LanguageModelAssistantMessage,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from unique_toolkit.agentic.loop_runner.runners.basic import (
|
|
2
|
+
BasicLoopIterationRunner,
|
|
3
|
+
BasicLoopIterationRunnerConfig,
|
|
4
|
+
)
|
|
5
|
+
from unique_toolkit.agentic.loop_runner.runners.qwen import (
|
|
6
|
+
QWEN_FORCED_TOOL_CALL_INSTRUCTION,
|
|
7
|
+
QWEN_LAST_ITERATION_INSTRUCTION,
|
|
8
|
+
QwenLoopIterationRunner,
|
|
9
|
+
is_qwen_model,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"BasicLoopIterationRunnerConfig",
|
|
14
|
+
"BasicLoopIterationRunner",
|
|
15
|
+
"QwenLoopIterationRunner",
|
|
16
|
+
"QWEN_FORCED_TOOL_CALL_INSTRUCTION",
|
|
17
|
+
"QWEN_LAST_ITERATION_INSTRUCTION",
|
|
18
|
+
"is_qwen_model",
|
|
19
|
+
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Unpack, override
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
from unique_toolkit._common.pydantic_helpers import get_configuration_dict
|
|
7
|
+
from unique_toolkit.agentic.loop_runner._iteration_handler_utils import (
|
|
8
|
+
handle_forced_tools_iteration,
|
|
9
|
+
handle_last_iteration,
|
|
10
|
+
handle_normal_iteration,
|
|
11
|
+
)
|
|
12
|
+
from unique_toolkit.agentic.loop_runner.base import (
|
|
13
|
+
LoopIterationRunner,
|
|
14
|
+
_LoopIterationRunnerKwargs,
|
|
15
|
+
)
|
|
16
|
+
from unique_toolkit.chat.functions import LanguageModelStreamResponse
|
|
17
|
+
from unique_toolkit.protocols.support import (
|
|
18
|
+
ResponsesLanguageModelStreamResponse,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
_LOGGER = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class BasicLoopIterationRunnerConfig(BaseModel):
|
|
25
|
+
model_config = get_configuration_dict()
|
|
26
|
+
max_loop_iterations: int
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class BasicLoopIterationRunner(LoopIterationRunner):
|
|
30
|
+
def __init__(self, config: BasicLoopIterationRunnerConfig) -> None:
|
|
31
|
+
self._config = config
|
|
32
|
+
|
|
33
|
+
@override
|
|
34
|
+
async def __call__(
|
|
35
|
+
self,
|
|
36
|
+
**kwargs: Unpack[_LoopIterationRunnerKwargs],
|
|
37
|
+
) -> LanguageModelStreamResponse | ResponsesLanguageModelStreamResponse:
|
|
38
|
+
tool_choices = kwargs.get("tool_choices", [])
|
|
39
|
+
iteration_index = kwargs["iteration_index"]
|
|
40
|
+
|
|
41
|
+
if len(tool_choices) > 0 and iteration_index == 0:
|
|
42
|
+
return await handle_forced_tools_iteration(**kwargs)
|
|
43
|
+
elif iteration_index == self._config.max_loop_iterations - 1:
|
|
44
|
+
return await handle_last_iteration(**kwargs)
|
|
45
|
+
else:
|
|
46
|
+
return await handle_normal_iteration(**kwargs)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from unique_toolkit.agentic.loop_runner.runners.qwen.helpers import (
|
|
2
|
+
is_qwen_model,
|
|
3
|
+
)
|
|
4
|
+
from unique_toolkit.agentic.loop_runner.runners.qwen.qwen_runner import (
|
|
5
|
+
QWEN_FORCED_TOOL_CALL_INSTRUCTION,
|
|
6
|
+
QWEN_LAST_ITERATION_INSTRUCTION,
|
|
7
|
+
QwenLoopIterationRunner,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"QwenLoopIterationRunner",
|
|
12
|
+
"is_qwen_model",
|
|
13
|
+
"QWEN_FORCED_TOOL_CALL_INSTRUCTION",
|
|
14
|
+
"QWEN_LAST_ITERATION_INSTRUCTION",
|
|
15
|
+
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from unique_toolkit.language_model.infos import LanguageModelInfo
|
|
2
2
|
from unique_toolkit.language_model.schemas import (
|
|
3
|
+
LanguageModelAssistantMessage,
|
|
3
4
|
LanguageModelMessageRole,
|
|
4
5
|
LanguageModelMessages,
|
|
5
6
|
)
|
|
@@ -31,3 +32,17 @@ def append_qwen_forced_tool_call_instruction(
|
|
|
31
32
|
)
|
|
32
33
|
break
|
|
33
34
|
return LanguageModelMessages(root=messages_list)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def append_qwen_last_iteration_assistant_message(
|
|
38
|
+
*,
|
|
39
|
+
messages: LanguageModelMessages,
|
|
40
|
+
last_iteration_instruction: str,
|
|
41
|
+
) -> LanguageModelMessages:
|
|
42
|
+
"""Append an assistant message at the end to indicate no further tool calls are allowed."""
|
|
43
|
+
messages_list = list(messages)
|
|
44
|
+
assistant_message = LanguageModelAssistantMessage(
|
|
45
|
+
content=last_iteration_instruction,
|
|
46
|
+
)
|
|
47
|
+
messages_list.append(assistant_message)
|
|
48
|
+
return LanguageModelMessages(root=messages_list)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Unpack
|
|
3
|
+
|
|
4
|
+
from unique_toolkit.agentic.loop_runner._iteration_handler_utils import (
|
|
5
|
+
handle_last_iteration,
|
|
6
|
+
handle_normal_iteration,
|
|
7
|
+
run_forced_tools_iteration,
|
|
8
|
+
)
|
|
9
|
+
from unique_toolkit.agentic.loop_runner.base import (
|
|
10
|
+
LoopIterationRunner,
|
|
11
|
+
_LoopIterationRunnerKwargs,
|
|
12
|
+
)
|
|
13
|
+
from unique_toolkit.agentic.loop_runner.runners.qwen.helpers import (
|
|
14
|
+
append_qwen_forced_tool_call_instruction,
|
|
15
|
+
append_qwen_last_iteration_assistant_message,
|
|
16
|
+
)
|
|
17
|
+
from unique_toolkit.chat.service import ChatService, LanguageModelStreamResponse
|
|
18
|
+
|
|
19
|
+
_LOGGER = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
QWEN_FORCED_TOOL_CALL_INSTRUCTION = (
|
|
22
|
+
"**Tool Call Instruction:** \nYou MUST call the tool {TOOL_NAME}. "
|
|
23
|
+
"You must start the response with <tool_call>. "
|
|
24
|
+
"Do NOT provide natural language explanations, summaries, or any text outside the <tool_call> block."
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
QWEN_LAST_ITERATION_INSTRUCTION = "The maximum number of loop iteration have been reached. Not further tool calls are allowed. Based on the found information, an answer should be generated"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class QwenLoopIterationRunner(LoopIterationRunner):
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
*,
|
|
34
|
+
qwen_forced_tool_call_instruction: str,
|
|
35
|
+
qwen_last_iteration_instruction: str,
|
|
36
|
+
max_loop_iterations: int,
|
|
37
|
+
chat_service: ChatService,
|
|
38
|
+
) -> None:
|
|
39
|
+
self._qwen_forced_tool_call_instruction = qwen_forced_tool_call_instruction
|
|
40
|
+
self._qwen_last_iteration_instruction = qwen_last_iteration_instruction
|
|
41
|
+
self._max_loop_iterations = max_loop_iterations
|
|
42
|
+
self._chat_service = chat_service
|
|
43
|
+
|
|
44
|
+
async def __call__(
|
|
45
|
+
self, **kwargs: Unpack[_LoopIterationRunnerKwargs]
|
|
46
|
+
) -> LanguageModelStreamResponse:
|
|
47
|
+
tool_choices = kwargs.get("tool_choices") or []
|
|
48
|
+
iteration_index = kwargs["iteration_index"]
|
|
49
|
+
|
|
50
|
+
if len(tool_choices) > 0 and iteration_index == 0:
|
|
51
|
+
return await self._qwen_handle_forced_tools_iteration(**kwargs)
|
|
52
|
+
elif iteration_index == self._max_loop_iterations - 1:
|
|
53
|
+
return await self._qwen_handle_last_iteration(**kwargs)
|
|
54
|
+
else:
|
|
55
|
+
return await self._qwen_handle_normal_iteration(**kwargs)
|
|
56
|
+
|
|
57
|
+
async def _qwen_handle_forced_tools_iteration(
|
|
58
|
+
self, **kwargs: Unpack[_LoopIterationRunnerKwargs]
|
|
59
|
+
) -> LanguageModelStreamResponse:
|
|
60
|
+
# For Qwen models, append tool call instruction to the last user message. These models ignore the parameter tool_choice.
|
|
61
|
+
# As the message has to be modified for each tool call instruction, the function from the basic runner cant be used.
|
|
62
|
+
original_messages = kwargs["messages"].model_copy(deep=True)
|
|
63
|
+
|
|
64
|
+
def _prepare(
|
|
65
|
+
func_name: str | None,
|
|
66
|
+
per_choice_kwargs: _LoopIterationRunnerKwargs,
|
|
67
|
+
) -> _LoopIterationRunnerKwargs:
|
|
68
|
+
prompt_instruction = self._qwen_forced_tool_call_instruction.format(
|
|
69
|
+
TOOL_NAME=func_name or ""
|
|
70
|
+
)
|
|
71
|
+
per_choice_kwargs["messages"] = append_qwen_forced_tool_call_instruction(
|
|
72
|
+
messages=original_messages,
|
|
73
|
+
forced_tool_call_instruction=prompt_instruction,
|
|
74
|
+
)
|
|
75
|
+
return per_choice_kwargs
|
|
76
|
+
|
|
77
|
+
response = await run_forced_tools_iteration(
|
|
78
|
+
loop_runner_kwargs=kwargs,
|
|
79
|
+
prepare_loop_runner_kwargs=_prepare,
|
|
80
|
+
)
|
|
81
|
+
return self._process_response(response)
|
|
82
|
+
|
|
83
|
+
async def _qwen_handle_last_iteration(
|
|
84
|
+
self, **kwargs: Unpack[_LoopIterationRunnerKwargs]
|
|
85
|
+
) -> LanguageModelStreamResponse:
|
|
86
|
+
# For Qwen models, append an assistant message with instructions to not call any tool in this iteration.
|
|
87
|
+
_LOGGER.info(
|
|
88
|
+
"Reached last iteration, removing tools. Appending assistant message with instructions to not call any tool in this iteration."
|
|
89
|
+
)
|
|
90
|
+
kwargs["messages"] = append_qwen_last_iteration_assistant_message(
|
|
91
|
+
messages=kwargs["messages"],
|
|
92
|
+
last_iteration_instruction=self._qwen_last_iteration_instruction,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
response = await handle_last_iteration(
|
|
96
|
+
**kwargs,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return self._process_response(response)
|
|
100
|
+
|
|
101
|
+
async def _qwen_handle_normal_iteration(
|
|
102
|
+
self, **kwargs: Unpack[_LoopIterationRunnerKwargs]
|
|
103
|
+
) -> LanguageModelStreamResponse:
|
|
104
|
+
response = await handle_normal_iteration(**kwargs)
|
|
105
|
+
return self._process_response(response)
|
|
106
|
+
|
|
107
|
+
def _process_response(
|
|
108
|
+
self, response: LanguageModelStreamResponse
|
|
109
|
+
) -> LanguageModelStreamResponse:
|
|
110
|
+
# Check if content of response is </tool_call>
|
|
111
|
+
if "</tool_call>" == response.message.text.strip():
|
|
112
|
+
_LOGGER.warning(
|
|
113
|
+
"Response contains only <tool_call>. This is not allowed. Returning empty response."
|
|
114
|
+
)
|
|
115
|
+
self._chat_service.modify_assistant_message(content="")
|
|
116
|
+
response.message.text = ""
|
|
117
|
+
|
|
118
|
+
return response
|
|
@@ -2,7 +2,7 @@ import asyncio
|
|
|
2
2
|
from abc import ABC
|
|
3
3
|
from logging import Logger
|
|
4
4
|
|
|
5
|
-
from unique_toolkit.
|
|
5
|
+
from unique_toolkit._common.execution import SafeTaskExecutor
|
|
6
6
|
from unique_toolkit.chat.service import ChatService
|
|
7
7
|
from unique_toolkit.language_model.schemas import (
|
|
8
8
|
LanguageModelStreamResponse,
|
|
@@ -9,6 +9,7 @@ from openai.types.responses.response_output_text import AnnotationContainerFileC
|
|
|
9
9
|
from pydantic import BaseModel, Field, RootModel
|
|
10
10
|
|
|
11
11
|
from unique_toolkit import ChatService
|
|
12
|
+
from unique_toolkit._common.execution import failsafe_async
|
|
12
13
|
from unique_toolkit.agentic.postprocessor.postprocessor_manager import (
|
|
13
14
|
ResponsesApiPostprocessor,
|
|
14
15
|
)
|
|
@@ -16,7 +17,6 @@ from unique_toolkit.agentic.short_term_memory_manager.persistent_short_term_memo
|
|
|
16
17
|
PersistentShortMemoryManager,
|
|
17
18
|
)
|
|
18
19
|
from unique_toolkit.agentic.tools.config import get_configuration_dict
|
|
19
|
-
from unique_toolkit.agentic.tools.utils import failsafe_async
|
|
20
20
|
from unique_toolkit.content.schemas import ContentReference
|
|
21
21
|
from unique_toolkit.content.service import ContentService
|
|
22
22
|
from unique_toolkit.language_model.schemas import ResponsesLanguageModelStreamResponse
|
|
@@ -5,7 +5,7 @@ from typing import Generic, Type, TypeVar
|
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel
|
|
7
7
|
|
|
8
|
-
from unique_toolkit.
|
|
8
|
+
from unique_toolkit._common.execution import SafeTaskExecutor
|
|
9
9
|
from unique_toolkit.short_term_memory.schemas import ShortTermMemory
|
|
10
10
|
from unique_toolkit.short_term_memory.service import ShortTermMemoryService
|
|
11
11
|
|
|
@@ -5,6 +5,7 @@ import unique_sdk
|
|
|
5
5
|
from jinja2 import Template
|
|
6
6
|
from pydantic import BaseModel
|
|
7
7
|
|
|
8
|
+
from unique_toolkit._common.execution import failsafe
|
|
8
9
|
from unique_toolkit.agentic.evaluation.evaluation_manager import Evaluation
|
|
9
10
|
from unique_toolkit.agentic.evaluation.schemas import (
|
|
10
11
|
EvaluationAssessmentMessage,
|
|
@@ -24,7 +25,6 @@ from unique_toolkit.agentic.tools.a2a.response_watcher import (
|
|
|
24
25
|
SubAgentResponse,
|
|
25
26
|
SubAgentResponseWatcher,
|
|
26
27
|
)
|
|
27
|
-
from unique_toolkit.agentic.tools.utils import failsafe
|
|
28
28
|
from unique_toolkit.chat.schemas import (
|
|
29
29
|
ChatMessageAssessmentLabel,
|
|
30
30
|
ChatMessageAssessmentStatus,
|
{unique_toolkit-1.38.2 → unique_toolkit-1.38.4}/unique_toolkit/agentic/tools/tool_manager.py
RENAMED
|
@@ -11,6 +11,10 @@ from openai.types.responses import (
|
|
|
11
11
|
)
|
|
12
12
|
from pydantic import BaseModel, Field
|
|
13
13
|
|
|
14
|
+
from unique_toolkit._common.execution import (
|
|
15
|
+
Result,
|
|
16
|
+
SafeTaskExecutor,
|
|
17
|
+
)
|
|
14
18
|
from unique_toolkit.agentic.evaluation.schemas import EvaluationMetricName
|
|
15
19
|
from unique_toolkit.agentic.tools.a2a import A2AManager, SubAgentTool
|
|
16
20
|
from unique_toolkit.agentic.tools.config import ToolBuildConfig
|
|
@@ -24,10 +28,6 @@ from unique_toolkit.agentic.tools.openai_builtin.manager import OpenAIBuiltInToo
|
|
|
24
28
|
from unique_toolkit.agentic.tools.schemas import ToolCallResponse, ToolPrompts
|
|
25
29
|
from unique_toolkit.agentic.tools.tool import Tool
|
|
26
30
|
from unique_toolkit.agentic.tools.tool_progress_reporter import ToolProgressReporter
|
|
27
|
-
from unique_toolkit.agentic.tools.utils.execution.execution import (
|
|
28
|
-
Result,
|
|
29
|
-
SafeTaskExecutor,
|
|
30
|
-
)
|
|
31
31
|
from unique_toolkit.app.schemas import ChatEvent
|
|
32
32
|
from unique_toolkit.language_model.schemas import (
|
|
33
33
|
LanguageModelFunction,
|
|
@@ -14,7 +14,7 @@ from openai.types.responses import (
|
|
|
14
14
|
from openai.types.shared_params import Metadata, Reasoning
|
|
15
15
|
from pydantic import BaseModel, TypeAdapter, ValidationError
|
|
16
16
|
|
|
17
|
-
from unique_toolkit.
|
|
17
|
+
from unique_toolkit._common.execution import (
|
|
18
18
|
failsafe,
|
|
19
19
|
)
|
|
20
20
|
from unique_toolkit.content.schemas import ContentChunk
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from unique_toolkit.agentic.loop_runner.middleware.planning import (
|
|
2
|
-
PlanningConfig,
|
|
3
|
-
PlanningMiddleware,
|
|
4
|
-
PlanningSchemaConfig,
|
|
5
|
-
)
|
|
6
|
-
from unique_toolkit.agentic.loop_runner.middleware.qwen_forced_tool_call import (
|
|
7
|
-
QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION,
|
|
8
|
-
QwenForcedToolCallMiddleware,
|
|
9
|
-
is_qwen_model,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"PlanningConfig",
|
|
14
|
-
"PlanningMiddleware",
|
|
15
|
-
"PlanningSchemaConfig",
|
|
16
|
-
"QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION",
|
|
17
|
-
"QwenForcedToolCallMiddleware",
|
|
18
|
-
"is_qwen_model",
|
|
19
|
-
]
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from unique_toolkit.agentic.loop_runner.middleware.qwen_forced_tool_call.helpers import (
|
|
2
|
-
is_qwen_model,
|
|
3
|
-
)
|
|
4
|
-
from unique_toolkit.agentic.loop_runner.middleware.qwen_forced_tool_call.qwen_forced_tool_call import (
|
|
5
|
-
QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION,
|
|
6
|
-
QwenForcedToolCallMiddleware,
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
__all__ = [
|
|
10
|
-
"QwenForcedToolCallMiddleware",
|
|
11
|
-
"QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION",
|
|
12
|
-
"is_qwen_model",
|
|
13
|
-
]
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from typing import Unpack
|
|
3
|
-
|
|
4
|
-
from unique_toolkit.agentic.loop_runner.base import (
|
|
5
|
-
LoopIterationRunner,
|
|
6
|
-
_LoopIterationRunnerKwargs,
|
|
7
|
-
)
|
|
8
|
-
from unique_toolkit.agentic.loop_runner.middleware.qwen_forced_tool_call.helpers import (
|
|
9
|
-
append_qwen_forced_tool_call_instruction,
|
|
10
|
-
)
|
|
11
|
-
from unique_toolkit.chat.service import LanguageModelStreamResponse
|
|
12
|
-
|
|
13
|
-
_LOGGER = logging.getLogger(__name__)
|
|
14
|
-
|
|
15
|
-
QWEN_FORCED_TOOL_CALL_PROMPT_INSTRUCTION = (
|
|
16
|
-
"Tool Call Instruction: \nYou always have to return a tool call. "
|
|
17
|
-
"You must start the response with <tool_call> and end with </tool_call>. "
|
|
18
|
-
"Do NOT provide natural language explanations, summaries, or any text outside the <tool_call> block."
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class QwenForcedToolCallMiddleware(LoopIterationRunner):
|
|
23
|
-
def __init__(
|
|
24
|
-
self,
|
|
25
|
-
*,
|
|
26
|
-
loop_runner: LoopIterationRunner,
|
|
27
|
-
qwen_forced_tool_call_prompt_instruction: str,
|
|
28
|
-
) -> None:
|
|
29
|
-
self._qwen_forced_tool_call_prompt_instruction = (
|
|
30
|
-
qwen_forced_tool_call_prompt_instruction
|
|
31
|
-
)
|
|
32
|
-
self._loop_runner = loop_runner
|
|
33
|
-
|
|
34
|
-
async def __call__(
|
|
35
|
-
self, **kwargs: Unpack[_LoopIterationRunnerKwargs]
|
|
36
|
-
) -> LanguageModelStreamResponse:
|
|
37
|
-
tool_choices = kwargs.get("tool_choices") or []
|
|
38
|
-
iteration_index = kwargs["iteration_index"]
|
|
39
|
-
|
|
40
|
-
# For Qwen models, append tool call instruction to the last user message. These models ignore the parameter tool_choice.
|
|
41
|
-
if len(tool_choices) > 0 and iteration_index == 0 and kwargs.get("messages"):
|
|
42
|
-
_LOGGER.info(
|
|
43
|
-
"Appending tool call instruction to the last user message for Qwen models to force tool calls."
|
|
44
|
-
)
|
|
45
|
-
kwargs["messages"] = append_qwen_forced_tool_call_instruction(
|
|
46
|
-
messages=kwargs["messages"],
|
|
47
|
-
forced_tool_call_instruction=self._qwen_forced_tool_call_prompt_instruction,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return await self._loop_runner(**kwargs)
|