You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some LLMs provide functionality often referred to as "Structured Output".
31
+
This means instructing the LLM to output data in a particular format, usually JSON.
32
+
This can be useful for forcing the LLM to output in a parsable format that can be used by downstream systems.
33
+
34
+
!!! warning
35
+
Each Driver may have a different default setting depending on the LLM provider's capabilities.
36
+
37
+
### Prompt Task
38
+
39
+
The easiest way to get started with structured output is by using a [PromptTask](../structures/tasks.md#prompt)'s [output_schema](../../reference/griptape/tasks/prompt_task.md#griptape.tasks.PromptTask.output_schema) parameter.
40
+
41
+
You can change _how_ the output is structured by setting the Driver's [structured_output_strategy](../../reference/griptape/drivers/prompt/base_prompt_driver.md#griptape.drivers.prompt.base_prompt_driver.BasePromptDriver.structured_output_strategy) to one of:
42
+
43
+
-`native`: The Driver will use the LLM's structured output functionality provided by the API.
44
+
-`tool`: The Driver will add a special tool, [StructuredOutputTool](../../reference/griptape/tools/structured_output/tool.md), and will try to force the LLM to use the Tool.
45
+
-`rule`: The Driver will add a [JsonSchemaRule](../structures/rulesets.md#json-schema-rule) to the Task's system prompt. This strategy does not guarantee that the LLM will output JSON and should only be used as a last resort.
input="You will be provided with a description of a mood, and your task is to generate the CSS color code for a color that matches it. Description: {{ args[0] }}",
0 commit comments