|
132 | 132 | },
|
133 | 133 | {
|
134 | 134 | "cell_type": "code",
|
135 |
| - "execution_count": 14, |
| 135 | + "execution_count": 4, |
136 | 136 | "metadata": {},
|
137 | 137 | "outputs": [],
|
138 | 138 | "source": [
|
|
148 | 148 | },
|
149 | 149 | {
|
150 | 150 | "cell_type": "code",
|
151 |
| - "execution_count": 4, |
| 151 | + "execution_count": 5, |
152 | 152 | "metadata": {},
|
153 | 153 | "outputs": [],
|
154 | 154 | "source": [
|
|
165 | 165 | },
|
166 | 166 | {
|
167 | 167 | "cell_type": "code",
|
168 |
| - "execution_count": 5, |
| 168 | + "execution_count": 6, |
169 | 169 | "metadata": {},
|
170 | 170 | "outputs": [
|
171 | 171 | {
|
|
182 | 182 | "Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
|
183 | 183 | "\n",
|
184 | 184 | "<span style=\"font-weight: bold\"><</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">output</span><span style=\"color: #000000; text-decoration-color: #000000\">></span>\n",
|
185 |
| - "<span style=\"color: #000000; text-decoration-color: #000000\"> <pythoncode </span><span style=\"color: #808000; text-decoration-color: #808000\">name</span><span style=\"color: #000000; text-decoration-color: #000000\">=</span><span style=\"color: #008000; text-decoration-color: #008000\">\"python_code\"</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #808000; text-decoration-color: #808000\">format</span><span style=\"color: #000000; text-decoration-color: #000000\">=</span><span style=\"color: #008000; text-decoration-color: #008000\">\"bug-free-python\"</span><span style=\"color: #800080; text-decoration-color: #800080\">/</span><span style=\"color: #000000; text-decoration-color: #000000\">></span>\n", |
| 185 | + "<span style=\"color: #000000; text-decoration-color: #000000\"> <string </span><span style=\"color: #808000; text-decoration-color: #808000\">name</span><span style=\"color: #000000; text-decoration-color: #000000\">=</span><span style=\"color: #008000; text-decoration-color: #008000\">\"python_code\"</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #808000; text-decoration-color: #808000\">format</span><span style=\"color: #000000; text-decoration-color: #000000\">=</span><span style=\"color: #008000; text-decoration-color: #008000\">\"bug-free-python\"</span><span style=\"color: #800080; text-decoration-color: #800080\">/</span><span style=\"color: #000000; text-decoration-color: #000000\">></span>\n", |
186 | 186 | "<span style=\"color: #000000; text-decoration-color: #000000\"><</span><span style=\"color: #800080; text-decoration-color: #800080\">/</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff\">output</span><span style=\"color: #000000; text-decoration-color: #000000\">></span>\n",
|
187 | 187 | "\n",
|
188 | 188 | "\n",
|
|
211 | 211 | "Given below is XML that describes the information to extract from this document and the tags to extract it into.\n",
|
212 | 212 | "\n",
|
213 | 213 | "\u001b[1m<\u001b[0m\u001b[1;95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
|
214 |
| - "\u001b[39m <pythoncode \u001b[0m\u001b[33mname\u001b[0m\u001b[39m=\u001b[0m\u001b[32m\"python_code\"\u001b[0m\u001b[39m \u001b[0m\u001b[33mformat\u001b[0m\u001b[39m=\u001b[0m\u001b[32m\"bug\u001b[0m\u001b[32m-free-python\"\u001b[0m\u001b[35m/\u001b[0m\u001b[39m>\u001b[0m\n", |
| 214 | + "\u001b[39m <string \u001b[0m\u001b[33mname\u001b[0m\u001b[39m=\u001b[0m\u001b[32m\"python_code\"\u001b[0m\u001b[39m \u001b[0m\u001b[33mformat\u001b[0m\u001b[39m=\u001b[0m\u001b[32m\"bug\u001b[0m\u001b[32m-free-python\"\u001b[0m\u001b[35m/\u001b[0m\u001b[39m>\u001b[0m\n", |
215 | 215 | "\u001b[39m<\u001b[0m\u001b[35m/\u001b[0m\u001b[95moutput\u001b[0m\u001b[39m>\u001b[0m\n",
|
216 | 216 | "\n",
|
217 | 217 | "\n",
|
|
246 | 246 | },
|
247 | 247 | {
|
248 | 248 | "cell_type": "code",
|
249 |
| - "execution_count": 6, |
| 249 | + "execution_count": 7, |
250 | 250 | "metadata": {},
|
251 |
| - "outputs": [ |
252 |
| - { |
253 |
| - "name": "stderr", |
254 |
| - "output_type": "stream", |
255 |
| - "text": [ |
256 |
| - "Async event loop found, but guard was invoked synchronously.For validator parallelization, please call `validate_async` instead.\n" |
257 |
| - ] |
258 |
| - } |
259 |
| - ], |
| 251 | + "outputs": [], |
260 | 252 | "source": [
|
261 | 253 | "import openai\n",
|
262 | 254 | "\n",
|
263 | 255 | "leetcode_problem = \"\"\"\n",
|
264 | 256 | "Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.\n",
|
265 | 257 | "\"\"\"\n",
|
266 | 258 | "\n",
|
267 |
| - "raw_llm_response, validated_response = guard(\n", |
| 259 | + "raw_llm_response, validated_response, *rest = guard(\n", |
268 | 260 | " openai.Completion.create,\n",
|
269 | 261 | " prompt_params={\"leetcode_problem\": leetcode_problem},\n",
|
270 | 262 | " engine=\"text-davinci-003\",\n",
|
|
285 | 277 | },
|
286 | 278 | {
|
287 | 279 | "cell_type": "code",
|
288 |
| - "execution_count": 7, |
| 280 | + "execution_count": 8, |
289 | 281 | "metadata": {},
|
290 | 282 | "outputs": [
|
291 | 283 | {
|
|
326 | 318 | },
|
327 | 319 | {
|
328 | 320 | "cell_type": "code",
|
329 |
| - "execution_count": 8, |
| 321 | + "execution_count": 9, |
330 | 322 | "metadata": {},
|
331 | 323 | "outputs": [
|
332 | 324 | {
|
|
371 | 363 | },
|
372 | 364 | {
|
373 | 365 | "cell_type": "code",
|
374 |
| - "execution_count": 9, |
| 366 | + "execution_count": 10, |
375 | 367 | "metadata": {},
|
376 | 368 | "outputs": [
|
377 | 369 | {
|
|
413 | 405 | "name": "python",
|
414 | 406 | "nbconvert_exporter": "python",
|
415 | 407 | "pygments_lexer": "ipython3",
|
416 |
| - "version": "3.11.4" |
| 408 | + "version": "3.11.5" |
417 | 409 | },
|
418 | 410 | "orig_nbformat": 4,
|
419 | 411 | "vscode": {
|
|
0 commit comments