Tinkex.Types.GetServerCapabilitiesResponse (Tinkex v0.3.4)

View Source

Supported model metadata returned by the service capabilities endpoint.

Contains a list of SupportedModel structs with full metadata including model IDs, names, and architecture types.

Migration Note

Prior versions stored only model names as strings. The new structure provides richer metadata while maintaining backward compatibility for parsing responses.

Summary

Functions

Parse from JSON map with string or atom keys.

Extract just the model names from the response for convenience.

Types

t()

@type t() :: %Tinkex.Types.GetServerCapabilitiesResponse{
  supported_models: [Tinkex.Types.SupportedModel.t()]
}

Functions

from_json(map)

@spec from_json(map()) :: t()

Parse from JSON map with string or atom keys.

Handles various input formats for backward compatibility:

  • Array of model objects with metadata fields
  • Array of plain strings (legacy format)
  • Mixed arrays

model_names(get_server_capabilities_response)

@spec model_names(t()) :: [String.t() | nil]

Extract just the model names from the response for convenience.

This is useful for callers who only need the names (legacy behavior).

Example

iex> response = %GetServerCapabilitiesResponse{
...>   supported_models: [
...>     %SupportedModel{model_name: "llama"},
...>     %SupportedModel{model_name: "qwen"}
...>   ]
...> }
iex> GetServerCapabilitiesResponse.model_names(response)
["llama", "qwen"]