MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / execute_with_resilience

Method execute_with_resilience

python/src/llm/client.rs:959–990  ·  view source on GitHub ↗

Core execution method with full resilience patterns

(
        provider: Arc<RwLock<Box<dyn LlmProviderTrait>>>,
        circuit_breaker: Arc<CircuitBreaker>,
        stats: Arc<RwLock<ClientStats>>,
        config: ClientConfig,
        prompt: String,

Source from the content-addressed store, hash-verified

957impl LlmClient {
958 /// Core execution method with full resilience patterns
959 async fn execute_with_resilience(
960 provider: Arc<RwLock<Box<dyn LlmProviderTrait>>>,
961 circuit_breaker: Arc<CircuitBreaker>,
962 stats: Arc<RwLock<ClientStats>>,
963 config: ClientConfig,
964 prompt: String,
965 max_tokens: Option<u32>,
966 temperature: Option<f32>,
967 enable_prompt_caching: bool,
968 ) -> PyResult<String> {
969 let mut request = LlmRequest::new(prompt);
970 if let Some(tokens) = max_tokens {
971 request = request.with_max_tokens(tokens);
972 }
973 if let Some(temp) = temperature {
974 request = request.with_temperature(temp);
975 }
976 if enable_prompt_caching {
977 request = request.with_prompt_caching(true);
978 }
979
980 let response = Self::execute_request_with_resilience(
981 provider,
982 circuit_breaker,
983 stats,
984 config,
985 request,
986 )
987 .await?;
988
989 Ok(response.content)
990 }
991
992 /// Core execution method with full resilience patterns (returns full response)
993 async fn execute_with_resilience_full(

Callers

nothing calls this directly

Calls 3

with_prompt_cachingMethod · 0.80
with_max_tokensMethod · 0.45
with_temperatureMethod · 0.45

Tested by

no test coverage detected