Skip to content

Add #service Prefix Short-Circuit to process_orchestration_request #360

@nuwangeek

Description

@nuwangeek

Priority: P3 — Connects the direct executor to the non-streaming endpoint
File: src/llm_orchestration_service.py
Method: process_orchestration_request()
Type: Control flow addition
Insert a check before STEP 0.5 (query validation). The check must be the very first logic after language detection:

# STEP 0.1: Multi-step service prefix check (bypass NLU pipeline)
if request.message.startswith(SERVICE_STEP_PREFIXES):
    logger.info(f"[{request.chatId}] #service prefix detected - direct step execution")
    if self.service_workflow_executor is None:
        # initialize with llm_manager if needed
        ...
    response = await self.service_workflow_executor.execute_direct_step(
        request=request,
        time_metric=time_metric,
    )
    if response is not None:
        return response
    # If parsing failed, fall through to normal pipeline (safe degradation)

SERVICE_STEP_PREFIXES is the constant added in Task-05, imported here.
Note: Language detection is still allowed to run first (it is cheap and needed for potential error messages from the fallback path).
Work:

  1. Import SERVICE_STEP_PREFIXES from tool_classifier.constants.
  2. Add the prefix check block immediately after language detection.
  3. Ensure the service_workflow_executor instance is either reused from the tool classifier or lazily initialized.
  4. Add integration test: send #service, /POST/services/active/test_step to the non-streaming path and verify it skips guardrails + classifier.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions