|
8 | 8 | "source": [ |
9 | 9 | "# Tutorial: Generating Structured Output with OpenAIChatGenerator\n", |
10 | 10 | "\n", |
11 | | - "- **Level**: Intermediate\n", |
| 11 | + "- **Level**: Beginner\n", |
12 | 12 | "- **Time to complete**: 15 minutes\n", |
13 | 13 | "- **Prerequisites**: You must have an API key from an active OpenAI account as this tutorial is using the gpt-4o-mini model by OpenAI.\n", |
14 | 14 | "- **Components Used**: `ChatPromptBuilder`, `OpenAIChatGenerator`, `OpenAIResponsesChatGenerator`\n", |
|
20 | 20 | "Note: Only latest model starting with `gpt-4o-mini` can be used for this feature.\n" |
21 | 21 | ] |
22 | 22 | }, |
23 | | - { |
24 | | - "cell_type": "markdown", |
25 | | - "metadata": { |
26 | | - "id": "jmiAHh1oGsKI" |
27 | | - }, |
28 | | - "source": [ |
29 | | - "## Preparing the Colab Environment\n", |
30 | | - "\n", |
31 | | - "Enable the debug mode of logging:" |
32 | | - ] |
33 | | - }, |
34 | | - { |
35 | | - "cell_type": "code", |
36 | | - "execution_count": 8, |
37 | | - "metadata": { |
38 | | - "id": "Vor9IHuNRvEh" |
39 | | - }, |
40 | | - "outputs": [], |
41 | | - "source": [ |
42 | | - "import logging\n", |
43 | | - "\n", |
44 | | - "logging.basicConfig()\n", |
45 | | - "logging.getLogger(\"canals.pipeline.pipeline\").setLevel(logging.DEBUG)" |
46 | | - ] |
47 | | - }, |
48 | 23 | { |
49 | 24 | "cell_type": "markdown", |
50 | 25 | "metadata": { |
|
125 | 100 | "id": "Cmjfa8CiCeFl" |
126 | 101 | }, |
127 | 102 | "source": [ |
128 | | - "## Structured outputs in OpenAIChatGenerator\n", |
| 103 | + "## Structured Outputs with `OpenAIChatGenerator`\n", |
129 | 104 | "\n", |
130 | 105 | "### Using Pydantic Models\n", |
131 | 106 | "First, we'll see how to pass Pydantic model to `OpenAIChatGenerator`. For this purpose, we define two [Pydantic models](https://docs.pydantic.dev/1.10/usage/models/), `City` and `CitiesData`. These models specify the fields and types that represent the data structure we want." |
|
441 | 416 | "cell_type": "markdown", |
442 | 417 | "metadata": {}, |
443 | 418 | "source": [ |
444 | | - "## Structured outputs in OpenAIResponsesChatGenerator\n", |
| 419 | + "## Structured Outputs with `OpenAIResponsesChatGenerator`\n", |
445 | 420 | "\n", |
446 | 421 | "### Using Pydantic Models\n", |
447 | 422 | "We'll use the models City and CitiesData defined above. \n", |
|
0 commit comments