|
21 | 21 | "✅Successfully installed guardrails/one_line!\n", |
22 | 22 | "\n", |
23 | 23 | "\n", |
24 | | - "Requirement already satisfied: pypdfium2 in /Users/dtam/.pyenv/versions/3.12.1/lib/python3.12/site-packages (4.30.0)\n", |
25 | | - "\n", |
26 | | - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.2\u001b[0m\n", |
27 | | - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", |
| 24 | + "Requirement already satisfied: pypdfium2 in /Users/dtam/.pyenv/versions/3.12.3/envs/litellm/lib/python3.12/site-packages (4.30.0)\n", |
28 | 25 | "Note: you may need to restart the kernel to use updated packages.\n" |
29 | 26 | ] |
30 | 27 | } |
|
62 | 59 | }, |
63 | 60 | { |
64 | 61 | "cell_type": "code", |
65 | | - "execution_count": 1, |
| 62 | + "execution_count": null, |
66 | 63 | "metadata": {}, |
67 | | - "outputs": [ |
68 | | - { |
69 | | - "name": "stderr", |
70 | | - "output_type": "stream", |
71 | | - "text": [ |
72 | | - "/Users/dtam/.pyenv/versions/3.12.3/envs/litellm/lib/python3.12/site-packages/pypdfium2/_helpers/textpage.py:80: UserWarning: get_text_range() call with default params will be implicitly redirected to get_text_bounded()\n", |
73 | | - " warnings.warn(\"get_text_range() call with default params will be implicitly redirected to get_text_bounded()\")\n" |
74 | | - ] |
75 | | - }, |
76 | | - { |
77 | | - "data": { |
78 | | - "text/html": [ |
79 | | - "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Chase Credit Card Document:\n", |
80 | | - "\n", |
81 | | - "<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">25</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #00ff00; text-decoration-color: #00ff00; font-weight: bold\">7:59</span> PM about:blank\n", |
82 | | - "about:blank <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>\n", |
83 | | - "PRICING INFORMATION\n", |
84 | | - "INTEREST RATES AND INTEREST CHARGES\n", |
85 | | - "Purchase Annual\n", |
86 | | - "Percentage Rate <span style=\"font-weight: bold\">(</span>APR<span style=\"font-weight: bold\">)</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>% Intro APR for the first <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">18</span> months that your Account is open.\n", |
87 | | - "After that, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">19.49</span>%. This APR will vary with the market based on the Prim\n", |
88 | | - "<span style=\"color: #808000; text-decoration-color: #808000\">...</span>\n", |
89 | | - "</pre>\n" |
90 | | - ], |
91 | | - "text/plain": [ |
92 | | - "Chase Credit Card Document:\n", |
93 | | - "\n", |
94 | | - "\u001b[1;36m2\u001b[0m/\u001b[1;36m25\u001b[0m/\u001b[1;36m23\u001b[0m, \u001b[1;92m7:59\u001b[0m PM about:blank\n", |
95 | | - "about:blank \u001b[1;36m1\u001b[0m/\u001b[1;36m4\u001b[0m\n", |
96 | | - "PRICING INFORMATION\n", |
97 | | - "INTEREST RATES AND INTEREST CHARGES\n", |
98 | | - "Purchase Annual\n", |
99 | | - "Percentage Rate \u001b[1m(\u001b[0mAPR\u001b[1m)\u001b[0m \u001b[1;36m0\u001b[0m% Intro APR for the first \u001b[1;36m18\u001b[0m months that your Account is open.\n", |
100 | | - "After that, \u001b[1;36m19.49\u001b[0m%. This APR will vary with the market based on the Prim\n", |
101 | | - "\u001b[33m...\u001b[0m\n" |
102 | | - ] |
103 | | - }, |
104 | | - "metadata": {}, |
105 | | - "output_type": "display_data" |
106 | | - } |
107 | | - ], |
| 64 | + "outputs": [], |
108 | 65 | "source": [ |
109 | 66 | "import guardrails as gd\n", |
110 | 67 | "from rich import print\n", |
|
149 | 106 | " ```\n", |
150 | 107 | "\n", |
151 | 108 | "=== \"Pydantic with messages\"\n", |
| 109 | + "\n", |
152 | 110 | " ```py\n", |
153 | 111 | " instructions = \"\"\"You are a helpful assistant only capable of communicating with valid JSON, and no other text.\n", |
154 | 112 | "\n", |
|
163 | 121 | " ${gr.xml_prefix_prompt}\n", |
164 | 122 | "\n", |
165 | 123 | " ${output_schema}\"\"\"\n", |
166 | | - " ```\n", |
| 124 | + " \n", |
167 | 125 | " messages=[\n", |
168 | 126 | " {\n", |
169 | 127 | " \"role\":\"system\",\n", |
|
174 | 132 | " \"content\":prompt\n", |
175 | 133 | " }\n", |
176 | 134 | " ]\n", |
| 135 | + " ```\n", |
177 | 136 | "\n", |
178 | 137 | "=== \"RAIL Spec without user message\"\n", |
179 | 138 | " \n", |
|
194 | 153 | " ```\n", |
195 | 154 | "\n", |
196 | 155 | "=== \"Pydantic without instructions\"\n", |
| 156 | + "\n", |
197 | 157 | " ```py\n", |
198 | 158 | " prompt = \"\"\"Given the following document, answer the following questions. If the answer doesn't exist in the document, enter `null`.\n", |
199 | 159 | "\n", |
|
325 | 285 | }, |
326 | 286 | { |
327 | 287 | "cell_type": "code", |
328 | | - "execution_count": 3, |
| 288 | + "execution_count": null, |
329 | 289 | "metadata": {}, |
330 | 290 | "outputs": [], |
331 | 291 | "source": [ |
|
0 commit comments