Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions DSL/Resql/rag-search/POST/mock-count-active-services.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Count active services for tool classifier
-- Used by Service Workflow to determine search strategy:
-- - If count <= 50: Use all services for LLM context
-- - If count > 50: Use Qdrant semantic search for top 20

SELECT
COUNT(*) AS active_service_count
FROM
public.services
WHERE
current_state = 'active';
20 changes: 20 additions & 0 deletions DSL/Resql/rag-search/POST/mock-get-all-active-services.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Get all active services for intent detection
-- Used when active_service_count <= 50
-- Returns all service metadata needed for LLM intent detection

SELECT
service_id,
name,
description,
ruuter_type,
slot,
entities,
examples,
structure,
endpoints
FROM
public.services
WHERE
current_state = 'active'
ORDER BY
name ASC;
24 changes: 24 additions & 0 deletions DSL/Resql/rag-search/POST/mock-get-service-by-id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- Get specific service by service_id for validation
-- Used after LLM detects intent to validate the service exists and is active
-- Returns all service details needed to trigger the external service call

SELECT
id,
service_id,
name,
description,
ruuter_type,
current_state,
is_common,
slot,
entities,
examples,
structure,
endpoints,
created_at,
updated_at
FROM
public.services
WHERE
service_id = :serviceId
AND current_state = 'active';
60 changes: 60 additions & 0 deletions DSL/Ruuter.public/rag-search/GET/services/get-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
declaration:
call: declare
version: 0.1
description: "Get services for intent detection - returns all services if count <= 10, otherwise signals to use semantic search"
method: get
returns: json
namespace: rag-search

# Step 1: Count active services
count_services:
call: http.post
args:
url: "[#RAG_SEARCH_RESQL]/mock-count-active-services"
body: {}
result: count_result
next: check_service_count

# Step 2: Check if count > threshold (10)
check_service_count:
assign:
service_count: ${Number(count_result.response.body[0].active_service_count)}
switch:
- condition: "${service_count > 10}"
next: return_semantic_search_flag
next: fetch_all_services

# Step 3a: If > 10, return flag for semantic search
return_semantic_search_flag:
assign:
semantic_search_response:
use_semantic_search: true
service_count: ${service_count}
message: "Service count exceeds threshold - use semantic search"
next: return_semantic_search_response

return_semantic_search_response:
return: ${semantic_search_response}
next: end

# Step 3b: If <= 10, fetch all services
fetch_all_services:
call: http.post
args:
url: "[#RAG_SEARCH_RESQL]/mock-get-all-active-services"
body: {}
result: services_result
next: return_all_services

# Step 4: Return all services for LLM
return_all_services:
assign:
all_services_response:
use_semantic_search: false
service_count: ${services_result.response.body.length}
services: ${services_result.response.body}
next: return_all_services_response

return_all_services_response:
return: ${all_services_response}
next: end
Loading
Loading