JSONStructuredExtraction
yaml
type: "io.kestra.plugin.ai.completion.jsonstructuredextraction"
Examples
yaml
id: json_structured_extraction
namespace: company.ai
tasks:
- id: extract_person
type: io.kestra.plugin.ai.completion.JSONStructuredExtraction
schemaName: Person
jsonFields:
- name
- city
- country
- email
prompt: |
From the text below, extract the person's name, city, and email.
If a field is missing, leave it blank.
Text:
"Hi! I'm John Smith from Paris, France. You can reach me at john.smith@example.com."
provider:
type: io.kestra.plugin.ai.provider.GoogleGemini
apiKey: "{{ kv('GEMINI_API_KEY') }}"
modelName: gemini-2.5-flash
yaml
id: json_structured_extraction_order
namespace: company.ai
tasks:
- id: extract_order
type: io.kestra.plugin.ai.completion.JSONStructuredExtraction
schemaName: Order
jsonFields:
- order_id
- customer_name
- city
- total_amount
prompt: |
Extract the order_id, customer_name, city, and total_amount from the message.
For the total amount, keep only the number without the currency symbol.
Return only JSON with the requested keys.
Message:
"Order #A-1043 for Jane Doe, shipped to Berlin. Total: 249.99 EUR."
provider:
type: io.kestra.plugin.ai.provider.OpenAI
apiKey: "{{ kv('OPENAI_API_KEY') }}"
modelName: gpt-5-mini
Properties
jsonFields *Requiredarray
SubType string
prompt *Requiredstring
provider *RequiredNon-dynamicAmazonBedrockAnthropicAzureOpenAIDeepSeekGoogleGeminiGoogleVertexAIMistralAIOllamaOpenAI
schemaName *Requiredstring
configuration Non-dynamicChatConfiguration
Default
{}
Outputs
extractedJson string
finishReason string
Possible Values
STOP
LENGTH
TOOL_EXECUTION
CONTENT_FILTER
OTHER
schemaName string
tokenUsage TokenUsage
Definitions
Azure OpenAI Model Provider
endpoint *Requiredstring
modelName *Requiredstring
type *Requiredobject
apiKey string
clientId string
clientSecret string
serviceVersion string
tenantId string
Google VertexAI Model Provider
endpoint *Requiredstring
location *Requiredstring
modelName *Requiredstring
project *Requiredstring
type *Requiredobject
Google Gemini Model Provider
apiKey *Requiredstring
modelName *Requiredstring
type *Requiredobject
Mistral AI Model Provider
apiKey *Requiredstring
modelName *Requiredstring
type *Requiredobject
baseUrl string
Ollama Model Provider
endpoint *Requiredstring
modelName *Requiredstring
type *Requiredobject
OpenAI Model Provider
apiKey *Requiredstring
modelName *Requiredstring
type *Requiredobject
baseUrl string
io.kestra.plugin.ai.domain.ChatConfiguration
logRequests booleanstring
logResponses booleanstring
responseFormat ChatConfiguration-ResponseFormat
seed integerstring
temperature numberstring
topK integerstring
topP numberstring
io.kestra.plugin.ai.domain.TokenUsage
inputTokenCount integer
outputTokenCount integer
totalTokenCount integer
Deepseek Model Provider
apiKey *Requiredstring
modelName *Requiredstring
type *Requiredobject
baseUrl string
Default
https://api.deepseek.com/v1
io.kestra.plugin.ai.domain.ChatConfiguration-ResponseFormat
jsonSchema object
jsonSchemaDescription string
type string
Default
TEXT
Possible Values
TEXT
JSON
Amazon Bedrock Model Provider
accessKeyId *Requiredstring
modelName *Requiredstring
secretAccessKey *Requiredstring
type *Requiredobject
modelType string
Default
COHERE
Possible Values
COHERE
TITAN