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
Copy file name to clipboardExpand all lines: pages/generative-apis/how-to/use-structured-outputs.mdx
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ There are several ways to interact with language models:
43
43
- JSON mode is older and has been used by developers since early API implementations but lack reliability in response formats.
44
44
45
45
<Messagetype="note">
46
-
- All LLMs on the Scaleway library support **Structured outputs** and **JSON mode**. However, schemaless **JSON mode** will produce lower quality result and is not recommended.
46
+
- All LLMs on the Scaleway library support **Structured outputs** and **JSON mode**. However, a schemaless **JSON mode** will produce lower quality results and is not recommended.
47
47
</Message>
48
48
49
49
## Code examples
@@ -57,8 +57,7 @@ There are several ways to interact with language models:
57
57
58
58
The following Python examples demonstrate how to use both **Structured outputs** and to generate structured responses.
59
59
60
-
We will send to our LLM a voice note transcript in order to structure it.
61
-
Below is our base code:
60
+
We are using the base code below to send our LLM a voice note transcript to structure:
62
61
63
62
```python
64
63
import json
@@ -193,7 +192,7 @@ Output example:
193
192
194
193
### Using JSON mode (schemaless, Legacy method)
195
194
196
-
<Messagetype="warning">
195
+
<Messagetype="important">
197
196
- When using the OpenAI SDKs like in the examples above, you are expected to set `additionalProperties` to false, and to specify all your properties as required.
198
197
- JSON mode: It is important to explicitly ask the model to generate a JSON output either in system prompt or user prompt. To prevent infinite generations, model providers most often encourage users to ask the model for short JSON objects. Prompt example: `Only answer in JSON using '{' as the first character.`.
199
198
</Message>
@@ -249,4 +248,4 @@ Using structured outputs with LLMs can significantly improve their reliability,
249
248
-**Structured outputs** provide strict adherence to a predefined schema, ensuring consistency.
250
249
-**JSON mode** (Legacy Method) is flexible but less predictable.
251
250
252
-
We recommend using Structured outputs (`json_schema`) for most use cases.
251
+
We recommend using structured outputs (`json_schema`) for most use cases.
0 commit comments