|
26 | 26 | from src.response_generator.response_generate import ResponseGeneratorAgent |
27 | 27 | from src.response_generator.response_generate import stream_response_native |
28 | 28 | from src.llm_orchestrator_config.llm_ochestrator_constants import ( |
29 | | - OUT_OF_SCOPE_MESSAGE, |
30 | 29 | OUT_OF_SCOPE_MESSAGES, |
31 | 30 | TECHNICAL_ISSUE_MESSAGE, |
32 | 31 | TECHNICAL_ISSUE_MESSAGES, |
|
67 | 66 | class LangfuseConfig: |
68 | 67 | """Configuration for Langfuse integration.""" |
69 | 68 |
|
70 | | - def __init__(self): |
| 69 | + def __init__(self) -> None: |
71 | 70 | self.langfuse_client: Optional[Langfuse] = None |
72 | 71 | self._initialize_langfuse() |
73 | 72 |
|
@@ -496,10 +495,8 @@ async def stream_orchestration_response( |
496 | 495 | components = self._initialize_service_components(request) |
497 | 496 | timing_dict["initialization"] = time.time() - start_time |
498 | 497 |
|
499 | | - # PRIORITY 1 OPTIMIZATION: Input Guardrails Check BEFORE Classifier |
500 | 498 | # This implements fail-fast principle - block malicious/policy-violating inputs |
501 | 499 | # before expensive operations (service discovery, LLM calls, streaming setup) |
502 | | - # Saves 6.4s + $0.002 per blocked request! |
503 | 500 | logger.info( |
504 | 501 | f"[{request.chatId}] [{stream_ctx.stream_id}] Checking input guardrails (before classifier)" |
505 | 502 | ) |
@@ -1086,12 +1083,12 @@ def _initialize_service_components( |
1086 | 1083 | # Falls back to per-request initialization if shared instance unavailable |
1087 | 1084 | if self.shared_guardrails_adapter is not None: |
1088 | 1085 | logger.debug( |
1089 | | - f"Using shared guardrails adapter (startup-initialized, zero overhead)" |
| 1086 | + "Using shared guardrails adapter (startup-initialized, zero overhead)" |
1090 | 1087 | ) |
1091 | 1088 | components["guardrails_adapter"] = self.shared_guardrails_adapter |
1092 | 1089 | else: |
1093 | 1090 | logger.warning( |
1094 | | - f"Shared guardrails unavailable, initializing per-request (slower)" |
| 1091 | + "Shared guardrails unavailable, initializing per-request (slower)" |
1095 | 1092 | ) |
1096 | 1093 | components["guardrails_adapter"] = self._safe_initialize_guardrails( |
1097 | 1094 | request.environment, request.connection_id |
|
0 commit comments