From 3bf4cd3f1edb86e38728f8d14713518a21b5da33 Mon Sep 17 00:00:00 2001 From: erangi-ar <111747955+erangi-ar@users.noreply.github.com> Date: Wed, 29 Oct 2025 09:03:07 +0530 Subject: [PATCH] Pre demo fixes (#147) * partialy completes prompt refiner * integrate prompt refiner with llm_config_module * fixed ruff lint issues * complete prompt refiner, chunk retriver and reranker * remove unnesessary comments * updated .gitignore * Remove data_sets from tracking * update .gitignore file * complete vault setup and response generator * remove ignore comment * removed old modules * fixed merge conflicts * added initial setup for the vector indexer * initial llm orchestration service update with context generation * added new endpoints * vector indexer with contextual retrieval * fixed requested changes * fixed issue * initial diff identifier setup * uncommment docker compose file * added test endpoint for orchestrate service * fixed ruff linting issue * Rag 103 budget related schema changes (#41) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * rename commonUtils --------- Co-authored-by: erangi-ar * Rag 93 update connection status (#47) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * rename commonUtils * Implement LLM connection status update functionality with API integration and UI enhancements --------- Co-authored-by: erangi-ar * Rag 99 production llm connections logic (#46) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * rename commonUtils * Add production connection retrieval and update related components * Implement LLM connection environment update and enhance connection management logic --------- Co-authored-by: erangi-ar * Rag 119 endpoint to update used budget (#42) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * Add functionality to update used budget for LLM connections with validation and response handling * Implement budget threshold checks and connection deactivation logic in update process * resolve pr comments --------- Co-authored-by: erangi-ar * Rag 113 warning and termination banners (#43) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * Add budget status check and update BudgetBanner component * rename commonUtils * resove pr comments --------- Co-authored-by: erangi-ar * rag-105-reset-used-budget-cron-job (#44) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * Add cron job to reset used budget * rename commonUtils * resolve pr comments * Remove trailing slash from vault/agent-out in .gitignore --------- Co-authored-by: erangi-ar * Rag 101 budget check functionality (#45) * Refactor llm_connections table: update budget tracking fields and reorder columns * Add budget threshold fields and logic to LLM connection management * Enhance budget management: update budget status logic, adjust thresholds, and improve form handling for LLM connections * resolve pr comments & refactoring * rename commonUtils * budget check functionality --------- Co-authored-by: erangi-ar * gui running on 3003 issue fixed * gui running on 3003 issue fixed (#50) Co-authored-by: erangi-ar * added get-configuration.sqpl and updated llmconnections.ts * Add SQL query to retrieve configuration values * Hashicorp key saving (#51) * gui running on 3003 issue fixed * Add SQL query to retrieve configuration values --------- Co-authored-by: erangi-ar * Remove REACT_APP_NOTIFICATION_NODE_URL variable Removed REACT_APP_NOTIFICATION_NODE_URL environment variable. * added initil diff identifier functionality * test phase1 * Refactor inference and connection handling in YAML and TypeScript files * fixes (#52) * gui running on 3003 issue fixed * Add SQL query to retrieve configuration values * Refactor inference and connection handling in YAML and TypeScript files --------- Co-authored-by: erangi-ar * Add entry point script for Vector Indexer with command line interface * fix (#53) * gui running on 3003 issue fixed * Add SQL query to retrieve configuration values * Refactor inference and connection handling in YAML and TypeScript files * Add entry point script for Vector Indexer with command line interface --------- Co-authored-by: erangi-ar * diff fixes * uncomment llm orchestration service in docker compose file * complete vector indexer * Add YAML configurations and scripts for managing vault secrets * Add vault secret management functions and endpoints for LLM connections * Add Test Production LLM page with messaging functionality and styles * fixed issue * fixed merge conflicts * fixed issue * fixed issue * updated with requested chnages * fixed test ui endpoint request responses schema issue * fixed dvc path issue * added dspy optimization * filters fixed * refactor: restructure llm_connections table for improved configuration and tracking * feat: enhance LLM connection handling with AWS and Azure embedding credentials * fixed issues * refactor: remove redundant Azure and AWS credential assignments in vault secret functions * fixed issue --------- Co-authored-by: Charith Nuwan Bimsara <59943919+nuwangeek@users.noreply.github.com> Co-authored-by: nuwangeek Co-authored-by: erangi-ar --- DSL/CronManager/DSL/store_in_vault.yml | 2 +- .../rag-search-script-v1-llm-connections.sql | 41 ++-- .../rag-search/POST/get-llm-connection.sql | 6 +- .../POST/get-llm-connections-paginated.sql | 1 - .../get-production-connection-filtered.sql | 54 +++++ .../rag-search/POST/insert-llm-connection.sql | 18 +- .../update-llm-connection-environment.sql | 3 +- .../POST/update-llm-connection-status.sql | 3 +- .../rag-search/POST/update-llm-connection.sql | 13 +- .../GET/llm-connections/production.yml | 46 +++- .../rag-search/POST/llm-connections/add.yml | 32 ++- .../rag-search/POST/llm-connections/edit.yml | 32 ++- .../rag-search/POST/vault/secret/create.yml | 35 ++- GUI/src/components/MainNavigation/index.tsx | 6 + .../molecules/LLMConnectionForm/index.tsx | 222 +++++++++++++++--- .../LLMConnections/CreateLLMConnection.tsx | 4 +- .../LLMConnections/ViewLLMConnection.tsx | 7 + GUI/src/pages/LLMConnections/index.tsx | 53 ++++- GUI/src/pages/TestProductionLLM/index.tsx | 10 +- GUI/src/services/llmConnections.ts | 106 +++++++-- GUI/src/utils/queryKeys.ts | 4 +- endpoints.md | 29 +++ vault/agent-out/pidfile | 0 23 files changed, 614 insertions(+), 113 deletions(-) create mode 100644 DSL/Resql/rag-search/POST/get-production-connection-filtered.sql delete mode 100644 vault/agent-out/pidfile diff --git a/DSL/CronManager/DSL/store_in_vault.yml b/DSL/CronManager/DSL/store_in_vault.yml index 63522a1..3052219 100644 --- a/DSL/CronManager/DSL/store_in_vault.yml +++ b/DSL/CronManager/DSL/store_in_vault.yml @@ -2,4 +2,4 @@ store_secrets: trigger: off type: exec command: "/app/scripts/store_secrets_in_vault.sh" - allowedEnvs: ['cookie', 'connectionId','llmPlatform', 'llmModel','secretKey','accessKey','deploymentName','targetUrl','apiKey','embeddingModel','embeddingPlatform','embeddingModelApiKey','deploymentEnvironment'] \ No newline at end of file + allowedEnvs: ['cookie', 'connectionId','llmPlatform', 'llmModel','secretKey','accessKey','deploymentName','targetUrl','apiKey','embeddingModel','embeddingPlatform','embeddingAccessKey','embeddingSecretKey','embeddingDeploymentName','embeddingTargetUri','embeddingAzureApiKey','deploymentEnvironment'] \ No newline at end of file diff --git a/DSL/Liquibase/changelog/rag-search-script-v1-llm-connections.sql b/DSL/Liquibase/changelog/rag-search-script-v1-llm-connections.sql index 55cccd2..6367462 100644 --- a/DSL/Liquibase/changelog/rag-search-script-v1-llm-connections.sql +++ b/DSL/Liquibase/changelog/rag-search-script-v1-llm-connections.sql @@ -1,39 +1,40 @@ -- Schema for LLM Connections CREATE TABLE llm_connections ( + -- Metadata id SERIAL PRIMARY KEY, connection_name VARCHAR(255) NOT NULL DEFAULT '', - -- LLM Model Configuration - llm_platform VARCHAR(100) NOT NULL, -- e.g. Azure AI, OpenAI - llm_model VARCHAR(100) NOT NULL, -- e.g. GPT-4o - - -- Embedding Model Configuration - embedding_platform VARCHAR(100) NOT NULL, -- e.g. Azure AI, OpenAI - embedding_model VARCHAR(100) NOT NULL, -- e.g. Ada-200-1 - - -- Budget and Usage Tracking - monthly_budget NUMERIC(12,2) NOT NULL, -- e.g. 1000.00 - used_budget NUMERIC(12,2) DEFAULT 0.00, -- e.g. 250.00 - warn_budget_threshold NUMERIC(5) DEFAULT 80, -- percentage to warn at - stop_budget_threshold NUMERIC(5) DEFAULT 100, -- percentage to stop at - disconnect_on_budget_exceed BOOLEAN DEFAULT TRUE, - - -- Metadata connection_status VARCHAR(50) DEFAULT 'active', -- active / inactive created_at TIMESTAMP DEFAULT NOW(), environment VARCHAR(50) NOT NULL, - -- Mocked Credentials and Access Info + -- LLM Model Configuration + llm_platform VARCHAR(100) NOT NULL, -- e.g. Azure AI, OpenAI + llm_model VARCHAR(100) NOT NULL, -- e.g. GPT-4o -- Azure deployment_name VARCHAR(150), -- for Azure deployments target_uri TEXT, -- for custom endpoints api_key TEXT, -- secured api key mocked here - -- AWS Bedrock secret_key TEXT, access_key TEXT, - -- Embedding Model - embedding_model_api_key TEXT + -- Embedding Model Configuration + embedding_platform VARCHAR(100) NOT NULL, -- e.g. Azure AI, OpenAI + embedding_model VARCHAR(100) NOT NULL, -- e.g. Ada-200-1 + -- Azure + embedding_deployment_name VARCHAR(150), -- for Azure deployments + embedding_target_uri TEXT, -- for custom endpoints + embedding_azure_api_key TEXT, -- secured api key mocked here + -- AWS Bedrock + embedding_secret_key TEXT, + embedding_access_key TEXT, + + -- Budget and Usage Tracking + monthly_budget NUMERIC(12,2) NOT NULL, -- e.g. 1000.00 + used_budget NUMERIC(12,2) DEFAULT 0.00, -- e.g. 250.00 + warn_budget_threshold NUMERIC(5) DEFAULT 80, -- percentage to warn at + stop_budget_threshold NUMERIC(5) DEFAULT 100, -- percentage to stop at + disconnect_on_budget_exceed BOOLEAN DEFAULT TRUE ); CREATE TABLE inference_results ( diff --git a/DSL/Resql/rag-search/POST/get-llm-connection.sql b/DSL/Resql/rag-search/POST/get-llm-connection.sql index 30fdb93..a1128df 100644 --- a/DSL/Resql/rag-search/POST/get-llm-connection.sql +++ b/DSL/Resql/rag-search/POST/get-llm-connection.sql @@ -21,7 +21,11 @@ SELECT secret_key, access_key, -- Embedding model credentials - embedding_model_api_key + embedding_access_key, + embedding_secret_key, + embedding_deployment_name, + embedding_target_uri, + embedding_azure_api_key FROM llm_connections WHERE id = :connection_id AND connection_status <> 'deleted'; diff --git a/DSL/Resql/rag-search/POST/get-llm-connections-paginated.sql b/DSL/Resql/rag-search/POST/get-llm-connections-paginated.sql index 419d7bc..faf1600 100644 --- a/DSL/Resql/rag-search/POST/get-llm-connections-paginated.sql +++ b/DSL/Resql/rag-search/POST/get-llm-connections-paginated.sql @@ -14,7 +14,6 @@ SELECT connection_status, created_at, CEIL(COUNT(*) OVER() / :page_size::DECIMAL) AS totalPages, - -- Calculate budget status based on usage percentage and configured thresholds CASE WHEN used_budget IS NULL OR used_budget = 0 OR (used_budget::DECIMAL / monthly_budget::DECIMAL) < (warn_budget_threshold::DECIMAL / 100.0) THEN 'within_budget' WHEN stop_budget_threshold != 0 AND (used_budget::DECIMAL / monthly_budget::DECIMAL) >= (stop_budget_threshold::DECIMAL / 100.0) THEN 'over_budget' diff --git a/DSL/Resql/rag-search/POST/get-production-connection-filtered.sql b/DSL/Resql/rag-search/POST/get-production-connection-filtered.sql new file mode 100644 index 0000000..4d5ced0 --- /dev/null +++ b/DSL/Resql/rag-search/POST/get-production-connection-filtered.sql @@ -0,0 +1,54 @@ +SELECT + id, + connection_name, + llm_platform, + llm_model, + embedding_platform, + embedding_model, + monthly_budget, + warn_budget_threshold, + stop_budget_threshold, + disconnect_on_budget_exceed, + used_budget, + environment, + connection_status, + created_at, + deployment_name, + target_uri, + api_key, + secret_key, + access_key, + embedding_secret_key, + embedding_access_key, + embedding_deployment_name, + embedding_target_uri, + embedding_azure_api_key, + -- Calculate budget status based on usage percentage and configured thresholds + CASE + WHEN used_budget IS NULL OR used_budget = 0 OR (used_budget::DECIMAL / monthly_budget::DECIMAL) < (warn_budget_threshold::DECIMAL / 100.0) THEN 'within_budget' + WHEN stop_budget_threshold != 0 AND (used_budget::DECIMAL / monthly_budget::DECIMAL) >= (stop_budget_threshold::DECIMAL / 100.0) THEN 'over_budget' + WHEN stop_budget_threshold = 0 AND (used_budget::DECIMAL / monthly_budget::DECIMAL) >= 1 THEN 'over_budget' + WHEN (used_budget::DECIMAL / monthly_budget::DECIMAL) >= (warn_budget_threshold::DECIMAL / 100.0) THEN 'close_to_exceed' + ELSE 'within_budget' + END AS budget_status +FROM llm_connections +WHERE environment = 'production' + AND connection_status <> 'deleted' + AND (:llm_platform IS NULL OR :llm_platform = '' OR llm_platform = :llm_platform) + AND (:llm_model IS NULL OR :llm_model = '' OR llm_model = :llm_model) + AND (:embedding_platform IS NULL OR :embedding_platform = '' OR embedding_platform = :embedding_platform) + AND (:embedding_model IS NULL OR :embedding_model = '' OR embedding_model = :embedding_model) + AND (:connection_status IS NULL OR :connection_status = '' OR connection_status = :connection_status) +ORDER BY + CASE WHEN :sorting = 'connection_name asc' THEN connection_name END ASC, + CASE WHEN :sorting = 'connection_name desc' THEN connection_name END DESC, + CASE WHEN :sorting = 'llm_platform asc' THEN llm_platform END ASC, + CASE WHEN :sorting = 'llm_platform desc' THEN llm_platform END DESC, + CASE WHEN :sorting = 'llm_model asc' THEN llm_model END ASC, + CASE WHEN :sorting = 'llm_model desc' THEN llm_model END DESC, + CASE WHEN :sorting = 'monthly_budget asc' THEN monthly_budget END ASC, + CASE WHEN :sorting = 'monthly_budget desc' THEN monthly_budget END DESC, + CASE WHEN :sorting = 'created_at asc' THEN created_at END ASC, + CASE WHEN :sorting = 'created_at desc' THEN created_at END DESC, + created_at DESC -- Default fallback sorting +LIMIT 1; diff --git a/DSL/Resql/rag-search/POST/insert-llm-connection.sql b/DSL/Resql/rag-search/POST/insert-llm-connection.sql index c4d9679..29465ce 100644 --- a/DSL/Resql/rag-search/POST/insert-llm-connection.sql +++ b/DSL/Resql/rag-search/POST/insert-llm-connection.sql @@ -16,7 +16,11 @@ INSERT INTO llm_connections ( api_key, secret_key, access_key, - embedding_model_api_key + embedding_access_key, + embedding_secret_key, + embedding_deployment_name, + embedding_target_uri, + embedding_azure_api_key ) VALUES ( :connection_name, :llm_platform, @@ -35,7 +39,11 @@ INSERT INTO llm_connections ( :api_key, :secret_key, :access_key, - :embedding_model_api_key + :embedding_access_key, + :embedding_secret_key, + :embedding_deployment_name, + :embedding_target_uri, + :embedding_azure_api_key ) RETURNING id, connection_name, @@ -55,4 +63,8 @@ INSERT INTO llm_connections ( api_key, secret_key, access_key, - embedding_model_api_key; + embedding_secret_key, + embedding_access_key, + embedding_deployment_name, + embedding_target_uri, + embedding_azure_api_key diff --git a/DSL/Resql/rag-search/POST/update-llm-connection-environment.sql b/DSL/Resql/rag-search/POST/update-llm-connection-environment.sql index c16b98c..5b894c9 100644 --- a/DSL/Resql/rag-search/POST/update-llm-connection-environment.sql +++ b/DSL/Resql/rag-search/POST/update-llm-connection-environment.sql @@ -20,5 +20,4 @@ RETURNING target_uri, api_key, secret_key, - access_key, - embedding_model_api_key; + access_key; diff --git a/DSL/Resql/rag-search/POST/update-llm-connection-status.sql b/DSL/Resql/rag-search/POST/update-llm-connection-status.sql index 463936e..f71194a 100644 --- a/DSL/Resql/rag-search/POST/update-llm-connection-status.sql +++ b/DSL/Resql/rag-search/POST/update-llm-connection-status.sql @@ -19,5 +19,4 @@ RETURNING target_uri, api_key, secret_key, - access_key, - embedding_model_api_key; + access_key; diff --git a/DSL/Resql/rag-search/POST/update-llm-connection.sql b/DSL/Resql/rag-search/POST/update-llm-connection.sql index a442227..e4fa4fd 100644 --- a/DSL/Resql/rag-search/POST/update-llm-connection.sql +++ b/DSL/Resql/rag-search/POST/update-llm-connection.sql @@ -18,7 +18,12 @@ SET secret_key = :secret_key, access_key = :access_key, -- Embedding model credentials - embedding_model_api_key = :embedding_model_api_key + -- Embedding platform specific credentials + embedding_access_key = :embedding_access_key, + embedding_secret_key = :embedding_secret_key, + embedding_deployment_name = :embedding_deployment_name, + embedding_target_uri = :embedding_target_uri, + embedding_azure_api_key = :embedding_azure_api_key WHERE id = :connection_id RETURNING id, @@ -39,4 +44,8 @@ RETURNING api_key, secret_key, access_key, - embedding_model_api_key; + embedding_secret_key, + embedding_access_key, + embedding_deployment_name, + embedding_target_uri, + embedding_azure_api_key; diff --git a/DSL/Ruuter.private/rag-search/GET/llm-connections/production.yml b/DSL/Ruuter.private/rag-search/GET/llm-connections/production.yml index be75219..b64e046 100644 --- a/DSL/Ruuter.private/rag-search/GET/llm-connections/production.yml +++ b/DSL/Ruuter.private/rag-search/GET/llm-connections/production.yml @@ -1,15 +1,57 @@ declaration: call: declare version: 0.1 - description: "Get production LLM connection" + description: "Get production LLM connection with optional filters" method: get returns: json namespace: rag-search + allowlist: + params: + - field: llmPlatform + type: string + description: "Filter by LLM platform" + - field: llmModel + type: string + description: "Filter by LLM model" + - field: embeddingPlatform + type: string + description: "Filter by embedding platform" + - field: embeddingModel + type: string + description: "Filter by embedding model" + - field: connectionStatus + type: string + description: "Filter by connection status" + - field: sortBy + type: string + description: "Field to sort by" + - field: sortOrder + type: string + description: "Sort order: 'asc' or 'desc'" + +extract_request_data: + assign: + llmPlatform: ${incoming.params.llmPlatform ?? ""} + llmModel: ${incoming.params.llmModel ?? ""} + embeddingPlatform: ${incoming.params.embeddingPlatform ?? ""} + embeddingModel: ${incoming.params.embeddingModel ?? ""} + connectionStatus: ${incoming.params.connectionStatus ?? ""} + sortBy: ${incoming.params.sortBy ?? "created_at"} + sortOrder: ${incoming.params.sortOrder ?? "desc"} + sorting: ${sortBy + " " + sortOrder} + next: get_production_connection get_production_connection: call: http.post args: - url: "[#RAG_SEARCH_RESQL]/get-production-connection" + url: "[#RAG_SEARCH_RESQL]/get-production-connection-filtered" + body: + llm_platform: ${llmPlatform} + llm_model: ${llmModel} + embedding_platform: ${embeddingPlatform} + embedding_model: ${embeddingModel} + connection_status: ${connectionStatus} + sorting: ${sorting} result: connection_result next: return_success 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 dffe487..5e7326a 100644 --- a/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml +++ b/DSL/Ruuter.private/rag-search/POST/llm-connections/add.yml @@ -56,9 +56,23 @@ declaration: type: string description: "AWS access key" # Embedding model credentials - - field: embedding_model_api_key + # Embedding AWS Bedrock credentials + - field: embedding_access_key type: string - description: "Embedding model API key" + description: "AWS access key for embedding model" + - field: embedding_secret_key + type: string + description: "AWS secret key for embedding model" + # Embedding Azure credentials + - field: embedding_deployment_name + type: string + description: "Azure embedding deployment name" + - field: embedding_target_uri + type: string + description: "Azure embedding endpoint URI" + - field: embedding_azure_api_key + type: string + description: "Azure embedding API key" extract_request_data: assign: @@ -77,7 +91,12 @@ extract_request_data: api_key: ${incoming.body.api_key || ""} secret_key: ${incoming.body.secret_key || ""} access_key: ${incoming.body.access_key || ""} - embedding_model_api_key: ${incoming.body.embedding_model_api_key || ""} + # Embedding platform specific credentials + embedding_access_key: ${incoming.body.embedding_access_key || ""} + embedding_secret_key: ${incoming.body.embedding_secret_key || ""} + embedding_deployment_name: ${incoming.body.embedding_deployment_name || ""} + embedding_target_uri: ${incoming.body.embedding_target_uri || ""} + embedding_azure_api_key: ${incoming.body.embedding_azure_api_key || ""} created_at: ${new Date().toISOString()} next: validate_environment @@ -138,7 +157,12 @@ add_llm_connection: api_key: ${api_key} secret_key: ${secret_key} access_key: ${access_key} - embedding_model_api_key: ${embedding_model_api_key} + # Embedding platform specific credentials + embedding_access_key: ${embedding_access_key} + embedding_secret_key: ${embedding_secret_key} + embedding_deployment_name: ${embedding_deployment_name} + embedding_target_uri: ${embedding_target_uri} + embedding_azure_api_key: ${embedding_azure_api_key} result: connection_result next: assign_connection_response diff --git a/DSL/Ruuter.private/rag-search/POST/llm-connections/edit.yml b/DSL/Ruuter.private/rag-search/POST/llm-connections/edit.yml index 420f3ca..84b375d 100644 --- a/DSL/Ruuter.private/rag-search/POST/llm-connections/edit.yml +++ b/DSL/Ruuter.private/rag-search/POST/llm-connections/edit.yml @@ -56,9 +56,23 @@ declaration: - field: access_key type: string description: "AWS access key" - - field: embedding_model_api_key + # Embedding AWS Bedrock credentials + - field: embedding_access_key type: string - description: "Embedding model API key" + description: "AWS access key for embedding model" + - field: embedding_secret_key + type: string + description: "AWS secret key for embedding model" + # Embedding Azure credentials + - field: embedding_deployment_name + type: string + description: "Azure embedding deployment name" + - field: embedding_target_uri + type: string + description: "Azure embedding endpoint URI" + - field: embedding_azure_api_key + type: string + description: "Azure embedding API key" extract_request_data: assign: @@ -78,7 +92,12 @@ extract_request_data: api_key: ${incoming.body.api_key || ""} secret_key: ${incoming.body.secret_key || ""} access_key: ${incoming.body.access_key || ""} - embedding_model_api_key: ${incoming.body.embedding_model_api_key || ""} + # Embedding platform specific credentials + embedding_access_key: ${incoming.body.embedding_access_key || ""} + embedding_secret_key: ${incoming.body.embedding_secret_key || ""} + embedding_deployment_name: ${incoming.body.embedding_deployment_name || ""} + embedding_target_uri: ${incoming.body.embedding_target_uri || ""} + embedding_azure_api_key: ${incoming.body.embedding_azure_api_key || ""} updated_at: ${new Date().toISOString()} next: validate_environment @@ -124,7 +143,12 @@ update_llm_connection: api_key: ${api_key} secret_key: ${secret_key} access_key: ${access_key} - embedding_model_api_key: ${embedding_model_api_key} + # Embedding platform specific credentials + embedding_access_key: ${embedding_access_key} + embedding_secret_key: ${embedding_secret_key} + embedding_deployment_name: ${embedding_deployment_name} + embedding_target_uri: ${embedding_target_uri} + embedding_azure_api_key: ${embedding_azure_api_key} result: connection_result next: return_success diff --git a/DSL/Ruuter.private/rag-search/POST/vault/secret/create.yml b/DSL/Ruuter.private/rag-search/POST/vault/secret/create.yml index e05d015..96501b3 100644 --- a/DSL/Ruuter.private/rag-search/POST/vault/secret/create.yml +++ b/DSL/Ruuter.private/rag-search/POST/vault/secret/create.yml @@ -38,9 +38,23 @@ declaration: - field: embeddingPlatform type: string description: "Body field 'embeddingPlatform'" - - field: embeddingModelApiKey + # Embedding AWS Bedrock credentials + - field: embeddingAccessKey type: string - description: "Body field 'embeddingModelApiKey'" + description: "Body field 'embeddingAccessKey'" + - field: embeddingSecretKey + type: string + description: "Body field 'embeddingSecretKey'" + # Embedding Azure credentials + - field: embeddingDeploymentName + type: string + description: "Body field 'embeddingDeploymentName'" + - field: embeddingTargetUri + type: string + description: "Body field 'embeddingTargetUri'" + - field: embeddingAzureApiKey + type: string + description: "Body field 'embeddingAzureApiKey'" - field: deploymentEnvironment type: string description: "Body field 'deploymentEnvironment'" @@ -61,7 +75,13 @@ extract_request_data: apiKey: ${incoming.body.apiKey} embeddingModel: ${incoming.body.embeddingModel} embeddingPlatform: ${incoming.body.embeddingPlatform} - embeddingModelApiKey: ${incoming.body.embeddingModelApiKey} + # Embedding AWS Bedrock credentials + embeddingAccessKey: ${incoming.body.embeddingAccessKey} + embeddingSecretKey: ${incoming.body.embeddingSecretKey} + # Embedding Azure credentials + embeddingDeploymentName: ${incoming.body.embeddingDeploymentName} + embeddingTargetUri: ${incoming.body.embeddingTargetUri} + embeddingAzureApiKey: ${incoming.body.embeddingAzureApiKey} deploymentEnvironment: ${incoming.body.deploymentEnvironment} cookie: ${incoming.headers.cookie} next: check_provider @@ -87,7 +107,9 @@ execute_aws_request: accessKey: ${accessKey} embeddingModel: ${embeddingModel} embeddingPlatform: ${embeddingPlatform} - embeddingModelApiKey: ${embeddingModelApiKey} + # Embedding AWS Bedrock credentials + embeddingAccessKey: ${embeddingAccessKey} + embeddingSecretKey: ${embeddingSecretKey} deploymentEnvironment: ${deploymentEnvironment} result: cron_aws_res next: return_aws_ok @@ -106,7 +128,10 @@ execute_azure_request: apiKey: ${apiKey} embeddingModel: ${embeddingModel} embeddingPlatform: ${embeddingPlatform} - embeddingModelApiKey: ${embeddingModelApiKey} + # Embedding Azure credentials + embeddingDeploymentName: ${embeddingDeploymentName} + embeddingTargetUri: ${embeddingTargetUri} + embeddingAzureApiKey: ${embeddingAzureApiKey} deploymentEnvironment: ${deploymentEnvironment} result: cron_azure_res next: return_azure_ok diff --git a/GUI/src/components/MainNavigation/index.tsx b/GUI/src/components/MainNavigation/index.tsx index 2c7d73b..2ae1c70 100644 --- a/GUI/src/components/MainNavigation/index.tsx +++ b/GUI/src/components/MainNavigation/index.tsx @@ -34,6 +34,12 @@ const MainNavigation: FC = () => { label: 'Test LLM', path: '/test-llm', icon: + }, + { + id: 'testProductionLLM', + label: 'Test Production LLM', + path: '/test-production-llm', + icon: } ]; diff --git a/GUI/src/components/molecules/LLMConnectionForm/index.tsx b/GUI/src/components/molecules/LLMConnectionForm/index.tsx index 04557de..a86e7bd 100644 --- a/GUI/src/components/molecules/LLMConnectionForm/index.tsx +++ b/GUI/src/components/molecules/LLMConnectionForm/index.tsx @@ -38,6 +38,13 @@ export type LLMConnectionFormData = { apiKey?: string; // Embedding model credentials embeddingModelApiKey?: string; + // Embedding AWS Bedrock credentials + embeddingAccessKey?: string; + embeddingSecretKey?: string; + // Embedding Azure credentials + embeddingDeploymentName?: string; + embeddingTargetUri?: string; + embeddingAzureApiKey?: string; }; type LLMConnectionFormProps = { @@ -71,7 +78,6 @@ const LLMConnectionForm: React.FC = ({ llmModel: '', embeddingModelPlatform: '', embeddingModel: '', - embeddingModelApiKey: '', monthlyBudget: '', warnBudget: '', stopBudget: '', @@ -85,6 +91,14 @@ const LLMConnectionForm: React.FC = ({ targetUri: '', apiKey: '', // Embedding model credentials + embeddingModelApiKey: '', + // Embedding AWS Bedrock credentials + embeddingAccessKey: '', + embeddingSecretKey: '', + // Embedding Azure credentials + embeddingDeploymentName: '', + embeddingTargetUri: '', + embeddingAzureApiKey: '', ...defaultValues, }, mode: 'onChange', @@ -126,6 +140,10 @@ const embeddingModelOptions = toOptions(embeddingModelsData); const [secretKeyReplaceMode, setSecretKeyReplaceMode] = React.useState(isEditing); const [accessKeyReplaceMode, setAccessKeyReplaceMode] = React.useState(isEditing); const [embeddingApiKeyReplaceMode, setEmbeddingApiKeyReplaceMode] = React.useState(isEditing); + // Embedding platform specific replace modes + const [embeddingSecretKeyReplaceMode, setEmbeddingSecretKeyReplaceMode] = React.useState(isEditing); + const [embeddingAccessKeyReplaceMode, setEmbeddingAccessKeyReplaceMode] = React.useState(isEditing); + const [embeddingAzureApiKeyReplaceMode, setEmbeddingAzureApiKeyReplaceMode] = React.useState(isEditing); const resetLLMCredentialFields = () => { setValue('accessKey', ''); @@ -144,9 +162,18 @@ const embeddingModelOptions = toOptions(embeddingModelsData); const resetEmbeddingModelCredentialFields = () => { setValue('embeddingModelApiKey', ''); setValue('embeddingModel', ''); + // Reset embedding platform specific fields + setValue('embeddingAccessKey', ''); + setValue('embeddingSecretKey', ''); + setValue('embeddingDeploymentName', ''); + setValue('embeddingTargetUri', ''); + setValue('embeddingAzureApiKey', ''); - // Reset replace mode state when platform changes + // Reset replace mode states when platform changes setEmbeddingApiKeyReplaceMode(false); + setEmbeddingSecretKeyReplaceMode(false); + setEmbeddingAccessKeyReplaceMode(false); + setEmbeddingAzureApiKeyReplaceMode(false); }; // Model options based on selected platform const getLLMModelOptions = () => { @@ -315,6 +342,165 @@ const embeddingModelOptions = toOptions(embeddingModelsData); } }; + const renderEmbeddingPlatformSpecificFields = () => { + switch (selectedEmbeddingPlatform) { + case 'aws': + return ( + <> +
+

Embedding Access Key

+

AWS Access Key for Bedrock embedding service

+ ( + { + setEmbeddingAccessKeyReplaceMode(false); + setValue('embeddingAccessKey', ''); + }} + endButtonText="Change" + {...field} + /> + )} + /> +
+
+

Embedding Secret Key

+

AWS Secret Key for Bedrock embedding service

+ ( + { + setEmbeddingSecretKeyReplaceMode(false); + setValue('embeddingSecretKey', ''); + }} + endButtonText="Change" + {...field} + /> + )} + /> +
+ + ); + case 'azure': + return ( + <> +
+

Embedding Deployment Name

+

Azure OpenAI embedding deployment name

+ ( + + )} + /> +
+
+

Embedding Endpoint / Target URI

+

Azure OpenAI embedding service endpoint URL

+ ( + + )} + /> +
+
+

Embedding API Key

+

Azure OpenAI embedding API key

+ ( + { + setEmbeddingAzureApiKeyReplaceMode(false); + setValue('embeddingAzureApiKey', ''); + }} + endButtonText="Change" + {...field} + /> + )} + /> +
+ + ); + + default: + return ( +
+

Embedding Model API Key

+

API key of your embedding model

+ ( + { + setEmbeddingApiKeyReplaceMode(false); + setValue('embeddingModelApiKey', ''); + }} + endButtonText="Change" + {...field} + /> + )} + /> +
+ ); + } + }; + const handleFormSubmit = (data: LLMConnectionFormData) => { const cleanedData = { ...data, @@ -395,7 +581,7 @@ const embeddingModelOptions = toOptions(embeddingModelsData); options={getLLMModelOptions() || []} placeholder={ llmModelsLoading - ? "Loading models..." + ? "Select LLM Model" : llmModelsError ? "Error loading models" : !selectedLLMPlatform @@ -467,7 +653,7 @@ const embeddingModelOptions = toOptions(embeddingModelsData); options={getEmbeddingModelOptions() || []} placeholder={ embeddingModelsLoading - ? "Loading models..." + ? "Select Embedding Model" : embeddingModelsError ? "Error loading models" : !selectedEmbeddingPlatform @@ -486,32 +672,8 @@ const embeddingModelOptions = toOptions(embeddingModelsData); /> -
-

Embedding Model API Key

-

API key of your embedding model

- - ( - { - setEmbeddingApiKeyReplaceMode(false); - setValue('embeddingModelApiKey', ''); - }} - endButtonText="Change" - {...field} - /> - )} - /> -
+ {/* Embedding Platform-specific fields */} + {renderEmbeddingPlatformSpecificFields()}
diff --git a/GUI/src/pages/LLMConnections/CreateLLMConnection.tsx b/GUI/src/pages/LLMConnections/CreateLLMConnection.tsx index dfeb583..c77bdfc 100644 --- a/GUI/src/pages/LLMConnections/CreateLLMConnection.tsx +++ b/GUI/src/pages/LLMConnections/CreateLLMConnection.tsx @@ -15,8 +15,8 @@ const CreateLLMConnection = () => { // Query to check for existing production connection const { data: existingProductionConnection } = useQuery({ - queryKey: ['production-connection'], - queryFn: getProductionConnection, + queryKey: llmConnectionsQueryKeys.production(), + queryFn: () => getProductionConnection(), }); const createConnectionMutation = useMutation({ diff --git a/GUI/src/pages/LLMConnections/ViewLLMConnection.tsx b/GUI/src/pages/LLMConnections/ViewLLMConnection.tsx index 28e429f..3a55528 100644 --- a/GUI/src/pages/LLMConnections/ViewLLMConnection.tsx +++ b/GUI/src/pages/LLMConnections/ViewLLMConnection.tsx @@ -249,6 +249,13 @@ const ViewLLMConnection = () => { accessKey: connectionData.accessKey || '', // Don't show API keys // Embedding model credentials (don't show sensitive data, but include structure) embeddingModelApiKey: connectionData.embeddingModelApiKey || '', // Don't show API keys + // Embedding AWS Bedrock credentials + embeddingAccessKey: connectionData.embeddingAccessKey || '', + embeddingSecretKey: connectionData.embeddingSecretKey || '', + // Embedding Azure credentials + embeddingDeploymentName: connectionData.embeddingDeploymentName || '', + embeddingTargetUri: connectionData.embeddingTargetUri || '', + embeddingAzureApiKey: connectionData.embeddingAzureApiKey || '', }; return ( diff --git a/GUI/src/pages/LLMConnections/index.tsx b/GUI/src/pages/LLMConnections/index.tsx index 6d46024..18dd7f4 100644 --- a/GUI/src/pages/LLMConnections/index.tsx +++ b/GUI/src/pages/LLMConnections/index.tsx @@ -13,7 +13,7 @@ import BudgetBanner from 'components/molecules/BudgetBanner'; import './LLMConnections.scss'; import { platforms, trainingStatuses } from 'config/dataModelsConfig'; import LLMConnectionCard from 'components/molecules/LLMConnectionCard'; -import { fetchLLMConnectionsPaginated, LLMConnectionFilters, LLMConnection, getProductionConnection } from 'services/llmConnections'; +import { fetchLLMConnectionsPaginated, LLMConnectionFilters, LLMConnection, getProductionConnection, ProductionConnectionFilters } from 'services/llmConnections'; import { llmConnectionsQueryKeys } from 'utils/queryKeys'; const LLMConnections: FC = () => { @@ -35,10 +35,17 @@ const LLMConnections: FC = () => { queryFn: () => fetchLLMConnectionsPaginated(filters), }); - // Fetch production connection separately + // Fetch production connection separately with potential filters + const [productionFilters, setProductionFilters] = useState({ + sortBy: 'created_at', + sortOrder: 'desc', + llmPlatform: '', + llmModel: '', + }); + const { data: productionConnection, isLoading: isProductionLoading } = useQuery({ - queryKey: llmConnectionsQueryKeys.production(), - queryFn: getProductionConnection, + queryKey: llmConnectionsQueryKeys.production(productionFilters), + queryFn: () => getProductionConnection(productionFilters), }); @@ -50,11 +57,23 @@ const LLMConnections: FC = () => { setFilters(prev => ({ ...prev, pageNumber: pageIndex })); }, [pageIndex]); + // Sync production filters with main filters on component mount + useEffect(() => { + setProductionFilters(prev => ({ + ...prev, + llmPlatform: filters.llmPlatform || '', + llmModel: filters.llmModel || '', + sortBy: filters.sortBy || 'created_at', + sortOrder: filters.sortOrder || 'desc', + })); + }, [filters.llmPlatform, filters.llmModel, filters.sortBy, filters.sortOrder]); + const handleFilterChange = ( name: string, value: string | number | undefined | { name: string; id: string } ) => { let filterUpdate: Partial = {}; + let productionFilterUpdate: Partial = {}; if (name === 'sorting') { // Handle sorting format - no conversion needed, use snake_case directly @@ -62,11 +81,21 @@ const LLMConnections: FC = () => { const [sortBy, sortOrder] = sortingValue.split(' '); filterUpdate = { + sortBy: sortBy, + sortOrder: sortOrder as 'asc' | 'desc' + }; + + productionFilterUpdate = { sortBy: sortBy, sortOrder: sortOrder as 'asc' | 'desc' }; } else { filterUpdate = { [name]: value }; + + // Update production filters for relevant fields + if (name === 'llmPlatform' || name === 'llmModel') { + productionFilterUpdate = { [name]: value as string }; + } } setFilters((prevFilters) => ({ @@ -74,6 +103,14 @@ const LLMConnections: FC = () => { ...filterUpdate, })); + // Update production filters if relevant + if (Object.keys(productionFilterUpdate).length > 0) { + setProductionFilters((prevFilters) => ({ + ...prevFilters, + ...productionFilterUpdate, + })); + } + // Reset to first page when filters change if (name !== 'pageNumber') { setPageIndex(1); @@ -192,6 +229,12 @@ const LLMConnections: FC = () => { llmModel: '', environment: '', }); + setProductionFilters({ + sortBy: 'created_at', + sortOrder: 'desc', + llmPlatform: '', + llmModel: '', + }); setPageIndex(1); }} appearance={ButtonAppearanceTypes.SECONDARY} @@ -202,7 +245,7 @@ const LLMConnections: FC = () => {
- {productionConnection && ( + {productionConnection && filters?.environment !== "testing" && (

Production LLM Connection

diff --git a/GUI/src/pages/TestProductionLLM/index.tsx b/GUI/src/pages/TestProductionLLM/index.tsx index b5334c1..a9c1493 100644 --- a/GUI/src/pages/TestProductionLLM/index.tsx +++ b/GUI/src/pages/TestProductionLLM/index.tsx @@ -124,11 +124,11 @@ const TestProductionLLM: FC = () => { setMessages(prev => [...prev, botMessage]); // Show toast notification - toast.open({ - type: botMessageType, - title: t('errorOccurred'), - message: t('errorMessage'), - }); + // toast.open({ + // type: botMessageType, + // title: t('errorOccurred'), + // message: t('errorMessage'), + // }); } catch (error) { console.error('Error sending message:', error); diff --git a/GUI/src/services/llmConnections.ts b/GUI/src/services/llmConnections.ts index 83882ab..5b3921c 100644 --- a/GUI/src/services/llmConnections.ts +++ b/GUI/src/services/llmConnections.ts @@ -30,6 +30,13 @@ export interface LLMConnection { accessKey?: string; // Embedding model credentials embeddingModelApiKey?: string; + // Embedding AWS Bedrock credentials + embeddingAccessKey?: string; + embeddingSecretKey?: string; + // Embedding Azure credentials + embeddingDeploymentName?: string; + embeddingTargetUri?: string; + embeddingAzureApiKey?: string; } export interface LLMConnectionsResponse { @@ -69,6 +76,16 @@ export interface LLMConnectionFilters { environment?: string; status?: string; } + +export interface ProductionConnectionFilters { + llmPlatform?: string; + llmModel?: string; + embeddingPlatform?: string; + embeddingModel?: string; + connectionStatus?: string; + sortBy?: string; + sortOrder?: string; +} export interface LegacyLLMConnectionFilters { page: number; pageSize: number; @@ -98,11 +115,18 @@ export interface LLMConnectionFormData { accessKey?: string; // Embedding model credentials embeddingModelApiKey?: string; + // Embedding AWS Bedrock credentials + embeddingAccessKey?: string; + embeddingSecretKey?: string; + // Embedding Azure credentials + embeddingDeploymentName?: string; + embeddingTargetUri?: string; + embeddingAzureApiKey?: string; } // Vault secret service functions async function createVaultSecret(connectionId: string, connectionData: LLMConnectionFormData): Promise { - + const payload = { connectionId, llmPlatform: connectionData.llmPlatform, @@ -121,19 +145,29 @@ async function createVaultSecret(connectionId: string, connectionData: LLMConnec targetUrl: connectionData.targetUri || '', apiKey: connectionData.apiKey || '', }), - embeddingModelApiKey: connectionData.embeddingModelApiKey || '', + // Embedding AWS Bedrock credentials + ...(connectionData.embeddingModelPlatform === 'aws' && { + embeddingAccessKey: connectionData.embeddingAccessKey || '', + embeddingSecretKey: connectionData.embeddingSecretKey || '', + }), + // Embedding Azure credentials + ...(connectionData.embeddingModelPlatform === 'azure' && { + embeddingDeploymentName: connectionData.embeddingDeploymentName || '', + embeddingTargetUri: connectionData.embeddingTargetUri || '', + embeddingAzureApiKey: connectionData.embeddingAzureApiKey || '', + }), }; await apiDev.post(vaultEndpoints.CREATE_VAULT_SECRET(), payload); } async function deleteVaultSecret(connectionId: string, connectionData: Partial): Promise { - + const payload = { connectionId, llmPlatform: connectionData.llmPlatform || '', llmModel: connectionData.llmModel || '', - embeddingModel: connectionData.embeddingModel || '', + embeddingModel: connectionData.embeddingModel || '', embeddingPlatform: connectionData.embeddingModelPlatform || '', deploymentEnvironment: connectionData.deploymentEnvironment?.toLowerCase() || '', }; @@ -164,8 +198,22 @@ export async function getLLMConnection(id: string | number): Promise { - const { data } = await apiDev.get(llmConnectionsEndpoints.GET_PRODUCTION_CONNECTION()); +export async function getProductionConnection(filters?: ProductionConnectionFilters): Promise { + const queryParams = new URLSearchParams(); + + if (filters?.llmPlatform) queryParams.append('llmPlatform', filters.llmPlatform); + if (filters?.llmModel) queryParams.append('llmModel', filters.llmModel); + if (filters?.embeddingPlatform) queryParams.append('embeddingPlatform', filters.embeddingPlatform); + if (filters?.embeddingModel) queryParams.append('embeddingModel', filters.embeddingModel); + if (filters?.connectionStatus) queryParams.append('connectionStatus', filters.connectionStatus); + if (filters?.sortBy) queryParams.append('sortBy', filters.sortBy); + if (filters?.sortOrder) queryParams.append('sortOrder', filters.sortOrder); + + const url = queryParams.toString() + ? `${llmConnectionsEndpoints.GET_PRODUCTION_CONNECTION()}?${queryParams.toString()}` + : llmConnectionsEndpoints.GET_PRODUCTION_CONNECTION(); + + const { data } = await apiDev.get(url); return data?.response?.[0] || null; } @@ -190,11 +238,17 @@ export async function createLLMConnection(connectionData: LLMConnectionFormData) secret_key: maskSensitiveKey(connectionData.secretKey) || "", access_key: maskSensitiveKey(connectionData.accessKey) || "", // Embedding model credentials - embedding_model_api_key: maskSensitiveKey(connectionData.embeddingModelApiKey) || "", + // Embedding AWS Bedrock credentials + embedding_access_key: maskSensitiveKey(connectionData.embeddingAccessKey) || "", + embedding_secret_key: maskSensitiveKey(connectionData.embeddingSecretKey) || "", + // Embedding Azure credentials + embedding_deployment_name: connectionData.embeddingDeploymentName || "", + embedding_target_uri: connectionData.embeddingTargetUri || "", + embedding_azure_api_key: maskSensitiveKey(connectionData.embeddingAzureApiKey) || "", }); - + const connection = data?.response; - + // After successful database creation, store secrets in vault if (connection && connection.id) { try { @@ -205,7 +259,7 @@ export async function createLLMConnection(connectionData: LLMConnectionFormData) // The connection is already created in the database } } - + return connection; } @@ -233,22 +287,30 @@ export async function updateLLMConnection( secret_key: maskSensitiveKey(connectionData.secretKey) || "", access_key: maskSensitiveKey(connectionData.accessKey) || "", // Embedding model credentials - embedding_model_api_key: maskSensitiveKey(connectionData.embeddingModelApiKey) || "", + // Embedding AWS Bedrock credentials + embedding_access_key: maskSensitiveKey(connectionData.embeddingAccessKey) || "", + embedding_secret_key: maskSensitiveKey(connectionData.embeddingSecretKey) || "", + // Embedding Azure credentials + embedding_deployment_name: connectionData.embeddingDeploymentName || "", + embedding_target_uri: connectionData.embeddingTargetUri || "", + embedding_azure_api_key: maskSensitiveKey(connectionData.embeddingAzureApiKey) || "", }); - + const connection = data?.response; - - // After successful database update, update secrets in vault - if (connection) { + + if (connection && (connectionData.secretKey && !connectionData.secretKey?.includes('*') + || connectionData.accessKey && !connectionData.accessKey?.includes('*') + || connectionData.apiKey && !connectionData.apiKey?.includes('*') + || connectionData.embeddingAccessKey && !connectionData.embeddingAccessKey?.includes('*') + || connectionData.embeddingSecretKey && !connectionData.embeddingSecretKey?.includes('*') + || connectionData.embeddingAzureApiKey && !connectionData.embeddingAzureApiKey?.includes('*'))) { try { await createVaultSecret(id.toString(), connectionData); } catch (vaultError) { console.error('Failed to update secrets in vault:', vaultError); - // Note: We don't throw here to avoid breaking the connection update flow - // The connection is already updated in the database } } - + return connection; } @@ -260,12 +322,12 @@ export async function deleteLLMConnection(id: string | number): Promise { } catch (error) { console.error('Failed to get connection data before deletion:', error); } - + // Delete from database await apiDev.post(llmConnectionsEndpoints.DELETE_LLM_CONNECTION(), { connection_id: id, }); - + // After successful database deletion, delete secrets from vault if (connectionToDelete) { try { @@ -293,9 +355,9 @@ export async function checkBudgetStatus(): Promise { return null; } } - + export async function updateLLMConnectionStatus( - id: string | number, + id: string | number, status: 'active' | 'inactive' ): Promise { const { data } = await apiDev.post(llmConnectionsEndpoints.UPDATE_LLM_CONNECTION_STATUS(), { diff --git a/GUI/src/utils/queryKeys.ts b/GUI/src/utils/queryKeys.ts index e004497..e10462e 100644 --- a/GUI/src/utils/queryKeys.ts +++ b/GUI/src/utils/queryKeys.ts @@ -1,5 +1,5 @@ import { PaginationState, SortingState } from '@tanstack/react-table'; -import { LLMConnectionFilters, LegacyLLMConnectionFilters } from 'services/llmConnections'; +import { LLMConnectionFilters, LegacyLLMConnectionFilters, ProductionConnectionFilters } from 'services/llmConnections'; import { InferenceRequest } from 'services/inference'; @@ -30,7 +30,7 @@ export const llmConnectionsQueryKeys = { details: () => [...llmConnectionsQueryKeys.all(), 'detail'] as const, detail: (id: string | number) => [...llmConnectionsQueryKeys.details(), id] as const, budgetStatus: () => [...llmConnectionsQueryKeys.all(), 'budget-status'] as const, - production: () => [...llmConnectionsQueryKeys.all(), 'production'] as const, + production: (filters?: ProductionConnectionFilters) => [...llmConnectionsQueryKeys.all(), 'production', filters] as const, }; export const inferenceQueryKeys = { diff --git a/endpoints.md b/endpoints.md index 6bd4fc9..262e81a 100644 --- a/endpoints.md +++ b/endpoints.md @@ -357,12 +357,41 @@ GET /ruuter-private/llm/connections/list | `llmPlatform` | `string` | Filter by LLM platform | | `llmModel` | `string` | Filter by LLM model | | `deploymentEnvironment` | `string` | Filter by environment (Testing / Production) | +| `pageNumber` | `number` | Page number (1-based) | +| `pageSize` | `number` | Number of items per page | +| `sortBy` | `string` | Field to sort by | +| `sortOrder` | `string` | Sort order: 'asc' or 'desc' | ### Example Request ```http GET /ruuter-private/llm/connections/list?llmPlatform=OpenAI&deploymentEnvironment=Testing&model=GPT4 ``` +--- + +## 5. Get Production LLM Connection (with filters) + +### Endpoint +```http +GET /ruuter-private/llm/connections/production +``` + +### Query Parameters (Optional for filtering) +| Parameter | Type | Description | +|-----------|------|-------------| +| `llmPlatform` | `string` | Filter by LLM platform | +| `llmModel` | `string` | Filter by LLM model | +| `embeddingPlatform` | `string` | Filter by embedding platform | +| `embeddingModel` | `string` | Filter by embedding model | +| `connectionStatus` | `string` | Filter by connection status | +| `sortBy` | `string` | Field to sort by | +| `sortOrder` | `string` | Sort order: 'asc' or 'desc' | + +### Example Request +```http +GET /ruuter-private/llm/connections/production?llmPlatform=OpenAI&connectionStatus=active +``` + ### Response (200 OK) ```json [ diff --git a/vault/agent-out/pidfile b/vault/agent-out/pidfile deleted file mode 100644 index e69de29..0000000