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:
TransportorTimeoutwhen the HTTP request or a response read fails;- the kind
classify_http_failurepicks for the response when the Gateway returns a status outside the 2xx range; MalformedResponsewhen the body is not a valid model list.