diff --git a/DSL/Ruuter.private/rag-search/POST/inference/production.yml b/DSL/Ruuter.private/rag-search/POST/inference/production.yml index e9b90ee..5b13570 100644 --- a/DSL/Ruuter.private/rag-search/POST/inference/production.yml +++ b/DSL/Ruuter.private/rag-search/POST/inference/production.yml @@ -85,10 +85,15 @@ call_orchestrate_endpoint: headers: Content-Type: "application/json" result: orchestrate_result + next: assign_response + +assign_response: + assign: + response: "${orchestrate_result.response.body}" next: return_orchestrate_response return_orchestrate_response: - return: ${orchestrate_result.response.body} + return: ${response} next: end assign_disconnected_response: diff --git a/DSL/Ruuter.private/rag-search/POST/inference/test.yml b/DSL/Ruuter.private/rag-search/POST/inference/test.yml index 28f346a..61a5bd9 100644 --- a/DSL/Ruuter.private/rag-search/POST/inference/test.yml +++ b/DSL/Ruuter.private/rag-search/POST/inference/test.yml @@ -24,8 +24,9 @@ extract_request_data: get_connection: call: http.post args: - url: "[#RAG_SEARCH_RESQL]/get-production-connection" - body: {} + url: "[#RAG_SEARCH_RESQL]/get-llm-connection" + body: + connection_id: ${connectionId} result: connection_result next: validate_connection @@ -57,7 +58,7 @@ validate_budget_status: call_orchestrate_endpoint: call: http.post args: - url: "[#RAG_SEARCH_LLM_ORCHESTRATOR]" + url: "[#RAG_SEARCH_LLM_ORCHESTRATOR]/test" body: connectionId: ${connectionId} message: ${message} @@ -65,10 +66,15 @@ call_orchestrate_endpoint: headers: Content-Type: "application/json" result: orchestrate_result + next: assign_response + +assign_response: + assign: + response: "${orchestrate_result.response.body}" next: return_orchestrate_response return_orchestrate_response: - return: ${orchestrate_result.response.body} + return: ${response} next: end assign_disconnected_response: diff --git a/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml b/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml index 78dbeea..dffe487 100644 --- a/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml +++ b/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml @@ -140,10 +140,19 @@ add_llm_connection: access_key: ${access_key} embedding_model_api_key: ${embedding_model_api_key} result: connection_result + next: assign_connection_response + +assign_connection_response: + assign: + response: { + id: "${connection_result.response.body[0].id}", + status: 201, + operationSuccess: true + } next: return_success return_success: - return: "LLM connection added successfully" + return: ${response} status: 200 next: end diff --git a/GUI/src/services/inference.ts b/GUI/src/services/inference.ts index f469251..28de0e7 100644 --- a/GUI/src/services/inference.ts +++ b/GUI/src/services/inference.ts @@ -16,8 +16,8 @@ export interface InferenceResponse { } export async function viewInferenceResult(request: InferenceRequest): Promise { - const { data } = await apiDev.post(inferenceEndpoints.VIEW_INFERENCE_RESULT(), { - llmConnectionId: request.llmConnectionId, + const { data } = await apiDev.post(inferenceEndpoints.VIEW_TEST_INFERENCE_RESULT(), { + connectionId: request.llmConnectionId, message: request.message, }); return data; diff --git a/GUI/src/utils/endpoints.ts b/GUI/src/utils/endpoints.ts index 1eb98b9..37d8173 100644 --- a/GUI/src/utils/endpoints.ts +++ b/GUI/src/utils/endpoints.ts @@ -25,5 +25,5 @@ export const llmConnectionsEndpoints = { } export const inferenceEndpoints = { - VIEW_INFERENCE_RESULT: (): string => `/rag-search/inference/results/view`, + VIEW_TEST_INFERENCE_RESULT: (): string => `/rag-search/inference/test`, } diff --git a/docker-compose.yml b/docker-compose.yml index f85d5d2..8fc77ef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -142,7 +142,7 @@ services: - NODE_ENV=development - REACT_APP_RUUTER_API_URL=http://localhost:8086 - REACT_APP_RUUTER_PRIVATE_API_URL=http://localhost:8088 - - REACT_APP_CUSTOMER_SERVICE_LOGIN=http://localhost:3004 + - REACT_APP_CUSTOMER_SERVICE_LOGIN=http://localhost:3004/et/dev-auth - REACT_APP_CSP=upgrade-insecure-requests; default-src 'self'; font-src 'self' data:; img-src 'self' data:; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; object-src 'none'; connect-src 'self' http://localhost:8086 http://localhost:8088 http://localhost:3004 http://localhost:3005 ws://localhost; - DEBUG_ENABLED=true - CHOKIDAR_USEPOLLING=true @@ -419,7 +419,7 @@ services: - ./vault/config:/vault/config # contains vault.hcl - ./vault/logs:/vault/logs expose: - - "8200" + - "8200" networks: - bykstack restart: unless-stopped diff --git a/run_vector_indexer.py b/run_vector_indexer.py new file mode 100644 index 0000000..b01150f --- /dev/null +++ b/run_vector_indexer.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 +""" +Entry point script for Vector Indexer - Contextual Retrieval Pipeline + +This script can be run directly or called by cron jobs for automated processing. + +Usage: + python run_vector_indexer.py [--config CONFIG_PATH] [--health-check] [--dry-run] + +Examples: + # Run with default config + python run_vector_indexer.py + + # Run with custom config + python run_vector_indexer.py --config /path/to/config.yaml + + # Health check only + python run_vector_indexer.py --health-check + + # Dry run (validate without processing) + python run_vector_indexer.py --dry-run +""" + +import argparse +import asyncio +import sys +from pathlib import Path + +# Add src to Python path +sys.path.insert(0, str(Path(__file__).parent / "src")) + +from src.vector_indexer.main_indexer import VectorIndexer + + +async def main(): + """Main entry point with command line argument parsing.""" + + parser = argparse.ArgumentParser( + description="Vector Indexer - Contextual Retrieval Pipeline", + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=__doc__, + ) + + parser.add_argument( + "--config", + type=str, + default="src/vector_indexer/config/vector_indexer_config.yaml", + help="Path to configuration file (default: src/vector_indexer/config/vector_indexer_config.yaml)", + ) + + parser.add_argument( + "--health-check", action="store_true", help="Run health check only and exit" + ) + + parser.add_argument( + "--dry-run", + action="store_true", + help="Validate configuration and connectivity without processing documents", + ) + + parser.add_argument( + "--verbose", "-v", action="store_true", help="Enable verbose logging" + ) + + parser.add_argument( + "--quiet", "-q", action="store_true", help="Suppress non-error output" + ) + + args = parser.parse_args() + + # Configure logging level based on arguments + log_level = "INFO" + if args.verbose: + log_level = "DEBUG" + elif args.quiet: + log_level = "ERROR" + + try: + # Initialize vector indexer with specified config + indexer = VectorIndexer(config_path=args.config) + + if args.health_check: + # Health check only + print("๐Ÿ” Running health check...") + health_ok = await indexer.run_health_check() + + if health_ok: + print("โœ… Health check passed!") + return 0 + else: + print("โŒ Health check failed!") + return 1 + + elif args.dry_run: + # Dry run - validate without processing + print("๐Ÿงช Running dry run validation...") + + health_ok = await indexer.run_health_check() + if not health_ok: + print("โŒ Validation failed!") + return 1 + + # Discover documents but don't process + documents = indexer.document_loader.discover_all_documents() + print(f"๐Ÿ“„ Found {len(documents)} documents ready for processing") + print("โœ… Dry run validation passed!") + return 0 + + else: + # Full processing run + print("๐Ÿš€ Starting Vector Indexer processing...") + + # Health check first + health_ok = await indexer.run_health_check() + if not health_ok: + print("โŒ Pre-processing health check failed!") + return 1 + + # Process all documents + stats = await indexer.process_all_documents() + + # Return appropriate exit code + if stats.documents_failed > 0: + print(f"โš ๏ธ Processing completed with {stats.documents_failed} failures") + return 2 # Partial success + else: + print("โœ… Processing completed successfully!") + return 0 + + except KeyboardInterrupt: + print("\nโน๏ธ Processing interrupted by user") + return 130 + except FileNotFoundError as e: + print(f"โŒ Configuration file not found: {e}") + return 1 + except Exception as e: + print(f"๐Ÿ’ฅ Fatal error: {e}") + return 1 + + +def cron_entry_point(): + """ + Entry point specifically designed for cron jobs. + + This function: + - Uses minimal output suitable for cron logs + - Returns appropriate exit codes for monitoring + - Handles errors gracefully for automated systems + """ + import logging + + # Configure minimal logging for cron + logging.basicConfig( + level=logging.INFO, + format="%(asctime)s - Vector Indexer - %(levelname)s - %(message)s", + ) + + try: + # Run with default configuration + result = asyncio.run(main()) + + if result == 0: + logging.info("Vector indexer completed successfully") + elif result == 2: + logging.warning("Vector indexer completed with some failures") + else: + logging.error("Vector indexer failed") + + return result + + except Exception as e: + logging.error(f"Vector indexer fatal error: {e}") + return 1 + + +if __name__ == "__main__": + # Run the async main function + exit_code = asyncio.run(main()) + sys.exit(exit_code)