|
136 | 136 | "Make sure that the numbers make sense (i.e. more rooms is usually bigger size, more expensive locations increase price. more size is usually higher price etc. make sure all the numbers make sense). Also only respond with the CSV.\n", |
137 | 137 | "\"\"\"\n", |
138 | 138 | "\n", |
139 | | - "response = client.chat.completions.create(\n", |
| 139 | + "response = client.responses.create(\n", |
140 | 140 | " model=datagen_model,\n", |
141 | | - " messages=[\n", |
| 141 | + " input=[\n", |
142 | 142 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
143 | 143 | " {\"role\": \"user\", \"content\": question}\n", |
144 | 144 | " ]\n", |
145 | 145 | ")\n", |
146 | | - "res = response.choices[0].message.content\n", |
| 146 | + "res = response.output_text\n", |
147 | 147 | "print(res)" |
148 | 148 | ] |
149 | 149 | }, |
|
248 | 248 | "Make sure that the numbers make sense (i.e. more rooms is usually bigger size, more expensive locations increase price. more size is usually higher price etc. make sure all the numbers make sense).\n", |
249 | 249 | "\"\"\"\n", |
250 | 250 | "\n", |
251 | | - "response = client.chat.completions.create(\n", |
| 251 | + "response = client.responses.create(\n", |
252 | 252 | " model=datagen_model,\n", |
253 | | - " messages=[\n", |
| 253 | + " input=[\n", |
254 | 254 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
255 | 255 | " {\"role\": \"user\", \"content\": question}\n", |
256 | 256 | " ]\n", |
257 | 257 | ")\n", |
258 | | - "res = response.choices[0].message.content\n", |
| 258 | + "res = response.output_text\n", |
259 | 259 | "print(res)" |
260 | 260 | ] |
261 | 261 | }, |
|
419 | 419 | "You can use the previously generated dataframe to generate the next dataframe.\n", |
420 | 420 | "\"\"\"\n", |
421 | 421 | "\n", |
422 | | - "response = client.chat.completions.create(\n", |
| 422 | + "response = client.responses.create(\n", |
423 | 423 | " model=datagen_model,\n", |
424 | | - " messages=[\n", |
| 424 | + " input=[\n", |
425 | 425 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
426 | 426 | " {\"role\": \"user\", \"content\": question}\n", |
427 | 427 | " ]\n", |
428 | 428 | ")\n", |
429 | | - "res = response.choices[0].message.content\n", |
| 429 | + "res = response.output_text\n", |
430 | 430 | "print(res)" |
431 | 431 | ] |
432 | 432 | }, |
|
499 | 499 | " Create as many training pairs as possible.\n", |
500 | 500 | " \"\"\"\n", |
501 | 501 | "\n", |
502 | | - " response = client.chat.completions.create(\n", |
| 502 | + " response = client.responses.create(\n", |
503 | 503 | " model=datagen_model,\n", |
504 | | - " messages=[\n", |
| 504 | + " input=[\n", |
505 | 505 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
506 | 506 | " {\"role\": \"user\", \"content\": question}\n", |
507 | 507 | " ]\n", |
508 | 508 | " )\n", |
509 | | - " res = response.choices[0].message.content\n", |
| 509 | + " res = response.output_text\n", |
510 | 510 | " output_string += res + \"\\n\" + \"\\n\"\n", |
511 | 511 | "print(output_string[:1000]) #displaying truncated response\n" |
512 | 512 | ] |
|
682 | 682 | " Output: \"Experience unparalleled comfort. These shoes feature a blend of modern style and the traditional superior cushioning, perfect for those always on the move.\"\n", |
683 | 683 | " \"\"\"\n", |
684 | 684 | "\n", |
685 | | - " response = client.chat.completions.create(\n", |
| 685 | + " response = client.responses.create(\n", |
686 | 686 | " model=\"gpt-4o-mini\",\n", |
687 | | - " messages=[\n", |
| 687 | + " input=[\n", |
688 | 688 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
689 | 689 | " {\"role\": \"user\", \"content\": question}\n", |
690 | 690 | " ]\n", |
691 | 691 | " )\n", |
692 | | - " res = response.choices[0].message.content\n", |
| 692 | + " res = response.output_text\n", |
693 | 693 | " output_string += res + \"\\n\" + \"\\n\"\n", |
694 | 694 | "print(output_string[:1000]) #displaying truncated response" |
695 | 695 | ] |
|
1777 | 1777 | " Do not add any extra characters around that formatting as it will make the output parsing break.\n", |
1778 | 1778 | " \"\"\"\n", |
1779 | 1779 | "\n", |
1780 | | - "response = client.chat.completions.create(\n", |
| 1780 | + "response = client.responses.create(\n", |
1781 | 1781 | " model=datagen_model,\n", |
1782 | | - " messages=[\n", |
| 1782 | + " input=[\n", |
1783 | 1783 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed analyze clustered data\"},\n", |
1784 | 1784 | " {\"role\": \"user\", \"content\": topic_prompt}\n", |
1785 | 1785 | " ]\n", |
1786 | 1786 | ")\n", |
1787 | | - "res = response.choices[0].message.content\n", |
| 1787 | + "res = response.output_text\n", |
1788 | 1788 | "\n", |
1789 | 1789 | "pattern = r\"Cluster: (\\d+), topic: ([^\\n]+)\"\n", |
1790 | 1790 | "matches = re.findall(pattern, res)\n", |
|
1880 | 1880 | " Do not add any extra characters around that formatting as it will make the output parsing break. It is very important you stick to that output format\n", |
1881 | 1881 | " \"\"\"\n", |
1882 | 1882 | "\n", |
1883 | | - "response = client.chat.completions.create(\n", |
| 1883 | + "response = client.responses.create(\n", |
1884 | 1884 | " model=datagen_model,\n", |
1885 | | - " messages=[\n", |
| 1885 | + " input=[\n", |
1886 | 1886 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to analyze clustered data\"},\n", |
1887 | 1887 | " {\"role\": \"user\", \"content\": topic_prompt}\n", |
1888 | 1888 | " ]\n", |
1889 | 1889 | ")\n", |
1890 | | - "res = response.choices[0].message.content\n", |
| 1890 | + "res = response.output_text\n", |
1891 | 1891 | "print(res)\n" |
1892 | 1892 | ] |
1893 | 1893 | }, |
|
2096 | 2096 | " Output: \"Experience unparalleled comfort. These shoes feature a blend of modern style and the traditional superior cushioning, perfect for those always on the move.\"\n", |
2097 | 2097 | " \"\"\"\n", |
2098 | 2098 | "\n", |
2099 | | - " response = client.chat.completions.create(\n", |
| 2099 | + " response = client.responses.create(\n", |
2100 | 2100 | " model=\"gpt-4o-mini\",\n", |
2101 | | - " messages=[\n", |
| 2101 | + " input=[\n", |
2102 | 2102 | " {\"role\": \"system\", \"content\": \"You are a helpful assistant designed to generate synthetic data.\"},\n", |
2103 | 2103 | " {\"role\": \"user\", \"content\": question}\n", |
2104 | 2104 | " ]\n", |
2105 | 2105 | " )\n", |
2106 | | - " res = response.choices[0].message.content\n", |
| 2106 | + " res = response.output_text\n", |
2107 | 2107 | " output_string += res + \"\\n\" + \"\\n\"\n", |
2108 | 2108 | "print(output_string)" |
2109 | 2109 | ] |
|
0 commit comments