MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / execute_llm

Method execute_llm

crates/core/src/plugins/nemo_guardrails/python.rs:134–152  ·  view source on GitHub ↗
(
        &self,
        request: LlmRequest,
        next: crate::api::runtime::LlmExecutionNextFn,
        enable_input: bool,
        enable_output: bool,
    )

Source from the content-addressed store, hash-verified

132 }
133
134 async fn execute_llm(
135 &self,
136 request: LlmRequest,
137 next: crate::api::runtime::LlmExecutionNextFn,
138 enable_input: bool,
139 enable_output: bool,
140 ) -> FlowResult<Json> {
141 let (request, messages) = self.prepare_llm_request(request, enable_input).await?;
142 let response = next(request).await?;
143
144 if enable_output {
145 let annotated_response = self.codec()?.decode_response(&response)?;
146 if let Some(response_text) = annotated_response.response_text() {
147 self.check_output_rails(&messages, response_text).await?;
148 }
149 }
150
151 Ok(response)
152 }
153
154 async fn execute_llm_stream(
155 &self,

Callers 1

register_local_backendFunction · 0.80

Calls 5

prepare_llm_requestMethod · 0.80
codecMethod · 0.80
check_output_railsMethod · 0.80
decode_responseMethod · 0.45
response_textMethod · 0.45

Tested by

no test coverage detected