Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
400 changes: 397 additions & 3 deletions pkg/component/ai/gemini/v0/README.mdx

Large diffs are not rendered by default.

672 changes: 672 additions & 0 deletions pkg/component/ai/gemini/v0/common.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/component/ai/gemini/v0/config/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
availableTasks:
- TASK_CHAT
- TASK_CACHE
custom: false
icon: assets/gemini.svg
iconUrl: ""
Expand Down
285 changes: 285 additions & 0 deletions pkg/component/ai/gemini/v0/config/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,37 @@ $defs:
description: List of modalities that were processed for tool-use request inputs.
items:
$ref: "#/$defs/modality-token-count"
cached-usage-metadata:
uiOrder: 0
title: Cached Content Usage Metadata
description: Metadata on the usage of the cached content.
type: object
properties:
audio-duration-seconds:
uiOrder: 0
type: integer
title: Audio Duration Seconds
description: Duration of audio in seconds.
image-count:
uiOrder: 1
type: integer
title: Image Count
description: Number of images.
text-count:
uiOrder: 2
type: integer
title: Text Count
description: Number of text characters.
total-token-count:
uiOrder: 3
type: integer
title: Total Token Count
description: Total number of tokens that the cached content consumes.
video-duration-seconds:
uiOrder: 4
type: integer
title: Video Duration Seconds
description: Duration of video in seconds.
prompt-feedback:
uiOrder: 0
title: Prompt Feedback
Expand Down Expand Up @@ -1460,6 +1491,50 @@ $defs:
title: Code Execution
description: Tool that executes code generated by the model, and automatically returns the result to the model.
type: object
cached-content:
uiOrder: 0
title: Cached Content
description: A cached content object containing metadata and cached input data.
type: object
properties:
name:
uiOrder: 0
title: Name
description: "The resource name referring to the cached content. Format: cachedContents/{cachedContent}"
type: string
display-name:
uiOrder: 1
title: Display Name
description: Optional. The user-provided name of the cached content.
type: string
model:
uiOrder: 2
title: Model
description: The name of the Model to use for cached content.
type: string
create-time:
uiOrder: 3
title: Create Time
description: Creation time of the cached content in RFC3339 format.
type: string
format: date-time
update-time:
uiOrder: 4
title: Update Time
description: Last update time of the cached content in RFC3339 format.
type: string
format: date-time
expire-time:
uiOrder: 5
title: Expire Time
description: Expiration time of the cached content in RFC3339 format.
type: string
format: date-time
usage-metadata:
uiOrder: 6
title: Usage Metadata
description: Token usage statistics for the cached content.
$ref: "#/$defs/cached-usage-metadata"
TASK_CHAT:
shortDescription: Provide text outputs in response to text and image inputs.
description: >-
Expand Down Expand Up @@ -1672,3 +1747,213 @@ TASK_CHAT:
title: Response ID
description: Identifier for this response.
type: string
TASK_CACHE:
shortDescription: Manage context caching for efficient and cost-effective API usage.
description: >-
Context caching allows you to cache input tokens and reference them in subsequent requests, reducing costs and improving performance for repetitive
large contexts. This task supports creating, listing, getting, updating, and deleting cached content with proper time-to-live (TTL) management.
The minimum input token count for context caching is 1,024 for 2.5 Flash and 4,096 for 2.5 Pro models.
input:
uiOrder: 0
title: Input
description: Input schema of the cache task.
type: object
required: [operation, model]
properties:
operation:
uiOrder: 0
title: Operation
description: >-
The cache operation to perform.
The value is one of the following:
`create`: Create a new cached content.
`list`: List all cached contents.
`get`: Retrieve a specific cached content.
`update`: Update an existing cached content (only expiration time can be updated).
`delete`: Delete a cached content.
type: string
enum:
- create
- list
- get
- update
- delete
default: create
model:
uiOrder: 1
title: Model
shortDescription: ID of the model to use for caching.
description: >-
ID of the model to use for caching. Required for create operations. The model is immutable after creation.
The value is one of the following:
`gemini-2.5-pro`: Optimized for enhanced thinking and reasoning, multimodal understanding, advanced coding, and more.
`gemini-2.5-flash`: Optimized for Adaptive thinking, cost efficiency.
`gemini-2.0-flash-lite`: Optimized for Most cost-efficient model supporting high throughput.
type: string
enum:
- gemini-2.5-pro
- gemini-2.5-flash
- gemini-2.0-flash-lite
default: gemini-2.5-flash
instillCredentialMap:
values:
- gemini-2.5-pro
- gemini-2.5-flash
- gemini-2.0-flash-lite
targets:
- setup.api-key
cache-name:
uiOrder: 2
title: Cache Name
description: >-
[**GET**, **UPDATE**, **DELETE**] The name of the cached content for get, update, or delete operations. Format: cachedContents/{cachedContent}.
Required for get, update, and delete operations.
type: string
prompt:
uiOrder: 3
title: Prompt
description: >-
[**CREATE**] The main text instruction or query to be cached for create operations.
type: string
images:
uiOrder: 4
title: Images
description: >-
[**CREATE**] URI references or base64 content of input images to be cached for create operations.
type: array
items:
type: string
audio:
uiOrder: 5
title: Audio
description: >-
[**CREATE**] URI references or base64 content of input audio to be cached for create operations.
type: array
items:
type: string
videos:
uiOrder: 6
title: Videos
description: >-
[**CREATE**] URI references or base64 content of input videos to be cached for create operations.
type: array
items:
type: string
documents:
uiOrder: 7
title: Documents
description: >-
[**CREATE**] URI references or base64 content of input documents to be cached for create operations.
Different vendors might have different constraints on the document format. For example, Gemini supports only PDF.
type: array
items:
type: string
system-message:
uiOrder: 8
title: System Message
description: >-
[**CREATE**] A system message to guide model behavior for create operations. Takes precedence over system-instruction.
type: string
display-name:
uiOrder: 9
title: Display Name
description: >-
[**CREATE**] Optional. The user-provided name of the cached content for create operations.
type: string
system-instruction:
uiOrder: 10
title: System Instruction
description: >-
[**CREATE**] Optional. A system instruction to guide the model behavior for create operations.
$ref: "#/$defs/content"
contents:
uiOrder: 11
title: Contents
description: >-
The input contents to cache for create operations. Each item represents a user or model turn composed of parts (text or images).
This is the main content that will be cached for reuse in subsequent requests.
type: array
items:
$ref: "#/$defs/content"
tools:
uiOrder: 12
title: Tools
description: >-
[**CREATE**] Optional. Tools available to the model for create operations, e.g., function declarations.
type: array
items:
$ref: "#/$defs/tool"
tool-config:
uiOrder: 13
$ref: "#/$defs/tool-config"
ttl:
uiOrder: 14
title: TTL
description: >-
[**CREATE**, **UPDATE**] Time to live duration for the cached content in Google Duration format.
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
Must be at least 60 seconds. Maximum is 7 days (604800 seconds).
type: string
pattern: "^[0-9]+(\\.([0-9]{1,9}))?s$"
expire-time:
uiOrder: 15
title: Expire Time
description: >-
[**CREATE**, **UPDATE**] Absolute expiration time for the cached content in RFC3339 format.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits.
Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".
type: string
format: date-time
pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?(Z|[+-][0-9]{2}:[0-9]{2})$"
page-size:
uiOrder: 16
title: Page Size
description: >-
[**LIST**] Optional. The maximum number of cached contents to return for list operations. Default is 50.
type: integer
minimum: 1
maximum: 1000
default: 50
page-token:
uiOrder: 17
title: Page Token
description: >-
[**LIST**] Optional. A page token from a previous list operation for pagination.
type: string
output:
uiOrder: 0
title: Output
description: Output schema of the cache task.
type: object
properties:
operation:
uiOrder: 0
title: Operation
description: The cache operation that was performed.
type: string
enum:
- create
- list
- get
- update
- delete
cached-content:
uiOrder: 1
title: Cached Content
description: >-
[**CREATE**, **GET**, **UPDATE**] The cached content object for create, get, and update operations. Not returned for delete operations.
$ref: "#/$defs/cached-content"
cached-contents:
uiOrder: 2
title: Cached Contents
description: >-
[**LIST**] List of cached contents for list operations.
type: array
items:
$ref: "#/$defs/cached-content"
next-page-token:
uiOrder: 3
title: Next Page Token
description: >-
[**LIST**] Token for retrieving the next page of results for list operations.
type: string
Loading
Loading