MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / closest

Method closest

crates/opencode-provider/src/bootstrap.rs:1560–1570  ·  view source on GitHub ↗

Find the closest matching model for a provider given a list of query strings.

(&self, provider_id: &str, queries: &[&str])

Source from the content-addressed store, hash-verified

1558
1559 /// Find the closest matching model for a provider given a list of query strings.
1560 pub fn closest(&self, provider_id: &str, queries: &[&str]) -> Option<(String, String)> {
1561 let provider = self.providers.get(provider_id)?;
1562 for query in queries {
1563 for model_id in provider.models.keys() {
1564 if model_id.contains(query) {
1565 return Some((provider_id.to_string(), model_id.clone()));
1566 }
1567 }
1568 }
1569 None
1570 }
1571
1572 /// Get the small model for a provider, using priority lists.
1573 pub fn get_small_model(

Callers

nothing calls this directly

Calls 3

containsMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected