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

Function gateway_inference_set

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

Source from the content-addressed store, hash-verified

5736}
5737
5738pub async fn gateway_inference_set(
5739 server: &str,
5740 provider_name: &str,
5741 model_id: &str,
5742 route_name: &str,
5743 no_verify: bool,
5744 timeout_secs: u64,
5745 tls: &TlsOptions,
5746) -> Result<()> {
5747 let progress = if std::io::stdout().is_terminal() {
5748 let spinner = ProgressBar::new_spinner();
5749 spinner.set_style(
5750 ProgressStyle::with_template("{spinner:.cyan} {msg} ({elapsed})")
5751 .unwrap_or_else(|_| ProgressStyle::default_spinner()),
5752 );
5753 spinner.set_message("Configuring inference...");
5754 spinner.enable_steady_tick(Duration::from_millis(120));
5755 Some(spinner)
5756 } else {
5757 None
5758 };
5759
5760 let mut client = grpc_inference_client(server, tls).await?;
5761 let response = client
5762 .set_cluster_inference(SetClusterInferenceRequest {
5763 provider_name: provider_name.to_string(),
5764 model_id: model_id.to_string(),
5765 route_name: route_name.to_string(),
5766 verify: false,
5767 no_verify,
5768 timeout_secs,
5769 })
5770 .await;
5771
5772 if let Some(progress) = &progress {
5773 progress.finish_and_clear();
5774 }
5775
5776 let response = response.map_err(format_inference_status)?;
5777
5778 let configured = response.into_inner();
5779 let label = if configured.route_name == "sandbox-system" {
5780 "System inference configured:"
5781 } else {
5782 "Gateway inference configured:"
5783 };
5784 println!("{}", label.cyan().bold());
5785 println!();
5786 println!(" {} {}", "Route:".dimmed(), configured.route_name);
5787 println!(" {} {}", "Provider:".dimmed(), configured.provider_name);
5788 println!(" {} {}", "Model:".dimmed(), configured.model_id);
5789 println!(" {} {}", "Version:".dimmed(), configured.version);
5790 print_timeout(configured.timeout_secs);
5791 if configured.validation_performed {
5792 println!(" {}", "Validated Endpoints:".dimmed());
5793 for endpoint in configured.validated_endpoints {
5794 println!(" - {} ({})", endpoint.url, endpoint.protocol);
5795 }

Callers 1

mainFunction · 0.85

Calls 4

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

Tested by

no test coverage detected