Bundle Google Gemini API client. Supports text generation, multimodal inputs (image, audio, video), chat sessions, function calling, and caching. Set GOOGLE_API_KEY before use. Compile with -lib gemini.
CachedContent
Gemini Context Caching API - cache large content to reduce repeated token costs
Inherits: EndPoint
Operations
Create # function
Create a cached content resource with default TTL
function : Create(model:String, content:Content, ttl_secs:Int, key:String) ~ CachedContentItemParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (e.g. "models/gemini-1.5-pro-001") |
| content | Content | content to cache |
| ttl_secs | Int | time-to-live in seconds |
| key | String | API key |
Return
| Type | Description |
|---|---|
| CachedContentItem | cached content item, or Nil on failure |
Create # function
Create a cached content resource
function : Create(model:String, content:Content, ttl_secs:Int, display_name:String, key:String) ~ CachedContentItemParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (e.g. "models/gemini-1.5-pro-001") |
| content | Content | content to cache |
| ttl_secs | Int | time-to-live in seconds |
| display_name | String | optional human-readable name |
| key | String | API key |
Return
| Type | Description |
|---|---|
| CachedContentItem | cached content item, or Nil on failure |
Delete # function
Delete a cached content resource
function : Delete(cache_name:String, key:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| cache_name | String | resource name (e.g. "cachedContents/abc123") |
| key | String | API key |
Return
| Type | Description |
|---|---|
| Bool | true if deleted successfully |
Get # function
Get a cached content resource by name
function : Get(cache_name:String, key:String) ~ CachedContentItemParameters
| Name | Type | Description |
|---|---|---|
| cache_name | String | resource name (e.g. "cachedContents/abc123") |
| key | String | API key |
Return
| Type | Description |
|---|---|
| CachedContentItem | cached content item, or Nil on failure |
List # function
List all cached content resources
function : List(key:String) ~ Vector<CachedContentItem>Parameters
| Name | Type | Description |
|---|---|---|
| key | String | API key |
Return
| Type | Description |
|---|---|
| Vector<CachedContentItem> | list of cached content items |