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

Function infer_vertex_publisher

crates/openshell-server/src/inference.rs:280–299  ·  view source on GitHub ↗

Infer the Vertex AI publisher segment from a model identifier. Currently only the `"anthropic"` result is consumed by `resolve_vertex_ai_route` to select between the native Anthropic Messages API (`rawPredict`) and the OpenAI-compatible endpoint. Non-Anthropic publisher mappings (`meta`, `mistralai`, `ai21`, `deepseek`, `google`) are maintained for forward compatibility and documentation value —

(model_id: &str)

Source from the content-addressed store, hash-verified

278/// fall back to the OpenAI-compatible endpoint
279/// (`v1beta1/.../endpoints/openapi`).
280fn infer_vertex_publisher(model_id: &str) -> Option<&'static str> {
281 if model_id.starts_with("claude-") {
282 Some("anthropic")
283 } else if model_id.starts_with("gemini-")
284 || model_id.starts_with("text-bison-")
285 || model_id.starts_with("chat-bison-")
286 {
287 Some("google")
288 } else if model_id.starts_with("llama-") {
289 Some("meta")
290 } else if model_id.starts_with("mistral-") || model_id.starts_with("codestral-") {
291 Some("mistralai")
292 } else if model_id.starts_with("jamba-") {
293 Some("ai21")
294 } else if model_id.starts_with("deepseek-") {
295 Some("deepseek")
296 } else {
297 None
298 }
299}
300
301/// Return a required Vertex AI config value, or a `FailedPrecondition` status.
302fn required_vertex_config<'a>(

Callers 1

resolve_vertex_ai_routeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected