MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / gateway_inference_update

Function gateway_inference_update

crates/openshell-cli/src/run.rs:5800–5880  ·  view source on GitHub ↗
(
    server: &str,
    provider_name: Option<&str>,
    model_id: Option<&str>,
    route_name: &str,
    no_verify: bool,
    timeout_secs: Option<u64>,
    tls: &TlsOptions,
)

Source from the content-addressed store, hash-verified

5798}
5799
5800pub async fn gateway_inference_update(
5801 server: &str,
5802 provider_name: Option<&str>,
5803 model_id: Option<&str>,
5804 route_name: &str,
5805 no_verify: bool,
5806 timeout_secs: Option<u64>,
5807 tls: &TlsOptions,
5808) -> Result<()> {
5809 if provider_name.is_none() && model_id.is_none() && timeout_secs.is_none() {
5810 return Err(miette::miette!(
5811 "at least one of --provider, --model, or --timeout must be specified"
5812 ));
5813 }
5814
5815 let mut client = grpc_inference_client(server, tls).await?;
5816
5817 // Fetch current config to use as base for the partial update.
5818 let current = client
5819 .get_cluster_inference(GetClusterInferenceRequest {
5820 route_name: route_name.to_string(),
5821 })
5822 .await
5823 .into_diagnostic()?
5824 .into_inner();
5825
5826 let provider = provider_name.unwrap_or(&current.provider_name);
5827 let model = model_id.unwrap_or(&current.model_id);
5828 let timeout = timeout_secs.unwrap_or(current.timeout_secs);
5829
5830 let progress = if std::io::stdout().is_terminal() {
5831 let spinner = ProgressBar::new_spinner();
5832 spinner.set_style(
5833 ProgressStyle::with_template("{spinner:.cyan} {msg} ({elapsed})")
5834 .unwrap_or_else(|_| ProgressStyle::default_spinner()),
5835 );
5836 spinner.set_message("Configuring inference...");
5837 spinner.enable_steady_tick(Duration::from_millis(120));
5838 Some(spinner)
5839 } else {
5840 None
5841 };
5842
5843 let response = client
5844 .set_cluster_inference(SetClusterInferenceRequest {
5845 provider_name: provider.to_string(),
5846 model_id: model.to_string(),
5847 route_name: route_name.to_string(),
5848 verify: false,
5849 no_verify,
5850 timeout_secs: timeout,
5851 })
5852 .await;
5853
5854 if let Some(progress) = &progress {
5855 progress.finish_and_clear();
5856 }
5857

Callers 1

mainFunction · 0.85

Calls 5

grpc_inference_clientFunction · 0.85
print_timeoutFunction · 0.85
get_cluster_inferenceMethod · 0.80
set_messageMethod · 0.80
set_cluster_inferenceMethod · 0.80

Tested by

no test coverage detected