unique_toolkit 1.65.0__tar.gz → 1.65.2__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.65.0 → unique_toolkit-1.65.2}/PKG-INFO +1 -1
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/pyproject.toml +1 -1
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/config.py +5 -2
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/service.py +1 -25
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/tool_manager.py +0 -51
- unique_toolkit-1.65.0/unique_toolkit/agentic/tools/experimental/__init__.py +0 -11
- unique_toolkit-1.65.0/unique_toolkit/agentic/tools/experimental/open_file_tool/__init__.py +0 -11
- unique_toolkit-1.65.0/unique_toolkit/agentic/tools/experimental/open_file_tool/config.py +0 -97
- unique_toolkit-1.65.0/unique_toolkit/agentic/tools/experimental/open_file_tool/runtime.py +0 -390
- unique_toolkit-1.65.0/unique_toolkit/agentic/tools/experimental/open_file_tool/tool.py +0 -108
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/README.md +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/_base_service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/_time_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/api_calling/human_verification_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/base_model_type_attribute.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/chunk_relevancy_sorter/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/chunk_relevancy_sorter/exception.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/chunk_relevancy_sorter/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/chunk_relevancy_sorter/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/chunk_relevancy_sorter/tests/test_service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/README.md +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/__main__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/cli.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/differ.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/exporter.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/models.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/registry.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/config_checker/validator.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/default_language_model.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/pandoc_converter.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/docx_generator/template/Doc Template.docx +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/endpoint_builder.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/endpoint_requestor.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/event_bus.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/exception.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/execution.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/endpoint_builder.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/endpoint_requestor.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/README.md +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/agent.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/examples/data.csv +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/examples/example_usage.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/dataframe_handler/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/dataframe_handler/exceptions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/dataframe_handler/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/dataframe_handler/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/exceptions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/prompts/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/prompts/system_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/prompts/user_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/generation_handler/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/template_handler/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/template_handler/default_template.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/template_handler/exceptions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/template_handler/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/services/template_handler/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/experimental/write_up_agent/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/feature_flags/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/pydantic/rjsf_tags.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/pydantic_helpers.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/referencing.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/string_utilities.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/tests/test_referencing.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/tests/test_string_utilities.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/token/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/token/image_token_counting.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/token/token_counting.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/token/tokenizers/deepseek/tokenizer.json +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/token/tokenizers/qwen/tokenizer.json +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/files.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/image/encode.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/jinja/helpers.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/jinja/render.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/jinja/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/jinja/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/structured_output/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/structured_output/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/utils/write_configuration.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/validate_required_values.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/_common/validators.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/debug_info_manager/debug_info_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/debug_info_manager/test/test_debug_info_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/context_relevancy/prompts/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/context_relevancy/prompts/system_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/context_relevancy/prompts/user_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/context_relevancy/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/context_relevancy/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/evaluation_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/exception.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/hallucination_evaluation.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/prompts/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/prompts/system_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/prompts/user_prompt.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/hallucination/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/output_parser.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/fixtures.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_context_relevancy_service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_hallucination_constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_hallucination_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_output_parser.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/tests/test_prompt_loaders.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/evaluation/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/feature_flags/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/feature_flags/feature_flags.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/history_manager/history_construction_with_contents.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/history_manager/history_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/history_manager/loop_token_reducer.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/history_manager/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/_iteration_handler_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/_responses_iteration_handler_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/_responses_stream_handler_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/_stream_handler_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/base.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/middleware/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/middleware/planning/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/middleware/planning/planning.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/middleware/planning/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/basic.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/mistral/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/mistral/mistral_runner.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/qwen/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/qwen/helpers.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/loop_runner/runners/qwen/qwen_runner.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/message_log_manager/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/message_log_manager/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/postprocessor/postprocessor_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/reference_manager/reference_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/responses_api/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/responses_api/postprocessors/code_display.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/responses_api/postprocessors/generated_files.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/responses_api/stream_handler.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/short_term_memory_manager/persistent_short_term_memory_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/thinking_manager/thinking_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/evaluation/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/evaluation/_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/evaluation/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/evaluation/evaluator.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/evaluation/summarization_user_message.j2 +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/_display_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/_ref_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/display.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/references.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_display_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/postprocessing/test/test_ref_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/prompts.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/response_watcher/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/response_watcher/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/_memory.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/_schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/a2a/tool/test/test_service_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/agent_chunks_hanlder.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/factory.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/mcp/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/mcp/manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/mcp/models.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/mcp/tool_wrapper.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/base.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/postprocessors/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/postprocessors/code_display.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/postprocessors/generated_files.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/code_interpreter/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/openai_builtin/manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/test/test_mcp_manager.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/test/test_tool_progress_reporter.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/tool.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/tool_progress_reporter.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/utils/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/utils/source_handling/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/utils/source_handling/schema.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/utils/source_handling/source_formatting.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/utils/source_handling/tests/test_source_formatting.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic_table/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic_table/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic_table/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/dev_util.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/fast_api_factory.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/init_logging.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/init_sdk.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/performance/async_tasks.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/performance/async_wrapper.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/unique_settings.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/verification.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/app/webhook.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/cancellation.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/deprecated/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/rendering.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/responses_api.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/state.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/chat/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/smart_rules.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/content/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/README.md +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/augmented/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/augmented/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/base.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/basic/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/basic/config.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/basic/prompt.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/data_extraction/basic/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/exceptions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/elicitation/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/embedding/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/langchain/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/langchain/client.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/langchain/history.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/openai/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/openai/client.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/openai/message_builder.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/framework_utilities/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/_responses_api_utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/builder.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/default_language_model.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/infos.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/prompt.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/reference.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/stream_transform.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/language_model/utils.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/protocols/support.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/services/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/services/chat_service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/services/factory.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/services/knowledge_base.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/short_term_memory/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/short_term_memory/constants.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/short_term_memory/functions.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/short_term_memory/schemas.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/short_term_memory/service.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/smart_rules/__init__.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/smart_rules/compile.py +0 -0
- {unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/test_utilities/events.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: unique-toolkit
|
|
3
|
-
Version: 1.65.
|
|
3
|
+
Version: 1.65.2
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Cedric Klinkert, Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri, Ejiroghene Oki-Peter, Rami Azouz, Ricardo Visini, Sanzio Monti
|
|
6
6
|
Author-email: Cedric Klinkert <cedric.klinkert@unique.ch>, Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>, Ejiroghene Oki-Peter <oki-peter.ejiroghene@unique.ai>, Rami Azouz <rami.ext@unique.ch>, Ricardo Visini <ricardo.visini@unique.ch>, Sanzio Monti <sanzio.monti@unique.ai>
|
|
@@ -106,6 +106,7 @@ Handling User Queries:
|
|
|
106
106
|
- Whenever the user query requires using the python tool, you must always think first about the steps required.
|
|
107
107
|
- CRITICAL: If any step generates a plot or visualization, that code block MUST include `plt.savefig('/mnt/data/<filename>.png', bbox_inches='tight')` and `plt.close()` as the final lines. Code that only calls `plt.show()` without saving will NOT display the image to the user.
|
|
108
108
|
- CRITICAL: NEVER reference a `sandbox:/mnt/data/<filename>` link unless you have already executed code in this response that saved that exact file. Referencing a file that was not created by executed code will result in a broken link.
|
|
109
|
+
- CRITICAL: The sandbox has NO internet access. NEVER use `requests`, `httpx`, `urllib`, or any other HTTP library to fetch data from the web — these calls will always fail. If the user's query requires live web data (e.g. market prices, news, APIs), you MUST retrieve it using the web search tool first and then pass the result into the code interpreter.
|
|
109
110
|
- Use the tool multiple times:
|
|
110
111
|
- You MUST NOT guess anything about the structure of the data / files uploaded. Rather, you MUST perform some data exploration first.
|
|
111
112
|
- Example: User uploads an excel files and asks a question about it. First Read the data, explore the columns, columns types, etc. Then use the tool to answer the user's query.
|
|
@@ -138,10 +139,12 @@ class OpenAICodeInterpreterConfig(BaseToolConfig):
|
|
|
138
139
|
tool_description_for_system_prompt: Annotated[
|
|
139
140
|
str,
|
|
140
141
|
RJSFMetaTag.StringWidget.textarea(
|
|
141
|
-
rows=int(
|
|
142
|
+
rows=int(
|
|
143
|
+
len(DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT_FENCE.split("\n")) / 2
|
|
144
|
+
)
|
|
142
145
|
),
|
|
143
146
|
] = Field(
|
|
144
|
-
default=
|
|
147
|
+
default=DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT_FENCE,
|
|
145
148
|
description="The description of the tool that will be included in the system prompt.",
|
|
146
149
|
)
|
|
147
150
|
tool_description_for_user_prompt: SkipJsonSchema[str] = (
|
|
@@ -15,8 +15,6 @@ from unique_toolkit.agentic.tools.openai_builtin.base import (
|
|
|
15
15
|
OpenAIBuiltInToolName,
|
|
16
16
|
)
|
|
17
17
|
from unique_toolkit.agentic.tools.openai_builtin.code_interpreter.config import (
|
|
18
|
-
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT,
|
|
19
|
-
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT_FENCE,
|
|
20
18
|
OpenAICodeInterpreterConfig,
|
|
21
19
|
)
|
|
22
20
|
from unique_toolkit.agentic.tools.schemas import ToolPrompts
|
|
@@ -243,33 +241,11 @@ class OpenAICodeInterpreterTool(OpenAIBuiltInTool[CodeInterpreter]):
|
|
|
243
241
|
|
|
244
242
|
@override
|
|
245
243
|
def get_tool_prompts(self) -> ToolPrompts:
|
|
246
|
-
# When the fence feature flag is on the frontend derives the artifact title
|
|
247
|
-
# from the filename, so the LLM no longer needs to produce a markdown heading.
|
|
248
|
-
# We only substitute the fence-aware default when the operator has NOT
|
|
249
|
-
# customised the prompt — a custom value is always respected regardless of FF.
|
|
250
|
-
# When FF is off we always use the operator-configured prompt as-is.
|
|
251
|
-
fence_ff_on = feature_flags.enable_code_execution_fence_un_17972.is_enabled(
|
|
252
|
-
self._company_id
|
|
253
|
-
)
|
|
254
|
-
# A prompt is considered operator-customised only when it differs from every
|
|
255
|
-
# known default variant. Comparing against both defaults ensures spaces whose
|
|
256
|
-
# stored value was written by an earlier deployment (which may have used the
|
|
257
|
-
# non-fence default) are still treated as uncustomised once the fence FF is on.
|
|
258
|
-
stored = self._config.tool_description_for_system_prompt
|
|
259
|
-
operator_customised = stored not in {
|
|
260
|
-
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT,
|
|
261
|
-
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT_FENCE,
|
|
262
|
-
}
|
|
263
|
-
if fence_ff_on and not operator_customised:
|
|
264
|
-
system_prompt = DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT_FENCE
|
|
265
|
-
else:
|
|
266
|
-
system_prompt = stored
|
|
267
|
-
|
|
268
244
|
return ToolPrompts(
|
|
269
245
|
name="python", # https://platform.openai.com/docs/guides/tools-code-interpreter
|
|
270
246
|
display_name=self.DISPLAY_NAME,
|
|
271
247
|
tool_description=self._config.tool_description,
|
|
272
|
-
tool_system_prompt=
|
|
248
|
+
tool_system_prompt=self._config.tool_description_for_system_prompt,
|
|
273
249
|
tool_format_information_for_system_prompt="",
|
|
274
250
|
tool_user_prompt=self._config.tool_description_for_user_prompt,
|
|
275
251
|
tool_format_information_for_user_prompt="",
|
{unique_toolkit-1.65.0 → unique_toolkit-1.65.2}/unique_toolkit/agentic/tools/tool_manager.py
RENAMED
|
@@ -213,57 +213,6 @@ class _ToolManager(Generic[_ApiMode]):
|
|
|
213
213
|
def get_tool_prompts(self) -> list[ToolPrompts]:
|
|
214
214
|
return [tool.get_tool_prompts() for tool in self._tools]
|
|
215
215
|
|
|
216
|
-
def add_tool(self, tool: Tool) -> None:
|
|
217
|
-
"""Inject an externally constructed tool into the manager.
|
|
218
|
-
|
|
219
|
-
Use this for tools that require custom constructor arguments (e.g. a
|
|
220
|
-
shared registry) that cannot be built through ToolFactory.
|
|
221
|
-
"""
|
|
222
|
-
self._internal_tools.append(tool)
|
|
223
|
-
self.available_tools.append(tool)
|
|
224
|
-
self._tools.append(tool)
|
|
225
|
-
|
|
226
|
-
def exclude_tool(self, name: str) -> bool:
|
|
227
|
-
"""Exclude a tool by name from the active tool set.
|
|
228
|
-
|
|
229
|
-
The tool is removed from all internal tracking lists so it will no
|
|
230
|
-
longer be offered to the model or executed. Returns True if the tool
|
|
231
|
-
was present in at least one list.
|
|
232
|
-
"""
|
|
233
|
-
found = False
|
|
234
|
-
|
|
235
|
-
filtered_tools = [tool for tool in self._tools if tool.name != name]
|
|
236
|
-
found = found or len(filtered_tools) != len(self._tools)
|
|
237
|
-
self._tools = filtered_tools
|
|
238
|
-
|
|
239
|
-
filtered_internal_tools = [
|
|
240
|
-
tool for tool in self._internal_tools if tool.name != name
|
|
241
|
-
]
|
|
242
|
-
found = found or len(filtered_internal_tools) != len(self._internal_tools)
|
|
243
|
-
self._internal_tools = filtered_internal_tools
|
|
244
|
-
|
|
245
|
-
filtered_mcp_tools = [tool for tool in self._mcp_tools if tool.name != name]
|
|
246
|
-
found = found or len(filtered_mcp_tools) != len(self._mcp_tools)
|
|
247
|
-
self._mcp_tools = filtered_mcp_tools
|
|
248
|
-
|
|
249
|
-
filtered_sub_agents = [tool for tool in self._sub_agents if tool.name != name]
|
|
250
|
-
found = found or len(filtered_sub_agents) != len(self._sub_agents)
|
|
251
|
-
self._sub_agents = filtered_sub_agents
|
|
252
|
-
|
|
253
|
-
filtered_builtin_tools = [
|
|
254
|
-
tool for tool in self._builtin_tools if tool.name != name
|
|
255
|
-
]
|
|
256
|
-
found = found or len(filtered_builtin_tools) != len(self._builtin_tools)
|
|
257
|
-
self._builtin_tools = filtered_builtin_tools
|
|
258
|
-
|
|
259
|
-
filtered_available_tools = [
|
|
260
|
-
tool for tool in self.available_tools if tool.name != name
|
|
261
|
-
]
|
|
262
|
-
found = found or len(filtered_available_tools) != len(self.available_tools)
|
|
263
|
-
self.available_tools = filtered_available_tools
|
|
264
|
-
|
|
265
|
-
return found
|
|
266
|
-
|
|
267
216
|
def add_forced_tool(self, name):
|
|
268
217
|
tool = self.get_tool_by_name(name)
|
|
269
218
|
if not tool:
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from unique_toolkit.agentic.tools.experimental.open_file_tool.runtime import (
|
|
2
|
-
OpenFileToolRuntime,
|
|
3
|
-
OpenFileToolRuntimeConfig,
|
|
4
|
-
)
|
|
5
|
-
from unique_toolkit.agentic.tools.experimental.open_file_tool.tool import OpenFileTool
|
|
6
|
-
|
|
7
|
-
__all__ = [
|
|
8
|
-
"OpenFileTool",
|
|
9
|
-
"OpenFileToolRuntime",
|
|
10
|
-
"OpenFileToolRuntimeConfig",
|
|
11
|
-
]
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from typing import Annotated
|
|
2
|
-
|
|
3
|
-
from pydantic import Field
|
|
4
|
-
|
|
5
|
-
from unique_toolkit._common.pydantic.rjsf_tags import RJSFMetaTag
|
|
6
|
-
from unique_toolkit.agentic.tools.schemas import BaseToolConfig
|
|
7
|
-
|
|
8
|
-
DEFAULT_TOOL_DESCRIPTION = """Open one or more documents so you can read and reason over their full content. ALWAYS call this tool for any file you want to answer questions about — the text chunks from InternalSearch are lossy extracts and miss tables, charts, layout, and context. Opening the full file gives you far superior information.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT = """When the user asks you to work with, analyze, summarize, or reason over a document, you MUST open it with OpenFile before answering. The text chunks returned by InternalSearch are extracted fragments — they lose tables, charts, formatting, and cross-page context. Opening the full file gives you the complete document with all visual and structural information intact.
|
|
12
|
-
|
|
13
|
-
Workflow:
|
|
14
|
-
1. Use InternalSearch to find relevant documents and identify their content_ids.
|
|
15
|
-
2. Call OpenFile with the content_ids of the files you need.
|
|
16
|
-
3. The full files will be available in the next iteration for you to read.
|
|
17
|
-
4. Answer the user's question using the full file content, referencing the InternalSearch source numbers for citations.
|
|
18
|
-
|
|
19
|
-
You should still cite source numbers from InternalSearch in your answer (e.g. [source0]), but base your reasoning on the full opened file when available.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
DEFAULT_TOOL_PARAMETER_CONTENT_IDS_DESCRIPTION = """List of content_ids of the documents to open. Each content_id is found in search results as the 'content_id' field (starts with 'cont_')."""
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class OpenFileToolConfig(BaseToolConfig):
|
|
26
|
-
"""Configuration for the OpenFile tool."""
|
|
27
|
-
|
|
28
|
-
enabled: Annotated[
|
|
29
|
-
bool,
|
|
30
|
-
RJSFMetaTag.BooleanWidget.checkbox(
|
|
31
|
-
help=(
|
|
32
|
-
"Master switch for all Open File Tool. When disabled, "
|
|
33
|
-
"none of the other flags in this config block take effect."
|
|
34
|
-
),
|
|
35
|
-
),
|
|
36
|
-
] = Field(
|
|
37
|
-
default=False,
|
|
38
|
-
description="Enable the Open File Tool.",
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
send_files_in_payload: Annotated[
|
|
42
|
-
bool,
|
|
43
|
-
RJSFMetaTag.BooleanWidget.checkbox(
|
|
44
|
-
help=(
|
|
45
|
-
"Enable the OpenFile tool for knowledge-base files. When the agent "
|
|
46
|
-
"finds files via InternalSearch, it can call OpenFile with the "
|
|
47
|
-
"content_id to include the full document in the LLM context "
|
|
48
|
-
"(unique://content/<id> URLs, resolved to base64 by the backend). "
|
|
49
|
-
"Only takes effect when use_responses_api is also True."
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
] = Field(
|
|
53
|
-
default=False,
|
|
54
|
-
description="Enable the OpenFile tool for knowledge-base files.",
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
send_uploaded_files_in_payload: Annotated[
|
|
58
|
-
bool,
|
|
59
|
-
RJSFMetaTag.BooleanWidget.checkbox(
|
|
60
|
-
help=(
|
|
61
|
-
"Attach uploaded files directly to the LLM payload as full "
|
|
62
|
-
"documents (unique://content/<id> URLs, resolved to base64 by the "
|
|
63
|
-
"backend). When enabled, uploaded files bypass InternalSearch and "
|
|
64
|
-
"are included automatically from iteration 1. "
|
|
65
|
-
"Only takes effect when use_responses_api is also True."
|
|
66
|
-
),
|
|
67
|
-
),
|
|
68
|
-
] = Field(
|
|
69
|
-
default=False,
|
|
70
|
-
description="Attach uploaded files directly to the LLM payload.",
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
tool_description: Annotated[
|
|
74
|
-
str,
|
|
75
|
-
RJSFMetaTag.StringWidget.textarea(rows=3),
|
|
76
|
-
] = Field(
|
|
77
|
-
default=DEFAULT_TOOL_DESCRIPTION,
|
|
78
|
-
description="The description of the tool that will be included in the system prompt.",
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
tool_description_for_system_prompt: Annotated[
|
|
82
|
-
str,
|
|
83
|
-
RJSFMetaTag.StringWidget.textarea(rows=7),
|
|
84
|
-
] = Field(
|
|
85
|
-
default=DEFAULT_TOOL_DESCRIPTION_FOR_SYSTEM_PROMPT,
|
|
86
|
-
description="The description of the tool that will be included in the system prompt.",
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
tool_parameter_description_content_ids: Annotated[
|
|
90
|
-
str,
|
|
91
|
-
RJSFMetaTag.StringWidget.textarea(
|
|
92
|
-
rows=len(DEFAULT_TOOL_PARAMETER_CONTENT_IDS_DESCRIPTION.split("\n"))
|
|
93
|
-
),
|
|
94
|
-
] = Field(
|
|
95
|
-
default=DEFAULT_TOOL_PARAMETER_CONTENT_IDS_DESCRIPTION,
|
|
96
|
-
description="The description of the tool parameter 'content_ids'.",
|
|
97
|
-
)
|
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from datetime import datetime, timezone
|
|
5
|
-
from logging import Logger
|
|
6
|
-
from typing import Any
|
|
7
|
-
|
|
8
|
-
from unique_toolkit.agentic.evaluation.schemas import EvaluationMetricName
|
|
9
|
-
from unique_toolkit.agentic.message_log_manager.service import MessageStepLogger
|
|
10
|
-
from unique_toolkit.agentic.tools.tool_manager import (
|
|
11
|
-
ResponsesApiToolManager,
|
|
12
|
-
ToolManager,
|
|
13
|
-
)
|
|
14
|
-
from unique_toolkit.content.schemas import Content
|
|
15
|
-
from unique_toolkit.language_model.schemas import (
|
|
16
|
-
LanguageModelAssistantMessage,
|
|
17
|
-
LanguageModelFunction,
|
|
18
|
-
LanguageModelMessageRole,
|
|
19
|
-
LanguageModelMessages,
|
|
20
|
-
LanguageModelToolMessage,
|
|
21
|
-
LanguageModelUserMessage,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@dataclass(frozen=True)
|
|
26
|
-
class OpenFileToolRuntimeConfig:
|
|
27
|
-
"""Flat configuration for the OpenFileTool runtime.
|
|
28
|
-
|
|
29
|
-
The orchestrator is responsible for mapping its own nested config
|
|
30
|
-
(e.g. ``UniqueAIConfig``) into this structure.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
enabled: bool = False
|
|
34
|
-
send_files_in_payload: bool = False
|
|
35
|
-
send_uploaded_files_in_payload: bool = False
|
|
36
|
-
use_responses_api: bool = False
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class OpenFileToolRuntime:
|
|
40
|
-
"""Runtime helper for the experimental OpenFile payload flow."""
|
|
41
|
-
|
|
42
|
-
_OPEN_FILE_TOOL_NAME = "OpenFile"
|
|
43
|
-
_RETRY_SIGNALS = (
|
|
44
|
-
"too large",
|
|
45
|
-
"payload too large",
|
|
46
|
-
"request entity too large",
|
|
47
|
-
"content_length_exceeded",
|
|
48
|
-
"max_tokens",
|
|
49
|
-
"context_length_exceeded",
|
|
50
|
-
"413",
|
|
51
|
-
"request too large",
|
|
52
|
-
"403 forbidden",
|
|
53
|
-
"application-gateway",
|
|
54
|
-
)
|
|
55
|
-
_FILE_TOO_LARGE_TOOL_RESPONSE = (
|
|
56
|
-
"ERROR: The file is too large to open. "
|
|
57
|
-
"Could not include the document in the context. "
|
|
58
|
-
"Please inform the user that the file is too large to process directly "
|
|
59
|
-
"and suggest asking an admin to include the document in the knowledge base."
|
|
60
|
-
)
|
|
61
|
-
_OPEN_FILE_SYSTEM_REMINDER = (
|
|
62
|
-
"<|system_reminder|>Documents were found in the search results. "
|
|
63
|
-
"For any file you want to reference or reason over, call the OpenFile tool "
|
|
64
|
-
"with the content_id from the search results. The document name is shown "
|
|
65
|
-
"inside <|document|>...<|/document|> tags in the content field. "
|
|
66
|
-
"The full file provides far better information than the extracted text "
|
|
67
|
-
"chunks (tables, charts, layout, and cross-page context are preserved)."
|
|
68
|
-
"<|/system_reminder|>"
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
def __init__(
|
|
72
|
-
self,
|
|
73
|
-
logger: Logger,
|
|
74
|
-
config: OpenFileToolRuntimeConfig,
|
|
75
|
-
content_service: Any,
|
|
76
|
-
tool_manager: ResponsesApiToolManager | ToolManager,
|
|
77
|
-
message_step_logger: MessageStepLogger,
|
|
78
|
-
agent_file_registry: list[str],
|
|
79
|
-
) -> None:
|
|
80
|
-
self._logger = logger
|
|
81
|
-
self._config = config
|
|
82
|
-
self._content_service = content_service
|
|
83
|
-
self._tool_manager = tool_manager
|
|
84
|
-
self._message_step_logger = message_step_logger
|
|
85
|
-
self._agent_file_registry = agent_file_registry
|
|
86
|
-
self._cached_uploaded_documents: list[Content] | None = None
|
|
87
|
-
self._file_payload_attachments_disabled = False
|
|
88
|
-
|
|
89
|
-
def should_attach_content_files(self) -> bool:
|
|
90
|
-
if self._file_payload_attachments_disabled:
|
|
91
|
-
return False
|
|
92
|
-
|
|
93
|
-
return self._is_feature_enabled() and (
|
|
94
|
-
self._kb_file_payload_enabled() or self._uploaded_file_payload_enabled()
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
def inject_content_files_into_user_message(
|
|
98
|
-
self, messages: LanguageModelMessages
|
|
99
|
-
) -> LanguageModelMessages:
|
|
100
|
-
file_parts = self._collect_content_file_parts()
|
|
101
|
-
if not file_parts:
|
|
102
|
-
return messages
|
|
103
|
-
|
|
104
|
-
for index in range(len(messages.root) - 1, -1, -1):
|
|
105
|
-
message = messages.root[index]
|
|
106
|
-
if message.role != LanguageModelMessageRole.USER:
|
|
107
|
-
continue
|
|
108
|
-
|
|
109
|
-
content_parts: list[dict[str, Any]] = []
|
|
110
|
-
if isinstance(message.content, str):
|
|
111
|
-
content_parts.append({"type": "text", "text": message.content})
|
|
112
|
-
elif isinstance(message.content, list):
|
|
113
|
-
content_parts.extend(
|
|
114
|
-
part for part in message.content if isinstance(part, dict)
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
if not content_parts:
|
|
118
|
-
content_parts = [{"type": "text", "text": ""}]
|
|
119
|
-
|
|
120
|
-
messages.root[index] = LanguageModelUserMessage(
|
|
121
|
-
content=content_parts + file_parts
|
|
122
|
-
)
|
|
123
|
-
break
|
|
124
|
-
|
|
125
|
-
return messages
|
|
126
|
-
|
|
127
|
-
def should_retry_without_files(self, exc: Exception) -> bool:
|
|
128
|
-
if self._file_payload_attachments_disabled:
|
|
129
|
-
return False
|
|
130
|
-
if not self._is_feature_enabled():
|
|
131
|
-
return False
|
|
132
|
-
if (
|
|
133
|
-
not self._kb_file_payload_enabled()
|
|
134
|
-
and not self._uploaded_file_payload_enabled()
|
|
135
|
-
):
|
|
136
|
-
return False
|
|
137
|
-
|
|
138
|
-
has_kb_files = self._kb_file_payload_enabled() and bool(
|
|
139
|
-
self._agent_file_registry
|
|
140
|
-
)
|
|
141
|
-
has_uploaded_files = self._uploaded_file_payload_enabled() and bool(
|
|
142
|
-
self._get_uploaded_documents()
|
|
143
|
-
)
|
|
144
|
-
if not has_kb_files and not has_uploaded_files:
|
|
145
|
-
return False
|
|
146
|
-
|
|
147
|
-
error_text = str(exc).lower()
|
|
148
|
-
return any(signal in error_text for signal in self._RETRY_SIGNALS)
|
|
149
|
-
|
|
150
|
-
def prepare_retry_messages(
|
|
151
|
-
self, messages: LanguageModelMessages
|
|
152
|
-
) -> LanguageModelMessages:
|
|
153
|
-
self._tool_manager.exclude_tool(self._OPEN_FILE_TOOL_NAME)
|
|
154
|
-
self._file_payload_attachments_disabled = True
|
|
155
|
-
|
|
156
|
-
messages = self.strip_file_parts_from_messages(messages)
|
|
157
|
-
|
|
158
|
-
if self._kb_file_payload_enabled():
|
|
159
|
-
self._strip_open_file_messages(messages)
|
|
160
|
-
if self._uploaded_file_payload_enabled():
|
|
161
|
-
self._inject_uploaded_file_fallback_messages(messages)
|
|
162
|
-
|
|
163
|
-
self._agent_file_registry.clear()
|
|
164
|
-
return messages
|
|
165
|
-
|
|
166
|
-
async def report_file_fallback_step(self) -> None:
|
|
167
|
-
await self._message_step_logger.create_message_log_entry_async(
|
|
168
|
-
text=(
|
|
169
|
-
"**Open File:** The file is too large to open. "
|
|
170
|
-
"Please ask an admin to include the document in the knowledge base."
|
|
171
|
-
),
|
|
172
|
-
references=[],
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
def filter_evaluation_names(
|
|
176
|
-
self, evaluation_names: list[EvaluationMetricName]
|
|
177
|
-
) -> list[EvaluationMetricName]:
|
|
178
|
-
if not self._agent_file_registry:
|
|
179
|
-
return evaluation_names
|
|
180
|
-
|
|
181
|
-
filtered_names = [
|
|
182
|
-
name
|
|
183
|
-
for name in evaluation_names
|
|
184
|
-
if name != EvaluationMetricName.HALLUCINATION
|
|
185
|
-
]
|
|
186
|
-
if len(filtered_names) != len(evaluation_names):
|
|
187
|
-
self._logger.info(
|
|
188
|
-
"OpenFile was used - skipping hallucination check "
|
|
189
|
-
"(LLM has full file content, not just search chunks)."
|
|
190
|
-
)
|
|
191
|
-
return filtered_names
|
|
192
|
-
|
|
193
|
-
def inject_open_file_reminder(self, tool_call_responses: list[Any]) -> None:
|
|
194
|
-
if not self._tool_manager.get_tool_by_name(self._OPEN_FILE_TOOL_NAME):
|
|
195
|
-
return
|
|
196
|
-
|
|
197
|
-
for response in tool_call_responses:
|
|
198
|
-
if response.name != "InternalSearch":
|
|
199
|
-
continue
|
|
200
|
-
|
|
201
|
-
has_pdf_chunks = any(
|
|
202
|
-
chunk.key and chunk.key.split(" : ")[0].lower().endswith(".pdf")
|
|
203
|
-
for chunk in (response.content_chunks or [])
|
|
204
|
-
)
|
|
205
|
-
if not has_pdf_chunks:
|
|
206
|
-
continue
|
|
207
|
-
|
|
208
|
-
existing_reminder = response.system_reminder or ""
|
|
209
|
-
response.system_reminder = (
|
|
210
|
-
f"{existing_reminder}\n{self._OPEN_FILE_SYSTEM_REMINDER}".strip()
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
def get_uploaded_documents(self) -> list[Content]:
|
|
214
|
-
return self._get_uploaded_documents()
|
|
215
|
-
|
|
216
|
-
@staticmethod
|
|
217
|
-
def strip_file_parts_from_messages(
|
|
218
|
-
messages: LanguageModelMessages,
|
|
219
|
-
) -> LanguageModelMessages:
|
|
220
|
-
for index, message in enumerate(messages.root):
|
|
221
|
-
if message.role != LanguageModelMessageRole.USER:
|
|
222
|
-
continue
|
|
223
|
-
if not isinstance(message.content, list):
|
|
224
|
-
continue
|
|
225
|
-
|
|
226
|
-
content_parts = [
|
|
227
|
-
part
|
|
228
|
-
for part in message.content
|
|
229
|
-
if not (isinstance(part, dict) and part.get("type") == "file")
|
|
230
|
-
]
|
|
231
|
-
if len(content_parts) == len(message.content):
|
|
232
|
-
continue
|
|
233
|
-
|
|
234
|
-
messages.root[index] = LanguageModelUserMessage(content=content_parts)
|
|
235
|
-
|
|
236
|
-
return messages
|
|
237
|
-
|
|
238
|
-
def _is_feature_enabled(self) -> bool:
|
|
239
|
-
return self._config.use_responses_api and self._config.enabled
|
|
240
|
-
|
|
241
|
-
def _kb_file_payload_enabled(self) -> bool:
|
|
242
|
-
return self._config.send_files_in_payload
|
|
243
|
-
|
|
244
|
-
def _uploaded_file_payload_enabled(self) -> bool:
|
|
245
|
-
return self._config.send_uploaded_files_in_payload
|
|
246
|
-
|
|
247
|
-
def _get_uploaded_documents(self) -> list[Content]:
|
|
248
|
-
if self._cached_uploaded_documents is None:
|
|
249
|
-
now = datetime.now(timezone.utc)
|
|
250
|
-
all_documents = self._content_service.get_documents_uploaded_to_chat()
|
|
251
|
-
uploaded_documents = [
|
|
252
|
-
document
|
|
253
|
-
for document in all_documents
|
|
254
|
-
if (document.expired_at is None or document.expired_at > now)
|
|
255
|
-
and document.key.lower().endswith(".pdf")
|
|
256
|
-
]
|
|
257
|
-
self._cached_uploaded_documents = sorted(
|
|
258
|
-
uploaded_documents,
|
|
259
|
-
key=lambda document: (
|
|
260
|
-
document.created_at is None,
|
|
261
|
-
document.created_at or datetime.max.replace(tzinfo=timezone.utc),
|
|
262
|
-
),
|
|
263
|
-
)
|
|
264
|
-
return self._cached_uploaded_documents
|
|
265
|
-
|
|
266
|
-
def _collect_content_file_parts(self) -> list[dict[str, dict[str, str] | str]]:
|
|
267
|
-
if self._file_payload_attachments_disabled:
|
|
268
|
-
return []
|
|
269
|
-
|
|
270
|
-
seen_ids: set[str] = set()
|
|
271
|
-
file_parts: list[dict[str, dict[str, str] | str]] = []
|
|
272
|
-
|
|
273
|
-
if self._uploaded_file_payload_enabled():
|
|
274
|
-
for document in self._get_uploaded_documents():
|
|
275
|
-
if not document.id or document.id in seen_ids:
|
|
276
|
-
continue
|
|
277
|
-
|
|
278
|
-
seen_ids.add(document.id)
|
|
279
|
-
file_parts.append(
|
|
280
|
-
{
|
|
281
|
-
"type": "file",
|
|
282
|
-
"file": {
|
|
283
|
-
"filename": document.key or document.id,
|
|
284
|
-
"file_data": f"unique://content/{document.id}",
|
|
285
|
-
},
|
|
286
|
-
}
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
if self._kb_file_payload_enabled():
|
|
290
|
-
for content_id in self._agent_file_registry:
|
|
291
|
-
if content_id in seen_ids:
|
|
292
|
-
continue
|
|
293
|
-
|
|
294
|
-
seen_ids.add(content_id)
|
|
295
|
-
file_parts.append(
|
|
296
|
-
{
|
|
297
|
-
"type": "file",
|
|
298
|
-
"file": {
|
|
299
|
-
"filename": content_id,
|
|
300
|
-
"file_data": f"unique://content/{content_id}",
|
|
301
|
-
},
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
|
|
305
|
-
return file_parts
|
|
306
|
-
|
|
307
|
-
@staticmethod
|
|
308
|
-
def _is_empty_assistant_content(
|
|
309
|
-
content: str | list[dict[str, Any]] | None,
|
|
310
|
-
) -> bool:
|
|
311
|
-
if content is None:
|
|
312
|
-
return True
|
|
313
|
-
if isinstance(content, str):
|
|
314
|
-
return not content.strip()
|
|
315
|
-
if isinstance(content, list):
|
|
316
|
-
return len(content) == 0
|
|
317
|
-
return False
|
|
318
|
-
|
|
319
|
-
def _strip_open_file_messages(self, messages: LanguageModelMessages) -> None:
|
|
320
|
-
open_file_call_ids: set[str] = set()
|
|
321
|
-
|
|
322
|
-
for message in messages.root:
|
|
323
|
-
if not isinstance(message, LanguageModelAssistantMessage):
|
|
324
|
-
continue
|
|
325
|
-
if not message.tool_calls:
|
|
326
|
-
continue
|
|
327
|
-
|
|
328
|
-
for tool_call in message.tool_calls:
|
|
329
|
-
if tool_call.function.name == self._OPEN_FILE_TOOL_NAME:
|
|
330
|
-
open_file_call_ids.add(tool_call.id or tool_call.function.id)
|
|
331
|
-
|
|
332
|
-
if not open_file_call_ids:
|
|
333
|
-
return
|
|
334
|
-
|
|
335
|
-
messages.root[:] = [
|
|
336
|
-
message
|
|
337
|
-
for message in messages.root
|
|
338
|
-
if not (
|
|
339
|
-
isinstance(message, LanguageModelToolMessage)
|
|
340
|
-
and message.tool_call_id in open_file_call_ids
|
|
341
|
-
)
|
|
342
|
-
]
|
|
343
|
-
|
|
344
|
-
for message in messages.root:
|
|
345
|
-
if not isinstance(message, LanguageModelAssistantMessage):
|
|
346
|
-
continue
|
|
347
|
-
if not message.tool_calls:
|
|
348
|
-
continue
|
|
349
|
-
|
|
350
|
-
message.tool_calls = [
|
|
351
|
-
tool_call
|
|
352
|
-
for tool_call in message.tool_calls
|
|
353
|
-
if tool_call.function.name != self._OPEN_FILE_TOOL_NAME
|
|
354
|
-
]
|
|
355
|
-
if not message.tool_calls:
|
|
356
|
-
message.tool_calls = None
|
|
357
|
-
|
|
358
|
-
messages.root[:] = [
|
|
359
|
-
message
|
|
360
|
-
for message in messages.root
|
|
361
|
-
if not (
|
|
362
|
-
isinstance(message, LanguageModelAssistantMessage)
|
|
363
|
-
and not message.tool_calls
|
|
364
|
-
and self._is_empty_assistant_content(message.content)
|
|
365
|
-
)
|
|
366
|
-
]
|
|
367
|
-
|
|
368
|
-
def _inject_uploaded_file_fallback_messages(
|
|
369
|
-
self, messages: LanguageModelMessages
|
|
370
|
-
) -> None:
|
|
371
|
-
uploaded_documents = self._get_uploaded_documents()
|
|
372
|
-
if not uploaded_documents:
|
|
373
|
-
return
|
|
374
|
-
|
|
375
|
-
content_ids = [document.id for document in uploaded_documents if document.id]
|
|
376
|
-
if not content_ids:
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
function = LanguageModelFunction(
|
|
380
|
-
name=self._OPEN_FILE_TOOL_NAME,
|
|
381
|
-
arguments={"content_ids": content_ids},
|
|
382
|
-
)
|
|
383
|
-
assistant_message = LanguageModelAssistantMessage.from_functions([function])
|
|
384
|
-
tool_message = LanguageModelToolMessage(
|
|
385
|
-
content=self._FILE_TOO_LARGE_TOOL_RESPONSE,
|
|
386
|
-
name=self._OPEN_FILE_TOOL_NAME,
|
|
387
|
-
tool_call_id=function.id,
|
|
388
|
-
)
|
|
389
|
-
messages.root.append(assistant_message)
|
|
390
|
-
messages.root.append(tool_message)
|