iatoolkit 2.73.7__tar.gz → 2.74.0__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.73.7/src/iatoolkit.egg-info → iatoolkit-2.74.0}/PKG-INFO +1 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/__init__.py +1 -1
- iatoolkit-2.74.0/src/iatoolkit/common/interfaces/history_compaction_trigger.py +21 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/model_registry.py +0 -26
- iatoolkit-2.74.0/src/iatoolkit/config/system_agents/history_compaction.prompt +24 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents_pack.yaml +22 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/core.py +4 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/anthropic_adapter.py +1 -3
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/gemini_adapter.py +0 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/openai_adapter.py +97 -39
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/locales/en.yaml +0 -4
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/locales/es.yaml +0 -4
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/llm_query_repo.py +19 -5
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/models.py +17 -3
- iatoolkit-2.74.0/src/iatoolkit/services/history_compaction_service.py +272 -0
- iatoolkit-2.74.0/src/iatoolkit/services/history_manager_service.py +374 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/llm_client_service.py +13 -78
- iatoolkit-2.74.0/src/iatoolkit/services/noop_history_compaction_trigger.py +21 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/query_service.py +63 -169
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/system_agent_runner.py +0 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/user_session_context_service.py +21 -40
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_header_navigation.js +1 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/_chat_header.html +0 -8
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/chat.html +0 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/init_context_api_view.py +1 -5
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/login_view.py +2 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0/src/iatoolkit.egg-info}/PKG-INFO +1 -1
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit.egg-info/SOURCES.txt +4 -1
- iatoolkit-2.73.7/src/iatoolkit/services/history_manager_service.py +0 -212
- iatoolkit-2.73.7/src/iatoolkit/static/js/chat_reload_button.js +0 -38
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/LICENSE +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/LICENSE_COMMUNITY.md +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/pyproject.toml +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/readme.md +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/setup.cfg +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/base_company.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/cli_commands.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/access.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/bridge_validation.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/company_paths.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/exceptions.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/asset_storage.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/database_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/memory_compilation_trigger.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/secret_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/signup_policy_resolver.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/interfaces/web_search_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/memory_tools.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/routes.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/search_terms.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/secret_resolver.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/session_manager.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/text_splitter.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/url_safety.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/common/util.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/company_registry.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/llm_capabilities.yaml +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_compiler.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_correction.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_document_ingest.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_image_ingest.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_meeting_ingest.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_agents/memory_question_review.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/channel_business_identity.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/channel_conversation_continuity.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/channel_response_style.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/chat_state_rules.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/chat_user_profile.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/core_identity.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/email_output.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/file_download_output.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/format_styles.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/html_structures.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/links_documents.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/memory_usage.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/multimodal_basics.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/output_basics.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/presentation_formatting.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/query_main.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_aggregation_scope.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_casting.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_core.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_jsonb.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_mysql_casting.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_mysql_json.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_redshift_basics.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_redshift_types.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/sql_rules.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts/tool_html_passthrough.prompt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_prompts_pack.yaml +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/config/system_tools_pack.yaml +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/brevo_mail_app.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/call_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/file_connector.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/file_connector_factory.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/google_cloud_storage_connector.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/google_drive_connector.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/local_file_connector.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/connectors/s3_connector.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/google_auth_client.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/google_chat_app.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/inference_embeddings_client.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/inference_handler.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/jina_embeddings_client.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_gateway_resolver.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/deepseek_adapter.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/openai_compatible_chat_adapter.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/openrouter_adapter.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_proxy.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_response.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/redis_session_manager.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/advisory_lock.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/api_key_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/bridge_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/database_manager.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/document_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/env_secret_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/filesystem_asset_repository.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/knowledge_wiki_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/mcp_token_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/memory_question_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/memory_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/memory_usage_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/profile_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/prompt_resource_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/sql_dataset_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/sql_source_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/repositories/vs_repo.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/runtime_logging.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/api_key_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/attachment_policy_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/auth_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/branding_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/company_context_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/configuration_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/context_builder_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/dispatcher_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/embedding_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/excel_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/file_processor_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/http_tool_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/i18n_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/inference_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/jwt_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/knowledge_base_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/language_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/license_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/mail_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/markdown_wiki_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/mcp_token_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_compiler_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_lookup_policy_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_question_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_sources.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_usage_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/memory_wiki_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/noop_memory_compilation_trigger.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/operator_identity_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/contracts.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/image_normalizer.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/parsing_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/pdf_ocr_detection.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/provider_factory.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/provider_resolver.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/providers/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/providers/basic_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/providers/docling_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/parsers/validator.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/pdf_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/profile_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/prompt_resource_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/prompt_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/resource_access_scope.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/signup_policy_resolver.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/sql_dataset_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/sql_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/sql_source_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/storage_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/structured_output_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/system_agent_catalog.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/system_prompt_catalog.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/system_tools.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/telemetry_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/tenant_wiki_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/tool_output_contract.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/tool_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/user_feedback_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/visual_kb_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/visual_tool_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/warmup_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/web_search/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/web_search/provider_factory.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/web_search/providers/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/web_search/providers/brave_provider.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/web_search_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/services/wiki_page_index_service.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/images/favicon.ico +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/images/favicon.png +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/images/fernando.jpeg +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/images/iatoolkit_core.png +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/images/iatoolkit_logo.png +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_feedback_button.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_filepond.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_help_content.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_history_button.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_logout_button.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_main.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_memory_button.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_model_selector.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_onboarding_button.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/js/chat_prompt_manager.js +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/account.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/chat_iatoolkit.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/chat_modal.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/chat_public.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/documents.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/landing_page.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/llm_output.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/onboarding.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/static/styles/wiki_page.css +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/_company_header.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/_login_widget.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/account.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/base.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/change_password.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/chat_memory_modal.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/chat_modals.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/error.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/forgot_password.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/home_hosted_default.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/login_global.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/memory/wiki_schema.md +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/onboarding_shell.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/pdf/base.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/pdf/letter.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/pdf/report.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/pdf/simple.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/signup.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/templates/wiki_page.html +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/__init__.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/account_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/api_key_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/base_login_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/categories_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/change_password_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/chat_context_preview_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/chat_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/configuration_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/connectors_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/embedding_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/forgot_password_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/help_content_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/history_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/home_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/llmquery_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/load_document_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/logout_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/memory_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/profile_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/prompt_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/prompt_context_preview_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/prompt_resource_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/rag_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/root_redirect_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/signup_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/static_page_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/tool_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/user_feedback_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/users_api_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/verify_user_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/views/wiki_page_view.py +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit.egg-info/dependency_links.txt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit.egg-info/requires.txt +0 -0
- {iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Copyright (c) 2024 Fernando Libedinsky
|
|
2
|
+
# Product: IAToolkit
|
|
3
|
+
#
|
|
4
|
+
# IAToolkit is open source software.
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HistoryCompactionTrigger(ABC):
|
|
12
|
+
"""Asks for a conversation history to be compacted in the background (BL-009).
|
|
13
|
+
|
|
14
|
+
The core has no task queue, so its default does nothing and a history is
|
|
15
|
+
compacted in line, on the turn that would no longer fit. A deployment with
|
|
16
|
+
workers (enterprise) binds one that queues the work instead.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def trigger(self, company_short_name: str, user_identifier: str, model: str) -> bool:
|
|
21
|
+
"""Queues the compaction. True when something was queued or already was."""
|
|
@@ -15,17 +15,9 @@ from injector import inject, singleton
|
|
|
15
15
|
from typing import Literal
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
HistoryType = Literal["server_side", "client_side"]
|
|
19
18
|
ProviderType = Literal["openai", "gemini", "deepseek", "xai", "anthropic", "openrouter", "openai_compatible", "unknown"]
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
@dataclass(frozen=True)
|
|
23
|
-
class ModelMetadata:
|
|
24
|
-
"""Static metadata for a logical family of models."""
|
|
25
|
-
provider: ProviderType
|
|
26
|
-
history_type: HistoryType
|
|
27
|
-
|
|
28
|
-
|
|
29
21
|
#: Providers a model can actually be served by: the ones `LLMProxy._build_adapter`
|
|
30
22
|
#: knows how to build. Deliberately narrower than `ProviderType`, which also
|
|
31
23
|
#: contains `xai` — `normalize_provider` accepts it and a client is built for it,
|
|
@@ -118,7 +110,6 @@ class ModelRegistry:
|
|
|
118
110
|
|
|
119
111
|
Responsibilities:
|
|
120
112
|
- Map a model name to its provider (openai, gemini, deepseek, etc.).
|
|
121
|
-
- Decide which history strategy to use for a model (server_side / client_side).
|
|
122
113
|
- Provide convenience helpers (is_openai, is_gemini, is_deepseek, etc.).
|
|
123
114
|
"""
|
|
124
115
|
|
|
@@ -192,7 +183,6 @@ class ModelRegistry:
|
|
|
192
183
|
|
|
193
184
|
return {
|
|
194
185
|
"provider": normalized_provider,
|
|
195
|
-
"history_type": self.get_history_type(model),
|
|
196
186
|
"supports_reasoning_effort": supports_reasoning_effort,
|
|
197
187
|
"allowed_reasoning_efforts": list(self._reasoning_effort_options) if supports_reasoning_effort else [],
|
|
198
188
|
"supports_text_verbosity": supports_text_verbosity,
|
|
@@ -246,22 +236,6 @@ class ModelRegistry:
|
|
|
246
236
|
"reasoning": merged_reasoning,
|
|
247
237
|
}
|
|
248
238
|
|
|
249
|
-
def get_history_type(self, model: str) -> HistoryType:
|
|
250
|
-
"""
|
|
251
|
-
Returns the history strategy for a given model.
|
|
252
|
-
|
|
253
|
-
Current rules:
|
|
254
|
-
- openai/xai: server_side (API manages conversation state via ids)
|
|
255
|
-
- gemini/deepseek/anthropic/unknown: client_side (we manage full message history)
|
|
256
|
-
"""
|
|
257
|
-
provider = self.get_provider(model)
|
|
258
|
-
|
|
259
|
-
if provider in ("openai", "xai"):
|
|
260
|
-
return "server_side"
|
|
261
|
-
|
|
262
|
-
# Default for gemini, deepseek, anthropic and any unknown provider
|
|
263
|
-
return "client_side"
|
|
264
|
-
|
|
265
239
|
# ------------------------------------------------------------------
|
|
266
240
|
# Convenience helpers (used during migration)
|
|
267
241
|
# ------------------------------------------------------------------
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
You compact the older part of a conversation between a person and a company's AI assistant. The conversation is too long for the model's context, so the turns below will be replaced by your summary; the most recent turns stay as they are. The assistant will continue the conversation from your summary alone, so anything you leave out is lost.
|
|
2
|
+
|
|
3
|
+
Write the summary in the language of the conversation, as Markdown, with these sections (omit a section only when there is nothing for it):
|
|
4
|
+
|
|
5
|
+
- **Objective**: what the person is trying to achieve, and how it evolved.
|
|
6
|
+
- **Decisions**: what was agreed, chosen or ruled out, and why when it was said.
|
|
7
|
+
- **Data obtained**: the concrete facts the assistant found or computed with its tools — figures, dates, names, identifiers, table names, SQL that worked, document titles, URLs. Keep exact values; never round or paraphrase a number.
|
|
8
|
+
- **Pending**: questions still open and what the person asked for that is not done yet.
|
|
9
|
+
- **Preferences**: how the person wants to be answered (format, language, level of detail, things to avoid).
|
|
10
|
+
|
|
11
|
+
Rules:
|
|
12
|
+
|
|
13
|
+
- Keep facts, drop chatter. Do not repeat the same fact twice.
|
|
14
|
+
- Attribute statements correctly: what the person said is not what the assistant concluded.
|
|
15
|
+
- Do not add information that is not in the turns or in the previous summary.
|
|
16
|
+
- When a previous summary is given, merge it with the new turns into one summary: keep what is still true, update what changed, and drop what was superseded.
|
|
17
|
+
|
|
18
|
+
Return the summary in `summary`.
|
|
19
|
+
|
|
20
|
+
PREVIOUS SUMMARY:
|
|
21
|
+
{{ previous_summary or "(none)" }}
|
|
22
|
+
|
|
23
|
+
TURNS TO COMPACT:
|
|
24
|
+
{{ transcript }}
|
|
@@ -312,3 +312,25 @@ agents:
|
|
|
312
312
|
additionalProperties: false
|
|
313
313
|
inputs: [source, captured_on, wiki_schema, page_index, candidate_pages]
|
|
314
314
|
default_model: null
|
|
315
|
+
|
|
316
|
+
- key: history_compaction
|
|
317
|
+
name: Compactación del historial
|
|
318
|
+
name_en: History compaction
|
|
319
|
+
description: >-
|
|
320
|
+
(Chat) Resume la parte antigua de una conversación larga cuando se acerca al límite de contexto del
|
|
321
|
+
modelo, para que la conversación siga sin perder lo importante.
|
|
322
|
+
description_en: >-
|
|
323
|
+
(Chat) Summarizes the older part of a long conversation when it nears the model's context limit,
|
|
324
|
+
so the conversation can go on without losing what matters.
|
|
325
|
+
module: chat
|
|
326
|
+
prompt: history_compaction.prompt
|
|
327
|
+
output_schema:
|
|
328
|
+
type: object
|
|
329
|
+
properties:
|
|
330
|
+
summary:
|
|
331
|
+
type: string
|
|
332
|
+
required: [summary]
|
|
333
|
+
additionalProperties: false
|
|
334
|
+
inputs: [previous_summary, transcript]
|
|
335
|
+
default_model: null
|
|
336
|
+
|
|
@@ -408,6 +408,8 @@ class IAToolkit:
|
|
|
408
408
|
from iatoolkit.repositories.env_secret_provider import EnvSecretProvider
|
|
409
409
|
from iatoolkit.common.interfaces.memory_compilation_trigger import MemoryCompilationTrigger
|
|
410
410
|
from iatoolkit.services.noop_memory_compilation_trigger import NoopMemoryCompilationTrigger
|
|
411
|
+
from iatoolkit.common.interfaces.history_compaction_trigger import HistoryCompactionTrigger
|
|
412
|
+
from iatoolkit.services.noop_history_compaction_trigger import NoopHistoryCompactionTrigger
|
|
411
413
|
from iatoolkit.services.memory_lookup_policy_service import MemoryLookupPolicyService
|
|
412
414
|
|
|
413
415
|
binder.bind(ApiKeyRepo, to=ApiKeyRepo)
|
|
@@ -430,6 +432,8 @@ class IAToolkit:
|
|
|
430
432
|
binder.bind(SecretProvider, to=EnvSecretProvider)
|
|
431
433
|
if not is_bound(self._injector, MemoryCompilationTrigger):
|
|
432
434
|
binder.bind(MemoryCompilationTrigger, to=NoopMemoryCompilationTrigger)
|
|
435
|
+
if not is_bound(self._injector, HistoryCompactionTrigger):
|
|
436
|
+
binder.bind(HistoryCompactionTrigger, to=NoopHistoryCompactionTrigger)
|
|
433
437
|
binder.bind(MemoryLookupPolicyService, to=MemoryLookupPolicyService)
|
|
434
438
|
|
|
435
439
|
def _bind_services(self, binder: Binder):
|
{iatoolkit-2.73.7 → iatoolkit-2.74.0}/src/iatoolkit/infra/llm_providers/anthropic_adapter.py
RENAMED
|
@@ -24,7 +24,6 @@ class AnthropicAdapter:
|
|
|
24
24
|
def create_response(self,
|
|
25
25
|
model: str,
|
|
26
26
|
input: List[Dict],
|
|
27
|
-
previous_response_id: Optional[str] = None,
|
|
28
27
|
context_history: Optional[List[Dict]] = None,
|
|
29
28
|
tools: Optional[List[Dict]] = None,
|
|
30
29
|
text: Optional[Dict] = None,
|
|
@@ -39,10 +38,9 @@ class AnthropicAdapter:
|
|
|
39
38
|
Calls Anthropic Messages API and maps the response to common LLMResponse.
|
|
40
39
|
|
|
41
40
|
Notes:
|
|
42
|
-
- Anthropic
|
|
41
|
+
- Anthropic receives the whole client-side history on every call.
|
|
43
42
|
- reasoning is currently not sent as a provider-specific parameter.
|
|
44
43
|
"""
|
|
45
|
-
_ = previous_response_id
|
|
46
44
|
_ = reasoning
|
|
47
45
|
_ = attachments
|
|
48
46
|
_ = store
|
|
@@ -18,10 +18,14 @@ class OpenAIAdapter:
|
|
|
18
18
|
def __init__(self, openai_client):
|
|
19
19
|
self.client = openai_client
|
|
20
20
|
|
|
21
|
+
#: Reasoning models whose reasoning can travel between calls as encrypted
|
|
22
|
+
#: items. Asked only of these: a model without reasoning answers the
|
|
23
|
+
#: `include` with a 400.
|
|
24
|
+
_ENCRYPTED_REASONING_MODEL_PREFIXES = ("gpt-5", "o1", "o3", "o4")
|
|
25
|
+
|
|
21
26
|
def create_response(self,
|
|
22
27
|
model: str,
|
|
23
28
|
input: List[Dict],
|
|
24
|
-
previous_response_id: Optional[str] = None,
|
|
25
29
|
context_history: Optional[List[Dict]] = None,
|
|
26
30
|
tools: Optional[List[Dict]] = None,
|
|
27
31
|
text: Optional[Dict] = None,
|
|
@@ -32,11 +36,17 @@ class OpenAIAdapter:
|
|
|
32
36
|
store: Optional[bool] = None,
|
|
33
37
|
metadata: Optional[Dict[str, str]] = None,
|
|
34
38
|
telemetry_execution: Any = None) -> LLMResponse:
|
|
35
|
-
"""Llamada a la API de OpenAI y mapeo a estructura común
|
|
39
|
+
"""Llamada a la API de OpenAI y mapeo a estructura común.
|
|
40
|
+
|
|
41
|
+
IAToolkit owns the history (BL-009): every call carries the whole
|
|
42
|
+
conversation and nothing is kept at OpenAI. `store` is always False,
|
|
43
|
+
whatever a prompt or company.yaml still declares; it is accepted only so
|
|
44
|
+
configurations that set it keep loading.
|
|
45
|
+
"""
|
|
46
|
+
_ = store
|
|
36
47
|
try:
|
|
37
48
|
input = self._normalize_input_items(
|
|
38
49
|
input_items=input,
|
|
39
|
-
previous_response_id=previous_response_id,
|
|
40
50
|
context_history=context_history,
|
|
41
51
|
)
|
|
42
52
|
|
|
@@ -50,16 +60,18 @@ class OpenAIAdapter:
|
|
|
50
60
|
'input': input
|
|
51
61
|
}
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
# Nothing stays at OpenAI: the next call sends the history again.
|
|
64
|
+
params['store'] = False
|
|
65
|
+
if self._carries_encrypted_reasoning(model):
|
|
66
|
+
# Without a stored response the model would lose its reasoning
|
|
67
|
+
# between tool rounds; it comes back encrypted and is sent again.
|
|
68
|
+
params['include'] = ["reasoning.encrypted_content"]
|
|
55
69
|
if tools:
|
|
56
70
|
params['tools'] = tools
|
|
57
71
|
if text:
|
|
58
72
|
params['text'] = text
|
|
59
73
|
if reasoning:
|
|
60
74
|
params['reasoning'] = reasoning
|
|
61
|
-
if store is not None:
|
|
62
|
-
params['store'] = store
|
|
63
75
|
if metadata:
|
|
64
76
|
params['metadata'] = metadata
|
|
65
77
|
tool_choice_payload = self._map_tool_choice(tool_choice, tools or [])
|
|
@@ -80,36 +92,34 @@ class OpenAIAdapter:
|
|
|
80
92
|
|
|
81
93
|
raise IAToolkitException(IAToolkitException.ErrorType.LLM_ERROR, error_message)
|
|
82
94
|
|
|
95
|
+
@classmethod
|
|
96
|
+
def _carries_encrypted_reasoning(cls, model: str) -> bool:
|
|
97
|
+
name = str(model or "").strip().lower()
|
|
98
|
+
if "-chat" in name:
|
|
99
|
+
return False # gpt-5-chat-latest and the like do not reason
|
|
100
|
+
return name.startswith(cls._ENCRYPTED_REASONING_MODEL_PREFIXES)
|
|
101
|
+
|
|
83
102
|
def _normalize_input_items(
|
|
84
103
|
self,
|
|
85
104
|
input_items: Optional[List[Dict]],
|
|
86
|
-
previous_response_id: Optional[str] = None,
|
|
87
105
|
context_history: Optional[List[Dict]] = None,
|
|
88
106
|
) -> List[Dict[str, Any]]:
|
|
89
107
|
"""
|
|
90
108
|
Normalize our internal history format to the subset accepted by Responses API.
|
|
91
109
|
|
|
110
|
+
The client-side history comes first, then the items of the current call.
|
|
111
|
+
|
|
92
112
|
Important cases:
|
|
93
113
|
- Assistant messages with `tool_calls` must become top-level `function_call` items.
|
|
114
|
+
- An assistant message's encrypted reasoning items go back in front of its
|
|
115
|
+
own message and calls, the order OpenAI produced them in.
|
|
94
116
|
- `function_call_output` items must not include internal-only fields such as `status`.
|
|
95
|
-
- Without `previous_response_id`, include client-side `context_history` before
|
|
96
|
-
the current turn so OpenAI can run from locally managed history if needed.
|
|
97
|
-
- When continuing from a prior response with `previous_response_id`, tool follow-ups
|
|
98
|
-
should only append the `function_call_output` items because the previous response
|
|
99
|
-
already contains the originating user/assistant turns on OpenAI's side.
|
|
100
117
|
"""
|
|
101
118
|
combined_input: List[Dict[str, Any]] = []
|
|
102
|
-
|
|
103
|
-
combined_input.extend(context_history or [])
|
|
119
|
+
combined_input.extend(context_history or [])
|
|
104
120
|
combined_input.extend(input_items or [])
|
|
105
121
|
|
|
106
|
-
has_function_outputs = any(
|
|
107
|
-
isinstance(item, dict) and item.get("type") == "function_call_output"
|
|
108
|
-
for item in combined_input
|
|
109
|
-
)
|
|
110
|
-
|
|
111
122
|
normalized_items: List[Dict[str, Any]] = []
|
|
112
|
-
function_output_items: List[Dict[str, Any]] = []
|
|
113
123
|
|
|
114
124
|
for item in combined_input:
|
|
115
125
|
if not isinstance(item, dict):
|
|
@@ -121,13 +131,17 @@ class OpenAIAdapter:
|
|
|
121
131
|
if not call_id:
|
|
122
132
|
continue
|
|
123
133
|
|
|
124
|
-
|
|
134
|
+
normalized_items.append({
|
|
125
135
|
"type": "function_call_output",
|
|
126
136
|
"call_id": call_id,
|
|
127
137
|
"output": item.get("output", ""),
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
})
|
|
139
|
+
continue
|
|
140
|
+
|
|
141
|
+
if item_type == "reasoning":
|
|
142
|
+
reasoning_item = self._normalize_reasoning_item(item)
|
|
143
|
+
if reasoning_item:
|
|
144
|
+
normalized_items.append(reasoning_item)
|
|
131
145
|
continue
|
|
132
146
|
|
|
133
147
|
if item_type == "function_call":
|
|
@@ -139,6 +153,8 @@ class OpenAIAdapter:
|
|
|
139
153
|
role = "assistant"
|
|
140
154
|
|
|
141
155
|
content = item.get("content")
|
|
156
|
+
if role == "assistant":
|
|
157
|
+
normalized_items.extend(self._reasoning_items_from(item.get("reasoning_details")))
|
|
142
158
|
tool_calls = self._normalize_tool_call_items(item.get("tool_calls"))
|
|
143
159
|
if tool_calls:
|
|
144
160
|
if role == "assistant" and content not in (None, "", []):
|
|
@@ -155,22 +171,41 @@ class OpenAIAdapter:
|
|
|
155
171
|
"content": content,
|
|
156
172
|
})
|
|
157
173
|
|
|
158
|
-
if previous_response_id and has_function_outputs and function_output_items:
|
|
159
|
-
# Only the outputs answering the previous response's calls. The tool loop
|
|
160
|
-
# keeps every round's outputs in its input (client-side providers need
|
|
161
|
-
# them), and they come last; earlier rounds are already in the chain
|
|
162
|
-
# `previous_response_id` points to. Sending them all again repeated every
|
|
163
|
-
# tool result in each following round, so the context grew quadratically
|
|
164
|
-
# and long tool loops hit context_length_exceeded.
|
|
165
|
-
latest_round: List[Dict[str, Any]] = []
|
|
166
|
-
for item in reversed(normalized_items):
|
|
167
|
-
if item.get("type") != "function_call_output":
|
|
168
|
-
break
|
|
169
|
-
latest_round.append(item)
|
|
170
|
-
return list(reversed(latest_round)) or function_output_items
|
|
171
|
-
|
|
172
174
|
return normalized_items
|
|
173
175
|
|
|
176
|
+
@classmethod
|
|
177
|
+
def _reasoning_items_from(cls, reasoning_details: Any) -> List[Dict[str, Any]]:
|
|
178
|
+
"""The OpenAI reasoning items stored with an assistant message, ready to resend.
|
|
179
|
+
|
|
180
|
+
`reasoning_details` is shared with other adapters (OpenRouter writes
|
|
181
|
+
`reasoning.text` blocks there); only items of type `reasoning` carrying
|
|
182
|
+
encrypted content are OpenAI's and make sense to send back.
|
|
183
|
+
"""
|
|
184
|
+
if not isinstance(reasoning_details, list):
|
|
185
|
+
return []
|
|
186
|
+
items = []
|
|
187
|
+
for detail in reasoning_details:
|
|
188
|
+
item = cls._normalize_reasoning_item(detail)
|
|
189
|
+
if item:
|
|
190
|
+
items.append(item)
|
|
191
|
+
return items
|
|
192
|
+
|
|
193
|
+
@staticmethod
|
|
194
|
+
def _normalize_reasoning_item(detail: Any) -> Optional[Dict[str, Any]]:
|
|
195
|
+
if not isinstance(detail, dict) or detail.get("type") != "reasoning":
|
|
196
|
+
return None
|
|
197
|
+
encrypted = detail.get("encrypted_content")
|
|
198
|
+
if not encrypted:
|
|
199
|
+
return None
|
|
200
|
+
item = {
|
|
201
|
+
"type": "reasoning",
|
|
202
|
+
"summary": detail.get("summary") if isinstance(detail.get("summary"), list) else [],
|
|
203
|
+
"encrypted_content": encrypted,
|
|
204
|
+
}
|
|
205
|
+
if detail.get("id"):
|
|
206
|
+
item["id"] = detail["id"]
|
|
207
|
+
return item
|
|
208
|
+
|
|
174
209
|
@staticmethod
|
|
175
210
|
def _normalize_tool_call_items(tool_calls: Any) -> List[Dict[str, Any]]:
|
|
176
211
|
normalized_tool_calls: List[Dict[str, Any]] = []
|
|
@@ -408,9 +443,32 @@ class OpenAIAdapter:
|
|
|
408
443
|
output=tool_calls,
|
|
409
444
|
usage=usage,
|
|
410
445
|
reasoning_content=reasoning_str,
|
|
446
|
+
reasoning_details=self._extract_encrypted_reasoning_items(openai_response) or None,
|
|
411
447
|
content_parts=content_parts
|
|
412
448
|
)
|
|
413
449
|
|
|
450
|
+
@staticmethod
|
|
451
|
+
def _extract_encrypted_reasoning_items(openai_response) -> List[Dict[str, Any]]:
|
|
452
|
+
"""The response's reasoning items that can be sent back on the next call."""
|
|
453
|
+
items: List[Dict[str, Any]] = []
|
|
454
|
+
for item in getattr(openai_response, "output", None) or []:
|
|
455
|
+
if getattr(item, "type", None) != "reasoning":
|
|
456
|
+
continue
|
|
457
|
+
encrypted = getattr(item, "encrypted_content", None)
|
|
458
|
+
if not encrypted:
|
|
459
|
+
continue
|
|
460
|
+
summary = []
|
|
461
|
+
for part in getattr(item, "summary", None) or []:
|
|
462
|
+
text = getattr(part, "text", None)
|
|
463
|
+
if text:
|
|
464
|
+
summary.append({"type": "summary_text", "text": str(text)})
|
|
465
|
+
reasoning_item = {"type": "reasoning", "summary": summary, "encrypted_content": encrypted}
|
|
466
|
+
item_id = getattr(item, "id", None)
|
|
467
|
+
if item_id:
|
|
468
|
+
reasoning_item["id"] = item_id
|
|
469
|
+
items.append(reasoning_item)
|
|
470
|
+
return items
|
|
471
|
+
|
|
414
472
|
def _extract_reasoning_content(self, openai_response) -> List[str]:
|
|
415
473
|
"""
|
|
416
474
|
Extract reasoning summaries (preferred) or reasoning content fragments from Responses API output.
|
|
@@ -2784,7 +2784,6 @@ ui:
|
|
|
2784
2784
|
tooltips:
|
|
2785
2785
|
history: "History of my queries"
|
|
2786
2786
|
memory: "Company memory"
|
|
2787
|
-
reload_context: "Force Context Reload"
|
|
2788
2787
|
feedback: "Your feedback is very important"
|
|
2789
2788
|
usage_guide: "Usage Guide"
|
|
2790
2789
|
onboarding: "How to ask better questions"
|
|
@@ -2897,7 +2896,6 @@ errors:
|
|
|
2897
2896
|
file_validation_error: "Error validating file"
|
|
2898
2897
|
user_not_authorized: "user is not authorized for this company"
|
|
2899
2898
|
account_not_verified: "Your account has not been verified. Please check your email."
|
|
2900
|
-
missing_response_id: "Can not found 'previous_response_id' for '{company_short_name}/{user_identifier}'. Reinit context"
|
|
2901
2899
|
context_rebuild_failed: "Company context rebuild failed."
|
|
2902
2900
|
cannot_read_excel: "Cannot read Excel file"
|
|
2903
2901
|
cannot_read_csv: "Cannot read CSV file"
|
|
@@ -2951,7 +2949,6 @@ js_messages:
|
|
|
2951
2949
|
feedback_sent_error: "Could not send feedback, please try again."
|
|
2952
2950
|
feedback_rating_error: "Please rate the assistant using the stars."
|
|
2953
2951
|
feedback_comment_error: "Please write your comment before sending."
|
|
2954
|
-
context_reloaded: "Context has been reloaded."
|
|
2955
2952
|
error_loading_history: "An error occurred while loading the history."
|
|
2956
2953
|
request_aborted: "The response generation has been stopped."
|
|
2957
2954
|
processing_error: "An error occurred while processing the request."
|
|
@@ -2959,7 +2956,6 @@ js_messages:
|
|
|
2959
2956
|
network_error: "A network error occurred. Please try again in a few moments."
|
|
2960
2957
|
unknown_server_error: "Unknown server error."
|
|
2961
2958
|
loading: "Loading..."
|
|
2962
|
-
reload_init: "init reloading context in background..."
|
|
2963
2959
|
no_history_found: "No query history found."
|
|
2964
2960
|
prompts_available: "Available prompts"
|
|
2965
2961
|
example: "Example:"
|
|
@@ -2800,7 +2800,6 @@ ui:
|
|
|
2800
2800
|
tooltips:
|
|
2801
2801
|
history: "Historial con mis consultas"
|
|
2802
2802
|
memory: "Memoria de la empresa"
|
|
2803
|
-
reload_context: "Forzar Recarga de Contexto"
|
|
2804
2803
|
feedback: "Tu feedback es muy importante"
|
|
2805
2804
|
usage_guide: "Guía de Uso"
|
|
2806
2805
|
onboarding: "Cómo preguntar mejor"
|
|
@@ -2916,7 +2915,6 @@ errors:
|
|
|
2916
2915
|
file_validation_error : "Error validando archivo"
|
|
2917
2916
|
user_not_authorized: "Usuario no esta autorizado para esta empresa"
|
|
2918
2917
|
account_not_verified: "Tu cuenta no ha sido verificada. Por favor, revisa tu correo."
|
|
2919
|
-
missing_response_id: "No se encontró 'previous_response_id' para '{company_short_name}/{user_identifier}'. Reinicia el contexto."
|
|
2920
2918
|
context_rebuild_failed: "No se pudo reconstruir el contexto de la empresa."
|
|
2921
2919
|
cannot_read_excel: "No se pudo leer el archivo excel"
|
|
2922
2920
|
cannot_read_csv: "No se pudo leer el archivo CSV"
|
|
@@ -2970,7 +2968,6 @@ js_messages:
|
|
|
2970
2968
|
feedback_sent_error: "No se pudo enviar el feedback, por favor intente nuevamente."
|
|
2971
2969
|
feedback_rating_error: "Por favor, califica al asistente con las estrellas."
|
|
2972
2970
|
feedback_comment_error: "Por favor, escribe tu comentario antes de enviar."
|
|
2973
|
-
context_reloaded: "El contexto ha sido recargado."
|
|
2974
2971
|
error_loading_history: "Ocurrió un error al cargar el historial."
|
|
2975
2972
|
request_aborted: "La generación de la respuesta ha sido detenida."
|
|
2976
2973
|
processing_error: "Ocurrió un error al procesar la solicitud."
|
|
@@ -2978,7 +2975,6 @@ js_messages:
|
|
|
2978
2975
|
network_error: "Ocurrió un error de red. Por favor, inténtalo de nuevo en unos momentos."
|
|
2979
2976
|
unknown_server_error: "Error desconocido del servidor."
|
|
2980
2977
|
loading: "Cargando..."
|
|
2981
|
-
reload_init: "Iniciando recarga de contexto en segundo plano..."
|
|
2982
2978
|
no_history_found: "No existe historial de consultas."
|
|
2983
2979
|
prompts_available: "Prompts disponibles"
|
|
2984
2980
|
example: "Ejemplo:"
|
|
@@ -35,17 +35,31 @@ class LLMQueryRepo:
|
|
|
35
35
|
self.session.commit()
|
|
36
36
|
return query
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
#: iat_queries.prompt_name of the platform's own model calls (system agents,
|
|
39
|
+
#: see system_agent_catalog.PROMPT_NAME_PREFIX). Restated here because the
|
|
40
|
+
#: catalog sits above the repositories.
|
|
41
|
+
SYSTEM_AGENT_PROMPT_PREFIX = "system_agent:"
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def conversation_turns_only(cls):
|
|
45
|
+
"""Filter for rows a person asked: not a context initialization, not a system agent run.
|
|
46
|
+
|
|
47
|
+
A system agent's execution is billed like any other call, but it is the
|
|
48
|
+
platform's own work (a memory compilation, a history compaction): shown in
|
|
49
|
+
a user's history or replayed as a turn, it would read as a question they
|
|
50
|
+
never asked.
|
|
51
|
+
"""
|
|
41
52
|
request_source = LLMQuery.stats["request_source"].as_string()
|
|
42
|
-
return
|
|
53
|
+
return and_(
|
|
54
|
+
or_(request_source.is_(None), request_source != CONTEXT_INIT_REQUEST_SOURCE),
|
|
55
|
+
or_(LLMQuery.prompt_name.is_(None), ~LLMQuery.prompt_name.startswith(cls.SYSTEM_AGENT_PROMPT_PREFIX)),
|
|
56
|
+
)
|
|
43
57
|
|
|
44
58
|
# get user query history
|
|
45
59
|
def get_history(self, company: Company, user_identifier: str, limit: int = 100) -> list[LLMQuery]:
|
|
46
60
|
return self.session.query(LLMQuery).filter(
|
|
47
61
|
LLMQuery.user_identifier == user_identifier,
|
|
48
|
-
self.
|
|
62
|
+
self.conversation_turns_only(),
|
|
49
63
|
).filter_by(company_id=company.id).order_by(LLMQuery.created_at.desc()).limit(limit).all()
|
|
50
64
|
|
|
51
65
|
|
|
@@ -701,9 +701,11 @@ class MemoryQuestionScanCursor(Base):
|
|
|
701
701
|
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now, nullable=False)
|
|
702
702
|
|
|
703
703
|
|
|
704
|
-
#: request_source of the iat_queries
|
|
705
|
-
#: the company context sent once to start a server-side conversation.
|
|
706
|
-
#:
|
|
704
|
+
#: request_source of the iat_queries rows that recorded a context initialization:
|
|
705
|
+
#: the company context sent once to start a server-side conversation (v2.57.0 up
|
|
706
|
+
#: to BL-009). Nothing writes them any more, since the history is client-side
|
|
707
|
+
#: only, but they remain in production databases: their tokens were billed and
|
|
708
|
+
#: conversation readers must keep skipping them.
|
|
707
709
|
CONTEXT_INIT_REQUEST_SOURCE = "context_init"
|
|
708
710
|
|
|
709
711
|
|
|
@@ -1521,6 +1523,18 @@ class ModelCatalogEntry(Base):
|
|
|
1521
1523
|
display_name = Column(String(120), nullable=False)
|
|
1522
1524
|
description = Column(Text, nullable=False, default="")
|
|
1523
1525
|
|
|
1526
|
+
#: Tokens the route accepts per request, input and output together, and the
|
|
1527
|
+
#: most it will write in one answer. The conversation history is sized from
|
|
1528
|
+
#: them. Written by `models-sync` from the upstream catalogue on every run,
|
|
1529
|
+
#: never by hand: NULL means no sync has seen this model yet.
|
|
1530
|
+
context_window = Column(Integer, nullable=True)
|
|
1531
|
+
max_output_tokens = Column(Integer, nullable=True)
|
|
1532
|
+
|
|
1533
|
+
#: What the upstream catalogue says the route accepts: input modalities,
|
|
1534
|
+
#: supported parameters, expiration date (BL-009, Fase F). Written by
|
|
1535
|
+
#: `models-sync`, never by hand; empty means no sync has seen the model yet.
|
|
1536
|
+
capabilities = Column(JSON, nullable=False, default=dict)
|
|
1537
|
+
|
|
1524
1538
|
status = Column(String(16), nullable=False, default=ModelCatalogStatus.draft.value, index=True)
|
|
1525
1539
|
|
|
1526
1540
|
#: Whether serving this model costs IAToolkit money per token, and so
|