ChatCompletion ​Chat​Completion

yaml
type: "io.kestra.plugin.ai.rag.chatcompletion"
yaml
id: rag
namespace: company.ai

tasks:
  - id: ingest
    type: io.kestra.plugin.ai.rag.IngestDocument
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-embedding-exp-03-07
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
    embeddings:
      type: io.kestra.plugin.ai.embeddings.KestraKVStore
    drop: true
    fromExternalURLs:
      - https://raw.githubusercontent.com/kestra-io/docs/refs/heads/main/content/blogs/release-0-24.md

  - id: parallel
    type: io.kestra.plugin.core.flow.Parallel
    tasks:
      - id: chat_without_rag
        type: io.kestra.plugin.ai.completion.ChatCompletion
        provider:
          type: io.kestra.plugin.ai.provider.GoogleGemini
        messages:
          - type: USER
            content: Which features were released in Kestra 0.24?

      - id: chat_with_rag
        type: io.kestra.plugin.ai.rag.ChatCompletion
        chatProvider:
          type: io.kestra.plugin.ai.provider.GoogleGemini
        embeddingProvider:
          type: io.kestra.plugin.ai.provider.GoogleGemini
          modelName: gemini-embedding-exp-03-07
        embeddings:
          type: io.kestra.plugin.ai.embeddings.KestraKVStore
        systemMessage: You are a helpful assistant that can answer questions about Kestra.
        prompt: Which features were released in Kestra 0.24?

pluginDefaults:
  - type: io.kestra.plugin.ai.provider.GoogleGemini
    values:
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
      modelName: gemini-2.5-flash

yaml
id: rag_with_websearch_content_retriever
namespace: company.ai

tasks:
  - id: chat_with_rag_and_websearch_content_retriever
    type: io.kestra.plugin.ai.rag.ChatCompletion
    chatProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-2.5-flash
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
    contentRetrievers:
      - type: io.kestra.plugin.ai.retriever.TavilyWebSearch
        apiKey: "{{ kv('TAVILY_API_KEY') }}"
    systemMessage: You are a helpful assistant that can answer questions about Kestra.
    prompt: What is the latest release of Kestra?

yaml
id: chat_with_memory
namespace: company.ai

inputs:
  - id: first
    type: STRING
    defaults: Hello, my name is John and I'm from Paris

  - id: second
    type: STRING
    defaults: What's my name and where do I live?

tasks:
  - id: first
    type: io.kestra.plugin.ai.rag.ChatCompletion
    chatProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
    embeddingProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-embedding-exp-03-07
    embeddings:
      type: io.kestra.plugin.ai.embeddings.KestraKVStore
    memory:
      type: io.kestra.plugin.ai.memory.KestraKVStore
      ttl: PT1M
    systemMessage: You are a helpful assistant, answer concisely
    prompt: "{{inputs.first}}"

  - id: second
    type: io.kestra.plugin.ai.rag.ChatCompletion
    chatProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
    embeddingProvider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-embedding-exp-03-07
    embeddings:
      type: io.kestra.plugin.ai.embeddings.KestraKVStore
    memory:
      type: io.kestra.plugin.ai.memory.KestraKVStore
    systemMessage: You are a helpful assistant, answer concisely
    prompt: "{{inputs.second}}"

pluginDefaults:
  - type: io.kestra.plugin.ai.provider.GoogleGemini
    values:
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
      modelName: gemini-2.5-flash

yaml
id: chat_with_structured_output
namespace: company.ai

tasks:
  - id: categorize_releases
    type: io.kestra.plugin.ai.rag.ChatCompletion
    chatProvider:
      type: io.kestra.plugin.ai.provider.MistralAI
      apiKey: "{{ kv('MISTRAL_API_KEY') }}"
      modelName: open-mistral-7b

    contentRetrievers:
      - type: io.kestra.plugin.ai.retriever.TavilyWebSearch
        apiKey: "{{ kv('TAVILY_API_KEY') }}"
        maxResults: 8

    chatConfiguration:
      responseFormat:
        type: JSON
        jsonSchema:
          type: object
          required: ["releases"]
          properties:
            releases:
              type: array
              minItems: 1
              items:
                type: object
                additionalProperties: false
                required: ["version", "date", "semver"]
                properties:
                  version:
                    type: string
                    description: "Release tag, e.g., 0.24.0"
                  date:
                    type: string
                    description: "Release date"
                  semver:
                    type: string
                    enum: ["MINOR", "PATCH"]
                  summary:
                    type: string
                    description: "Short plain-text summary (optional)"

    systemMessage: |
      You are a release analyst. Use the Tavily web retriever to find recent Kestra releases.
      Determine each release's SemVer category:
        - MINOR: new features, no major breaking changes (y in x.Y.z)
        - PATCH: bug fixes/patches only (z in x.y.Z)
      Return ONLY valid JSON matching the schema. No prose, no extra keys.

    prompt: |
      Find most recent Kestra releases (within the last ~6 months).
      Output their version, release date, semver category, and a one-line summary.
Properties
Possible Values
STOPLENGTHTOOL_EXECUTIONCONTENT_FILTEROTHER
SubType string
Default false
SubType string
SubType string
SubType string
Default false
Default embedding-index
Default false
Format date-time
SubType string
Default false
Default false
Format duration
SubType
Default https://api.deepseek.com/v1
Possible Values
STOPLENGTHTOOL_EXECUTIONCONTENT_FILTEROTHER
Default TEXT
Possible Values
TEXTJSON
SubType string
SubType string
SubType string
Default false
Default 3
Default 3
Default 0
Default {{flow.id}}-embedding-store
SubType string
Default false
Default false
Format duration
Default 3
Default NEVER
Possible Values
NEVERBEFORE_TASKRUNAFTER_TASKRUN
Default {{ labels.system.correlationId }}
Default 10
Default 6379
Default PT1H
Format duration
Default NEVER
Possible Values
NEVERBEFORE_TASKRUNAFTER_TASKRUN
Default {{ labels.system.correlationId }}
Default 10
Default PT1H
Format duration
Possible Values
ONEQUORUMALL
SubType string
SubType string
Min items 1
SubType string
Default COHERE
Possible Values
COHERETITAN