Skip to main content

fetch_model_catalog

Function fetch_model_catalog 

Source
pub async fn fetch_model_catalog(
    base_url: &str,
    token: &str,
) -> Result<ModelCatalog, CompletionError>
Expand description

Fetches a [ModelCatalog] from the Gateway’s /models endpoint.

base_url is the root of the Gateway’s OpenAI-compatible API, for example http://127.0.0.1:8081/v1. The request sends token as a bearer token.

§Errors

Returns a CompletionError. Its kind is:

  • Transport or Timeout when the HTTP request or a response read fails;
  • the kind classify_http_failure picks for the response when the Gateway returns a status outside the 2xx range;
  • MalformedResponse when the body is not a valid model list.