iatoolkit 2.3.0__tar.gz → 2.3.1__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.
- {iatoolkit-2.3.0/src/iatoolkit.egg-info → iatoolkit-2.3.1}/PKG-INFO +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/__init__.py +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/routes.py +12 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/config/system_prompts_pack.yaml +8 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/company_context_service.py +29 -20
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/context_builder_service.py +15 -24
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/query_service.py +241 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/system_prompt_catalog.py +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/chat_state_rules.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/chat_user_profile.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/core_identity.prompt +5 -2
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/email_output.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/file_download_output.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/html_structures.prompt +3 -3
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/links_documents.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/multimodal_basics.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/output_basics.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/presentation_formatting.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/sql_aggregation_scope.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/sql_casting.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/sql_core.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/sql_jsonb.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/tool_html_passthrough.prompt +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1/src/iatoolkit.egg-info}/PKG-INFO +1 -1
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/LICENSE +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/LICENSE_COMMUNITY.md +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/pyproject.toml +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/readme.md +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/requirements.txt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/setup.cfg +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/base_company.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/cli_commands.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/exceptions.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/asset_storage.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/database_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/memory_compilation_trigger.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/memory_lint_trigger.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/secret_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/signup_policy_resolver.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/interfaces/web_search_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/model_registry.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/secret_resolver.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/session_manager.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/common/util.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/company_registry.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/config/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/config/llm_capabilities.yaml +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/config/system_tools_pack.yaml +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/core.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/brevo_mail_app.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/call_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/file_connector.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/file_connector_factory.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/google_cloud_storage_connector.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/google_drive_connector.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/local_file_connector.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/connectors/s3_connector.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/google_auth_client.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/google_chat_app.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/inference_embeddings_client.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/inference_handler.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/jina_embeddings_client.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/anthropic_adapter.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/deepseek_adapter.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/gemini_adapter.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/openai_adapter.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_providers/openai_compatible_chat_adapter.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_proxy.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/llm_response.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/infra/redis_session_manager.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/locales/en.yaml +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/locales/es.yaml +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/api_key_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/database_manager.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/document_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/env_secret_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/filesystem_asset_repository.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/llm_query_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/memory_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/models.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/profile_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/prompt_resource_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/sql_dataset_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/sql_source_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/repositories/vs_repo.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/api_key_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/attachment_policy_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/auth_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/benchmark_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/branding_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/configuration_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/dispatcher_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/embedding_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/excel_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/file_processor_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/history_manager_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/http_tool_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/i18n_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/inference_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/jwt_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/knowledge_base_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/language_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/license_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/llm_client_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/mail_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/memory_compiler_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/memory_lint_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/memory_lookup_policy_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/memory_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/memory_wiki_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/noop_memory_compilation_trigger.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/noop_memory_lint_trigger.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/contracts.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/image_normalizer.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/parsing_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/pdf_ocr_detection.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/provider_factory.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/provider_resolver.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/providers/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/providers/basic_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/providers/docling_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/parsers/validator.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/pdf_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/profile_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/prompt_resource_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/prompt_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/signup_policy_resolver.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/sql_dataset_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/sql_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/sql_source_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/storage_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/structured_output_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/system_tools.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/tool_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/user_feedback_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/user_session_context_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/visual_kb_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/visual_tool_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/warmup_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/web_search/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/web_search/provider_factory.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/web_search/providers/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/web_search/providers/brave_provider.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/services/web_search_service.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/images/fernando.jpeg +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/images/iatoolkit_core.png +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/images/iatoolkit_logo.png +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_feedback_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_filepond.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_help_content.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_history_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_logout_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_main.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_memory_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_model_selector.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_onboarding_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_prompt_manager.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/js/chat_reload_button.js +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/chat_iatoolkit.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/chat_modal.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/chat_public.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/documents.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/landing_page.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/llm_output.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/static/styles/onboarding.css +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/format_styles.prompt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/query_main.prompt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/system_prompts/sql_rules.prompt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/_company_header.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/_login_widget.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/base.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/change_password.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/chat.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/chat_memory_modal.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/chat_modals.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/error.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/forgot_password.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/home_hosted_default.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/memory/wiki_schema.md +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/onboarding_shell.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/pdf/base.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/pdf/letter.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/pdf/report.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/pdf/simple.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/templates/signup.html +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/__init__.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/api_key_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/base_login_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/categories_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/change_password_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/chat_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/configuration_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/connectors_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/embedding_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/forgot_password_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/help_content_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/history_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/home_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/init_context_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/llmquery_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/load_document_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/login_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/logout_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/memory_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/profile_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/prompt_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/prompt_resource_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/rag_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/root_redirect_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/signup_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/static_page_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/tool_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/user_feedback_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/users_api_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit/views/verify_user_view.py +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit.egg-info/SOURCES.txt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit.egg-info/dependency_links.txt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit.egg-info/requires.txt +0 -0
- {iatoolkit-2.3.0 → iatoolkit-2.3.1}/src/iatoolkit.egg-info/top_level.txt +0 -0
|
@@ -22,6 +22,8 @@ def register_views(app):
|
|
|
22
22
|
from iatoolkit.views.load_document_api_view import LoadDocumentApiView
|
|
23
23
|
from iatoolkit.views.user_feedback_api_view import UserFeedbackApiView
|
|
24
24
|
from iatoolkit.views.prompt_api_view import PromptApiView
|
|
25
|
+
from iatoolkit.views.chat_context_preview_api_view import ChatContextPreviewApiView
|
|
26
|
+
from iatoolkit.views.prompt_context_preview_api_view import PromptContextPreviewApiView
|
|
25
27
|
from iatoolkit.views.prompt_resource_api_view import PromptResourceApiView
|
|
26
28
|
from iatoolkit.views.history_api_view import HistoryApiView
|
|
27
29
|
from iatoolkit.views.help_content_api_view import HelpContentApiView
|
|
@@ -123,6 +125,16 @@ def register_views(app):
|
|
|
123
125
|
view_func=prompt_view,
|
|
124
126
|
methods=['GET', 'POST','PUT', 'DELETE'])
|
|
125
127
|
|
|
128
|
+
app.add_url_rule(
|
|
129
|
+
'/<string:company_short_name>/api/admin/context-preview/chat',
|
|
130
|
+
view_func=ChatContextPreviewApiView.as_view('chat_context_preview_api'),
|
|
131
|
+
methods=['GET'],
|
|
132
|
+
)
|
|
133
|
+
app.add_url_rule(
|
|
134
|
+
'/<string:company_short_name>/api/admin/prompts/<string:prompt_name>/context-preview',
|
|
135
|
+
view_func=PromptContextPreviewApiView.as_view('prompt_context_preview_api'),
|
|
136
|
+
methods=['POST'],
|
|
137
|
+
)
|
|
126
138
|
app.add_url_rule(
|
|
127
139
|
'/<string:company_short_name>/api/admin/prompts/<string:prompt_name>/resources',
|
|
128
140
|
view_func=PromptResourceApiView.as_view('prompt_resources_api'),
|
|
@@ -22,6 +22,14 @@ prompts:
|
|
|
22
22
|
execution_modes:
|
|
23
23
|
- chat
|
|
24
24
|
- agent
|
|
25
|
+
- key: memory_usage
|
|
26
|
+
filename: memory_usage.prompt
|
|
27
|
+
include:
|
|
28
|
+
execution_modes:
|
|
29
|
+
- chat
|
|
30
|
+
- agent
|
|
31
|
+
all_capabilities:
|
|
32
|
+
- can_use_memory
|
|
25
33
|
- key: multimodal_basics
|
|
26
34
|
filename: multimodal_basics.prompt
|
|
27
35
|
include:
|
|
@@ -34,9 +34,11 @@ class CompanyContextService:
|
|
|
34
34
|
"""
|
|
35
35
|
Builds the full context by aggregating three sources:
|
|
36
36
|
1. Static context files (Markdown).
|
|
37
|
-
2.
|
|
37
|
+
2. Physical SQL schemas and enriched metadata.
|
|
38
|
+
3. Residual schema files (YAML files not already covered by SQL enrichment).
|
|
38
39
|
"""
|
|
39
40
|
context_parts = []
|
|
41
|
+
db_tables = []
|
|
40
42
|
|
|
41
43
|
# 1. Context from Markdown (context/*.md) files
|
|
42
44
|
try:
|
|
@@ -46,20 +48,24 @@ class CompanyContextService:
|
|
|
46
48
|
except Exception as e:
|
|
47
49
|
logging.warning(f"Could not load Markdown context for '{company_short_name}': {e}")
|
|
48
50
|
|
|
49
|
-
# 2.
|
|
50
|
-
|
|
51
|
+
# 2. Resolve company-specific SQL databases. We collect them first so YAML
|
|
52
|
+
# context can avoid duplicating table definitions already covered by SQL.
|
|
53
|
+
sql_context = ""
|
|
51
54
|
try:
|
|
52
55
|
sql_context, db_tables = self._get_sql_enriched_context(company_short_name)
|
|
53
|
-
if sql_context:
|
|
54
|
-
context_parts.append(sql_context)
|
|
55
56
|
except Exception as e:
|
|
56
57
|
logging.warning(f"Could not generate SQL context for '{company_short_name}': {e}")
|
|
57
58
|
|
|
58
|
-
# 3.
|
|
59
|
+
# 3. Append physical SQL context after markdown. Table-level YAML metadata
|
|
60
|
+
# is already merged inline inside the enriched SQL definitions.
|
|
61
|
+
if sql_context:
|
|
62
|
+
context_parts.append(sql_context)
|
|
63
|
+
|
|
64
|
+
# 4. Context from residual yaml (schema/*.yaml) files
|
|
59
65
|
try:
|
|
60
66
|
yaml_schema_context = self._get_yaml_schema_context(company_short_name, db_tables)
|
|
61
67
|
if yaml_schema_context:
|
|
62
|
-
context_parts.append(yaml_schema_context)
|
|
68
|
+
context_parts.append(f"## Esquemas adicionales\n\n{yaml_schema_context.strip()}")
|
|
63
69
|
except Exception as e:
|
|
64
70
|
logging.warning(f"Could not load Yaml context for '{company_short_name}': {e}")
|
|
65
71
|
|
|
@@ -112,16 +118,15 @@ class CompanyContextService:
|
|
|
112
118
|
continue
|
|
113
119
|
|
|
114
120
|
# 2. Build Header for this Database
|
|
115
|
-
db_context = f"
|
|
121
|
+
db_context = f"### Base SQL (`database_key`): {db_name}\n"
|
|
116
122
|
|
|
117
123
|
# Optional: Add DB description from config if available (useful context)
|
|
118
124
|
db_desc = source.get('description', '')
|
|
119
125
|
if db_desc:
|
|
120
|
-
db_context += f"
|
|
126
|
+
db_context += f"- Descripcion: {db_desc}\n"
|
|
121
127
|
|
|
122
128
|
db_context += (
|
|
123
|
-
f"
|
|
124
|
-
f"**iat_sql_query**, with `database_key='{db_name}'`.\n"
|
|
129
|
+
f"- Usa `iat_sql_query` con `database_key='{db_name}'` para consultar esta base.\n"
|
|
125
130
|
)
|
|
126
131
|
|
|
127
132
|
# 3. Format Tables
|
|
@@ -130,11 +135,11 @@ class CompanyContextService:
|
|
|
130
135
|
columns = table_data.get('columns', [])
|
|
131
136
|
|
|
132
137
|
# Table Header
|
|
133
|
-
table_str = f"\
|
|
138
|
+
table_str = f"\n\n#### Tabla: `{table_name}`"
|
|
134
139
|
if table_desc:
|
|
135
|
-
table_str += f"\
|
|
140
|
+
table_str += f"\n- Descripcion: {table_desc}"
|
|
136
141
|
|
|
137
|
-
table_str += "\
|
|
142
|
+
table_str += "\n- Columnas:"
|
|
138
143
|
|
|
139
144
|
# Format Columns
|
|
140
145
|
for col in columns:
|
|
@@ -171,7 +176,11 @@ class CompanyContextService:
|
|
|
171
176
|
if not context_output:
|
|
172
177
|
return "", []
|
|
173
178
|
|
|
174
|
-
header =
|
|
179
|
+
header = (
|
|
180
|
+
"## Bases de datos SQL disponibles\n\n"
|
|
181
|
+
"Estas son las bases SQL que puedes consultar usando `iat_sql_query`. "
|
|
182
|
+
"El schema a continuacion incluye metadata enriquecida.\n"
|
|
183
|
+
)
|
|
175
184
|
return header + "\n\n---\n\n".join(context_output), db_tables
|
|
176
185
|
|
|
177
186
|
|
|
@@ -206,7 +215,7 @@ class CompanyContextService:
|
|
|
206
215
|
# 4. Generate markdown description from the dict
|
|
207
216
|
if schema_dict:
|
|
208
217
|
# We use generate_schema_table which accepts a dict directly
|
|
209
|
-
yaml_schema_context += self.generate_schema_table(schema_dict)
|
|
218
|
+
yaml_schema_context += self.generate_schema_table(schema_dict) + "\n\n"
|
|
210
219
|
|
|
211
220
|
except Exception as e:
|
|
212
221
|
logging.warning(f"Error processing schema file {filename}: {e}")
|
|
@@ -227,25 +236,25 @@ class CompanyContextService:
|
|
|
227
236
|
|
|
228
237
|
root_name = keys[0]
|
|
229
238
|
root_data = schema[root_name]
|
|
230
|
-
output = [f"
|
|
239
|
+
output = [f"### Objeto: `{root_name}`"]
|
|
231
240
|
|
|
232
241
|
# table description
|
|
233
242
|
root_description = root_data.get('description', '')
|
|
234
243
|
if root_description:
|
|
235
244
|
clean_desc = root_description.replace('\n', ' ').strip()
|
|
236
|
-
output.append(f"
|
|
245
|
+
output.append(f"- Descripcion: {clean_desc}")
|
|
237
246
|
|
|
238
247
|
# extract columns and properties from the root object
|
|
239
248
|
# priority: columns > properties > fields
|
|
240
249
|
properties = root_data.get('columns', root_data.get('properties', {}))
|
|
241
250
|
if properties:
|
|
242
|
-
output.append("
|
|
251
|
+
output.append("#### Estructura de datos")
|
|
243
252
|
|
|
244
253
|
# use indent_level 0 for the main columns
|
|
245
254
|
# call recursive function to format the properties
|
|
246
255
|
output.append(self._format_json_schema(properties, 0))
|
|
247
256
|
else:
|
|
248
|
-
output.append("
|
|
257
|
+
output.append("_Sin definicion de estructura._")
|
|
249
258
|
|
|
250
259
|
return "\n".join(output)
|
|
251
260
|
|
|
@@ -190,12 +190,12 @@ class ContextBuilderService:
|
|
|
190
190
|
# 3. Get company specific context (DB Schemas, Docs, etc.)
|
|
191
191
|
company_specific_context = self.company_context_service.get_company_context(company_short_name)
|
|
192
192
|
collection_context = self._build_collection_context(company_short_name)
|
|
193
|
-
memory_context = self._build_memory_context()
|
|
194
193
|
|
|
195
|
-
# 4. Merge contexts
|
|
196
|
-
|
|
194
|
+
# 4. Merge contexts. Conversational chat sees behavior and identity first,
|
|
195
|
+
# then retrieval hints, and only then the heavier company data blocks.
|
|
196
|
+
final_system_context = "\n\n".join(
|
|
197
197
|
section
|
|
198
|
-
for section in (
|
|
198
|
+
for section in (rendered_system_prompt, collection_context, company_specific_context)
|
|
199
199
|
if section
|
|
200
200
|
)
|
|
201
201
|
|
|
@@ -224,6 +224,8 @@ class ContextBuilderService:
|
|
|
224
224
|
capabilities: set[str] = set()
|
|
225
225
|
if self.SQL_TOOL_NAME in tool_names:
|
|
226
226
|
capabilities.add("can_query_sql")
|
|
227
|
+
if any(tool_name in self.MEMORY_TOOL_NAMES for tool_name in tool_names):
|
|
228
|
+
capabilities.add("can_use_memory")
|
|
227
229
|
if any(tool_name in self.FILE_GENERATION_TOOL_NAMES for tool_name in tool_names):
|
|
228
230
|
capabilities.add("can_generate_files")
|
|
229
231
|
if self.EMAIL_TOOL_NAME in tool_names:
|
|
@@ -309,13 +311,9 @@ class ContextBuilderService:
|
|
|
309
311
|
collection_names=rag_collections,
|
|
310
312
|
)
|
|
311
313
|
|
|
312
|
-
|
|
313
|
-
if any(tool_name in self.MEMORY_TOOL_NAMES for tool_name in enabled_tool_names):
|
|
314
|
-
memory_context = self._build_memory_context()
|
|
315
|
-
|
|
316
|
-
final_system_context = "\n".join(
|
|
314
|
+
final_system_context = "\n\n".join(
|
|
317
315
|
section
|
|
318
|
-
for section in (
|
|
316
|
+
for section in (rendered_system_prompt, collection_context, sql_context)
|
|
319
317
|
if section
|
|
320
318
|
)
|
|
321
319
|
|
|
@@ -351,9 +349,9 @@ class ContextBuilderService:
|
|
|
351
349
|
return ""
|
|
352
350
|
|
|
353
351
|
lines = [
|
|
354
|
-
"
|
|
355
|
-
"
|
|
356
|
-
"
|
|
352
|
+
"## Colecciones documentales disponibles",
|
|
353
|
+
"Usa `iat_document_search` cuando documentos internos de la empresa puedan ayudar a responder al usuario.",
|
|
354
|
+
"### Colecciones",
|
|
357
355
|
]
|
|
358
356
|
|
|
359
357
|
for name, description in selected_entries[:20]:
|
|
@@ -365,19 +363,12 @@ class ContextBuilderService:
|
|
|
365
363
|
if len(lines) <= 3:
|
|
366
364
|
return ""
|
|
367
365
|
|
|
368
|
-
lines.append(
|
|
366
|
+
lines.append(
|
|
367
|
+
"Si una coleccion coincide claramente con la pregunta, prefierela. "
|
|
368
|
+
"Si no esta claro, busca primero sin especificar coleccion."
|
|
369
|
+
)
|
|
369
370
|
return "\n".join(lines)
|
|
370
371
|
|
|
371
|
-
def _build_memory_context(self) -> str:
|
|
372
|
-
return "\n".join([
|
|
373
|
-
"### Personal Memory",
|
|
374
|
-
"The user may have personal memory pages built from saved notes, links, files, and chat messages.",
|
|
375
|
-
"Use `iat_memory_search` when the user is explicitly asking about saved notes, remembered items, or personal continuity across sessions.",
|
|
376
|
-
"If `iat_memory_search` returns a result with `has_native_files=true`, call `iat_memory_get_page` before answering whenever the attached file contents may matter.",
|
|
377
|
-
"Use `iat_memory_get_page` to read a specific page before answering when needed.",
|
|
378
|
-
"Prefer memory pages as compiled context; do not assume all saved content is globally relevant.",
|
|
379
|
-
])
|
|
380
|
-
|
|
381
372
|
def build_user_turn_prompt(self,
|
|
382
373
|
company: Company,
|
|
383
374
|
user_identifier: str,
|
|
@@ -1362,3 +1362,244 @@ class QueryService:
|
|
|
1362
1362
|
except Exception as e:
|
|
1363
1363
|
logging.exception(e)
|
|
1364
1364
|
return {'error': True, "error_message": f"{str(e)}"}
|
|
1365
|
+
|
|
1366
|
+
def preview_prompt_context(self,
|
|
1367
|
+
company_short_name: str,
|
|
1368
|
+
user_identifier: str,
|
|
1369
|
+
prompt_name: str,
|
|
1370
|
+
*,
|
|
1371
|
+
client_data: dict | None = None,
|
|
1372
|
+
question: str = "") -> dict:
|
|
1373
|
+
try:
|
|
1374
|
+
company = self.profile_repo.get_company_by_short_name(short_name=company_short_name)
|
|
1375
|
+
if not company:
|
|
1376
|
+
return {
|
|
1377
|
+
"error": True,
|
|
1378
|
+
"status_code": 404,
|
|
1379
|
+
"error_message": self.i18n_service.t(
|
|
1380
|
+
'errors.company_not_found',
|
|
1381
|
+
company_short_name=company_short_name,
|
|
1382
|
+
),
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
if not prompt_name:
|
|
1386
|
+
return {
|
|
1387
|
+
"error": True,
|
|
1388
|
+
"status_code": 400,
|
|
1389
|
+
"error_message": "Prompt name is required.",
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
prompt_output_contract = self._resolve_prompt_output_contract(company, prompt_name)
|
|
1393
|
+
if not prompt_output_contract:
|
|
1394
|
+
return {
|
|
1395
|
+
"error": True,
|
|
1396
|
+
"status_code": 404,
|
|
1397
|
+
"error_message": "Prompt not found.",
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
safe_client_data = client_data if isinstance(client_data, dict) else {}
|
|
1401
|
+
effective_model = self._resolve_model(company_short_name, None, prompt_output_contract)
|
|
1402
|
+
output_schema = self._build_output_text_schema_payload(
|
|
1403
|
+
company_short_name,
|
|
1404
|
+
effective_model,
|
|
1405
|
+
prompt_output_contract,
|
|
1406
|
+
)
|
|
1407
|
+
provider = self._get_provider(company_short_name, effective_model)
|
|
1408
|
+
|
|
1409
|
+
user_turn_prompt, effective_question, _images = self.context_builder.build_user_turn_prompt(
|
|
1410
|
+
company=company,
|
|
1411
|
+
user_identifier=user_identifier,
|
|
1412
|
+
client_data=safe_client_data,
|
|
1413
|
+
files=[],
|
|
1414
|
+
prompt_name=prompt_name,
|
|
1415
|
+
question=question or "",
|
|
1416
|
+
)
|
|
1417
|
+
|
|
1418
|
+
if prompt_output_contract.get("schema") and (
|
|
1419
|
+
not output_schema or provider in ("gemini", "deepseek", "openai_compatible")
|
|
1420
|
+
):
|
|
1421
|
+
user_turn_prompt = self._append_structured_schema_instruction(
|
|
1422
|
+
user_turn_prompt=user_turn_prompt,
|
|
1423
|
+
contract=prompt_output_contract,
|
|
1424
|
+
)
|
|
1425
|
+
|
|
1426
|
+
is_agent_execution = self._is_agentic_execution(prompt_output_contract)
|
|
1427
|
+
tools = self.tool_service.get_tools_for_llm(company)
|
|
1428
|
+
tools, tool_router_metrics = self._apply_prompt_tool_policy(
|
|
1429
|
+
company_short_name=company_short_name,
|
|
1430
|
+
prompt_output_contract=prompt_output_contract,
|
|
1431
|
+
tools=tools,
|
|
1432
|
+
include_forced_tools=not is_agent_execution,
|
|
1433
|
+
)
|
|
1434
|
+
if tool_router_metrics is None:
|
|
1435
|
+
tools, tool_router_metrics = self._select_tools_for_llm_with_metrics(
|
|
1436
|
+
company_short_name=company_short_name,
|
|
1437
|
+
company=company,
|
|
1438
|
+
user_identifier=user_identifier,
|
|
1439
|
+
question=effective_question,
|
|
1440
|
+
tools=tools,
|
|
1441
|
+
)
|
|
1442
|
+
else:
|
|
1443
|
+
user_turn_prompt = self._append_effective_tools_instruction(
|
|
1444
|
+
user_turn_prompt,
|
|
1445
|
+
tools,
|
|
1446
|
+
explicit_only=True,
|
|
1447
|
+
)
|
|
1448
|
+
|
|
1449
|
+
memory_lookup_decision = self.memory_lookup_policy_service.resolve(
|
|
1450
|
+
question=effective_question,
|
|
1451
|
+
tools=tools,
|
|
1452
|
+
tool_router_metrics=tool_router_metrics,
|
|
1453
|
+
)
|
|
1454
|
+
user_turn_prompt = self._append_memory_search_instruction(
|
|
1455
|
+
user_turn_prompt,
|
|
1456
|
+
memory_lookup_decision.should_suggest_memory_search,
|
|
1457
|
+
)
|
|
1458
|
+
|
|
1459
|
+
runtime_context = ""
|
|
1460
|
+
selected_system_prompt_keys: list[str] = []
|
|
1461
|
+
preview_note = None
|
|
1462
|
+
|
|
1463
|
+
if is_agent_execution:
|
|
1464
|
+
validation_error = self._validate_agent_resource_scope(prompt_output_contract, tools)
|
|
1465
|
+
if validation_error:
|
|
1466
|
+
return {
|
|
1467
|
+
"error": True,
|
|
1468
|
+
"status_code": 400,
|
|
1469
|
+
"error_message": validation_error,
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
runtime_context, _, selected_system_prompt_keys = self.context_builder.build_agent_system_context(
|
|
1473
|
+
company_short_name=company_short_name,
|
|
1474
|
+
user_identifier=user_identifier,
|
|
1475
|
+
prompt_name=prompt_name,
|
|
1476
|
+
enabled_tools=tools,
|
|
1477
|
+
prompt_output_contract=prompt_output_contract,
|
|
1478
|
+
query_text=effective_question,
|
|
1479
|
+
)
|
|
1480
|
+
final_input_preview = self._prepend_agent_runtime_context(
|
|
1481
|
+
user_turn_prompt,
|
|
1482
|
+
runtime_context,
|
|
1483
|
+
)
|
|
1484
|
+
history_type = "stateless"
|
|
1485
|
+
else:
|
|
1486
|
+
runtime_context, _, selected_system_prompt_keys = self.context_builder.build_system_context(
|
|
1487
|
+
company_short_name,
|
|
1488
|
+
user_identifier,
|
|
1489
|
+
query_text=effective_question,
|
|
1490
|
+
)
|
|
1491
|
+
final_input_preview = (
|
|
1492
|
+
"### Chat Runtime Context\n"
|
|
1493
|
+
f"{runtime_context}\n\n"
|
|
1494
|
+
"### Chat Turn\n"
|
|
1495
|
+
f"{user_turn_prompt}"
|
|
1496
|
+
) if runtime_context else user_turn_prompt
|
|
1497
|
+
history_type = self._get_history_type(company_short_name, effective_model)
|
|
1498
|
+
preview_note = (
|
|
1499
|
+
"This conversational preview shows the logical system context and turn. "
|
|
1500
|
+
"Providers with server-side history may persist the base context separately."
|
|
1501
|
+
)
|
|
1502
|
+
|
|
1503
|
+
token_count = 0
|
|
1504
|
+
try:
|
|
1505
|
+
token_count = int(self.llm_client.count_tokens(final_input_preview or ""))
|
|
1506
|
+
except Exception:
|
|
1507
|
+
token_count = 0
|
|
1508
|
+
|
|
1509
|
+
selected_system_prompt_keys = self._normalize_selected_system_prompt_keys(
|
|
1510
|
+
selected_system_prompt_keys
|
|
1511
|
+
)
|
|
1512
|
+
|
|
1513
|
+
return {
|
|
1514
|
+
"prompt_name": prompt_name,
|
|
1515
|
+
"execution_mode": prompt_output_contract.get("execution_mode") or "conversational",
|
|
1516
|
+
"visible_in_chat": bool(prompt_output_contract.get("visible_in_chat", True)),
|
|
1517
|
+
"response_mode": prompt_output_contract.get("response_mode") or "chat_compatible",
|
|
1518
|
+
"history_type": history_type,
|
|
1519
|
+
"provider": provider,
|
|
1520
|
+
"effective_model": effective_model,
|
|
1521
|
+
"tool_policy": self._normalize_prompt_tool_policy(prompt_output_contract.get("tool_policy")),
|
|
1522
|
+
"resource_bindings": list(prompt_output_contract.get("resource_bindings") or []),
|
|
1523
|
+
"selected_system_prompt_keys": selected_system_prompt_keys,
|
|
1524
|
+
"tool_names": self._get_tool_names(tools),
|
|
1525
|
+
"tool_router": tool_router_metrics or {},
|
|
1526
|
+
"memory_lookup": {
|
|
1527
|
+
"tool_choice_override": memory_lookup_decision.tool_choice_override,
|
|
1528
|
+
"should_suggest_memory_search": memory_lookup_decision.should_suggest_memory_search,
|
|
1529
|
+
"reason": memory_lookup_decision.reason,
|
|
1530
|
+
"confidence": memory_lookup_decision.confidence,
|
|
1531
|
+
"metadata": memory_lookup_decision.metadata,
|
|
1532
|
+
},
|
|
1533
|
+
"token_count": token_count,
|
|
1534
|
+
"runtime_context": runtime_context or "",
|
|
1535
|
+
"user_turn_prompt": user_turn_prompt,
|
|
1536
|
+
"final_input_preview": final_input_preview,
|
|
1537
|
+
"note": preview_note,
|
|
1538
|
+
}
|
|
1539
|
+
except Exception as e:
|
|
1540
|
+
logging.exception(e)
|
|
1541
|
+
return {'error': True, "status_code": 500, "error_message": f"{str(e)}"}
|
|
1542
|
+
|
|
1543
|
+
def preview_chat_context(self,
|
|
1544
|
+
company_short_name: str,
|
|
1545
|
+
user_identifier: str,
|
|
1546
|
+
*,
|
|
1547
|
+
question: str = "") -> dict:
|
|
1548
|
+
try:
|
|
1549
|
+
company = self.profile_repo.get_company_by_short_name(short_name=company_short_name)
|
|
1550
|
+
if not company:
|
|
1551
|
+
return {
|
|
1552
|
+
"error": True,
|
|
1553
|
+
"status_code": 404,
|
|
1554
|
+
"error_message": self.i18n_service.t(
|
|
1555
|
+
'errors.company_not_found',
|
|
1556
|
+
company_short_name=company_short_name,
|
|
1557
|
+
),
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
effective_model = self._resolve_model(company_short_name, None, {})
|
|
1561
|
+
provider = self._get_provider(company_short_name, effective_model)
|
|
1562
|
+
history_type = self._get_history_type(company_short_name, effective_model)
|
|
1563
|
+
tools = self.tool_service.get_tools_for_llm(company)
|
|
1564
|
+
runtime_context, _user_profile, selected_system_prompt_keys = self.context_builder.build_system_context(
|
|
1565
|
+
company_short_name,
|
|
1566
|
+
user_identifier,
|
|
1567
|
+
query_text=question or None,
|
|
1568
|
+
)
|
|
1569
|
+
selected_system_prompt_keys = self._normalize_selected_system_prompt_keys(
|
|
1570
|
+
selected_system_prompt_keys
|
|
1571
|
+
)
|
|
1572
|
+
|
|
1573
|
+
context_version = ""
|
|
1574
|
+
cached_context_version = ""
|
|
1575
|
+
if runtime_context:
|
|
1576
|
+
context_version = self.context_builder.compute_context_version(runtime_context)
|
|
1577
|
+
try:
|
|
1578
|
+
cached_context_version = str(
|
|
1579
|
+
self.session_context.get_context_version(company_short_name, user_identifier) or ""
|
|
1580
|
+
).strip()
|
|
1581
|
+
except Exception:
|
|
1582
|
+
cached_context_version = ""
|
|
1583
|
+
token_count = 0
|
|
1584
|
+
try:
|
|
1585
|
+
token_count = int(self.llm_client.count_tokens(runtime_context or ""))
|
|
1586
|
+
except Exception:
|
|
1587
|
+
token_count = 0
|
|
1588
|
+
|
|
1589
|
+
return {
|
|
1590
|
+
"mode": "chat",
|
|
1591
|
+
"execution_mode": "conversational",
|
|
1592
|
+
"response_mode": "chat_compatible",
|
|
1593
|
+
"history_type": history_type,
|
|
1594
|
+
"provider": provider,
|
|
1595
|
+
"effective_model": effective_model,
|
|
1596
|
+
"selected_system_prompt_keys": selected_system_prompt_keys,
|
|
1597
|
+
"tool_names": self._get_tool_names(tools),
|
|
1598
|
+
"context_version": context_version,
|
|
1599
|
+
"cached_context_version": cached_context_version,
|
|
1600
|
+
"token_count": token_count,
|
|
1601
|
+
"context": runtime_context or "",
|
|
1602
|
+
}
|
|
1603
|
+
except Exception as e:
|
|
1604
|
+
logging.exception(e)
|
|
1605
|
+
return {'error': True, "status_code": 500, "error_message": f"{str(e)}"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
## Instrucciones del asistente
|
|
2
|
+
|
|
3
|
+
### Identidad del asistente
|
|
1
4
|
Eres un asistente que responde preguntas o ejecuta tareas segun el contexto
|
|
2
5
|
de la empresa.
|
|
3
6
|
|
|
4
|
-
###
|
|
7
|
+
### Empresa
|
|
5
8
|
- Nombre: {{company}}, tambien se conoce como {{ company_short_name }}
|
|
6
|
-
- Idioma
|
|
9
|
+
- Idioma inicial de respuesta: {{language}}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
### HTML estructurado
|
|
2
2
|
|
|
3
|
-
Tablas
|
|
3
|
+
#### Tablas
|
|
4
4
|
- Usa como base `table table-striped table-hover`.
|
|
5
5
|
- Si una columna contiene RUT, fecha, id certificado o valores similares, usa
|
|
6
6
|
clase `nowrap` en el `<th>` y en el `<td>` correspondiente cuando aplique.
|
|
7
7
|
- Si una columna debe ir centrada o alineada a la derecha, agrega
|
|
8
8
|
`class="text-center"` o `class="text-right"` tanto en `<th>` como en cada `<td>`.
|
|
9
9
|
|
|
10
|
-
Listas clave-valor
|
|
10
|
+
#### Listas clave-valor
|
|
11
11
|
- Cuando presentes datos como lista clave-valor, envuelve siempre la clave
|
|
12
12
|
en `<strong>`.
|
|
13
13
|
- Ejemplo:
|