types/client
Client, ClientError, and ChatFn types — LLM client configuration and helpers.
Types
pub type ChatFn =
fn(Client, List(message.Message), List(tool_def.ToolDefinition)) -> Result(
response.ChatResponse,
ClientError,
)
pub type Client {
Client(api_key: String, base_url: String, model: String)
}
Constructors
-
Client(api_key: String, base_url: String, model: String)
pub type ClientError {
AuthError(status: Int, body: String)
RateLimitError(status: Int, body: String, retry_after_ms: Int)
ServerError(status: Int, body: String)
ContextOverflowError(status: Int, body: String)
PayloadTooLargeError(status: Int, body: String)
NetworkError(message: String)
JsonParseError(detail: String)
}
Constructors
-
AuthError(status: Int, body: String) -
RateLimitError(status: Int, body: String, retry_after_ms: Int) -
ServerError(status: Int, body: String) -
ContextOverflowError(status: Int, body: String) -
PayloadTooLargeError(status: Int, body: String) -
NetworkError(message: String) -
JsonParseError(detail: String)
Values
pub fn client_error_to_string(err: ClientError) -> String
pub fn new_client(api_key: String) -> Client