Structs§
Enums§
Constants§
Functions§
- convert_
image - Convert an image content into an image json based on format
- detect_
image_ path - Detect if a string contains a path to an image file
- filter_
extensions_ from_ system_ prompt - get_
model - Extract the model name from a JSON object. Common with most providers to have this top level attribute.
- handle_
response_ google_ compat - Handle response from Google Gemini API-compatible endpoints.
- handle_
response_ openai_ compat - handle_
status_ openai_ compat - is_
google_ model - is_
valid_ function_ name - json_
escape_ control_ chars_ in_ string - Helper to escape control characters in a string that is supposed to be a JSON document.
This function iterates through the input string
sand replaces any literal control characters (U+0000 to U+001F) with their JSON-escaped equivalents (e.g., ‘\n’ becomes “\n”, ‘\u0001’ becomes “\u0001”). - load_
image_ file - Convert a local image file to base64 encoded ImageContent
- map_
http_ error_ to_ provider_ error - safely_
parse_ json - Safely parse a JSON string that may contain doubly-encoded or malformed JSON. This function first attempts to parse the input string as-is. If that fails, it applies control character escaping and tries again.
- sanitize_
function_ name - stream_
openai_ compat - unescape_
json_ values