|
5 | 5 | 'kind': 'CLIENT REQUEST', |
6 | 6 | 'payload': list([ |
7 | 7 | dict({ |
8 | | - 'content': 'Get me stuff.', |
| 8 | + 'content': ''' |
| 9 | + |
| 10 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 11 | + ``` |
| 12 | + interface ExampleABC { |
| 13 | + a: string; |
| 14 | + b: boolean; |
| 15 | + c: number; |
| 16 | + } |
| 17 | + |
| 18 | + ``` |
| 19 | + The following is a user request: |
| 20 | + ''' |
| 21 | + Get me stuff. |
| 22 | + ''' |
| 23 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 24 | + |
| 25 | + ''', |
9 | 26 | 'role': 'user', |
10 | 27 | }), |
| 28 | + ]), |
| 29 | + }), |
| 30 | + dict({ |
| 31 | + 'kind': 'MODEL RESPONSE', |
| 32 | + 'payload': '{ "a": "hello", "b": true, "c": 1234 }', |
| 33 | + }), |
| 34 | + ]) |
| 35 | +# --- |
| 36 | +# name: test_translator_with_invalid_json |
| 37 | + list([ |
| 38 | + dict({ |
| 39 | + 'kind': 'CLIENT REQUEST', |
| 40 | + 'payload': list([ |
11 | 41 | dict({ |
12 | 42 | 'content': ''' |
13 | 43 |
|
|
33 | 63 | }), |
34 | 64 | dict({ |
35 | 65 | 'kind': 'MODEL RESPONSE', |
36 | | - 'payload': '{ "a": "hello", "b": true, "c": 1234 }', |
| 66 | + 'payload': '{ "a": "hello" "b": true }', |
| 67 | + }), |
| 68 | + dict({ |
| 69 | + 'kind': 'CLIENT REQUEST', |
| 70 | + 'payload': list([ |
| 71 | + dict({ |
| 72 | + 'content': ''' |
| 73 | + |
| 74 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 75 | + ``` |
| 76 | + interface ExampleABC { |
| 77 | + a: string; |
| 78 | + b: boolean; |
| 79 | + c: number; |
| 80 | + } |
| 81 | + |
| 82 | + ``` |
| 83 | + The following is a user request: |
| 84 | + ''' |
| 85 | + Get me stuff. |
| 86 | + ''' |
| 87 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 88 | + |
| 89 | + ''', |
| 90 | + 'role': 'user', |
| 91 | + }), |
| 92 | + dict({ |
| 93 | + 'content': '{ "a": "hello" "b": true }', |
| 94 | + 'role': 'assistant', |
| 95 | + }), |
| 96 | + dict({ |
| 97 | + 'content': ''' |
| 98 | + |
| 99 | + The above JSON object is invalid for the following reason: |
| 100 | + ''' |
| 101 | + Error: expected `,` or `}` at line 1 column 16 |
| 102 | + |
| 103 | + Attempted to parse: |
| 104 | + |
| 105 | + { "a": "hello" "b": true } |
| 106 | + ''' |
| 107 | + The following is a revised JSON object: |
| 108 | + |
| 109 | + ''', |
| 110 | + 'role': 'user', |
| 111 | + }), |
| 112 | + ]), |
| 113 | + }), |
| 114 | + dict({ |
| 115 | + 'kind': 'MODEL RESPONSE', |
| 116 | + 'payload': '{ "a": "hello" "b": true, "c": 1234 }', |
37 | 117 | }), |
38 | 118 | ]) |
39 | 119 | # --- |
|
43 | 123 | 'kind': 'CLIENT REQUEST', |
44 | 124 | 'payload': list([ |
45 | 125 | dict({ |
46 | | - 'content': 'Get me stuff.', |
| 126 | + 'content': ''' |
| 127 | + |
| 128 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 129 | + ``` |
| 130 | + interface ExampleABC { |
| 131 | + a: string; |
| 132 | + b: boolean; |
| 133 | + c: number; |
| 134 | + } |
| 135 | + |
| 136 | + ``` |
| 137 | + The following is a user request: |
| 138 | + ''' |
| 139 | + Get me stuff. |
| 140 | + ''' |
| 141 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 142 | + |
| 143 | + ''', |
| 144 | + 'role': 'user', |
| 145 | + }), |
| 146 | + ]), |
| 147 | + }), |
| 148 | + dict({ |
| 149 | + 'kind': 'MODEL RESPONSE', |
| 150 | + 'payload': '{ "a": "hello", "b": true }', |
| 151 | + }), |
| 152 | + dict({ |
| 153 | + 'kind': 'CLIENT REQUEST', |
| 154 | + 'payload': list([ |
| 155 | + dict({ |
| 156 | + 'content': ''' |
| 157 | + |
| 158 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 159 | + ``` |
| 160 | + interface ExampleABC { |
| 161 | + a: string; |
| 162 | + b: boolean; |
| 163 | + c: number; |
| 164 | + } |
| 165 | + |
| 166 | + ``` |
| 167 | + The following is a user request: |
| 168 | + ''' |
| 169 | + Get me stuff. |
| 170 | + ''' |
| 171 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 172 | + |
| 173 | + ''', |
| 174 | + 'role': 'user', |
| 175 | + }), |
| 176 | + dict({ |
| 177 | + 'content': '{ "a": "hello", "b": true }', |
| 178 | + 'role': 'assistant', |
| 179 | + }), |
| 180 | + dict({ |
| 181 | + 'content': ''' |
| 182 | + |
| 183 | + The above JSON object is invalid for the following reason: |
| 184 | + ''' |
| 185 | + Validation path `c` failed for value `{"a": "hello", "b": true}` because: |
| 186 | + Field required |
| 187 | + ''' |
| 188 | + The following is a revised JSON object: |
| 189 | + |
| 190 | + ''', |
| 191 | + 'role': 'user', |
| 192 | + }), |
| 193 | + ]), |
| 194 | + }), |
| 195 | + dict({ |
| 196 | + 'kind': 'MODEL RESPONSE', |
| 197 | + 'payload': '{ "a": "hello", "b": true, "c": 1234 }', |
| 198 | + }), |
| 199 | + ]) |
| 200 | +# --- |
| 201 | +# name: test_translator_with_single_failure_and_list_preamble_1 |
| 202 | + list([ |
| 203 | + dict({ |
| 204 | + 'kind': 'CLIENT REQUEST', |
| 205 | + 'payload': list([ |
| 206 | + dict({ |
| 207 | + 'content': 'Hey, I need some stuff.', |
47 | 208 | 'role': 'user', |
48 | 209 | }), |
| 210 | + dict({ |
| 211 | + 'content': 'Okay, what kind of stuff?', |
| 212 | + 'role': 'assistant', |
| 213 | + }), |
49 | 214 | dict({ |
50 | 215 | 'content': ''' |
51 | 216 |
|
|
67 | 232 | ''', |
68 | 233 | 'role': 'user', |
69 | 234 | }), |
| 235 | + ]), |
| 236 | + }), |
| 237 | + dict({ |
| 238 | + 'kind': 'MODEL RESPONSE', |
| 239 | + 'payload': '{ "a": "hello", "b": true }', |
| 240 | + }), |
| 241 | + dict({ |
| 242 | + 'kind': 'CLIENT REQUEST', |
| 243 | + 'payload': list([ |
| 244 | + dict({ |
| 245 | + 'content': 'Hey, I need some stuff.', |
| 246 | + 'role': 'user', |
| 247 | + }), |
| 248 | + dict({ |
| 249 | + 'content': 'Okay, what kind of stuff?', |
| 250 | + 'role': 'assistant', |
| 251 | + }), |
| 252 | + dict({ |
| 253 | + 'content': ''' |
| 254 | + |
| 255 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 256 | + ``` |
| 257 | + interface ExampleABC { |
| 258 | + a: string; |
| 259 | + b: boolean; |
| 260 | + c: number; |
| 261 | + } |
| 262 | + |
| 263 | + ``` |
| 264 | + The following is a user request: |
| 265 | + ''' |
| 266 | + Get me stuff. |
| 267 | + ''' |
| 268 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 269 | + |
| 270 | + ''', |
| 271 | + 'role': 'user', |
| 272 | + }), |
| 273 | + dict({ |
| 274 | + 'content': '{ "a": "hello", "b": true }', |
| 275 | + 'role': 'assistant', |
| 276 | + }), |
70 | 277 | dict({ |
71 | 278 | 'content': ''' |
72 | 279 |
|
|
82 | 289 | }), |
83 | 290 | ]), |
84 | 291 | }), |
| 292 | + dict({ |
| 293 | + 'kind': 'MODEL RESPONSE', |
| 294 | + 'payload': '{ "a": "hello", "b": true, "c": 1234 }', |
| 295 | + }), |
| 296 | + ]) |
| 297 | +# --- |
| 298 | +# name: test_translator_with_single_failure_and_str_preamble |
| 299 | + list([ |
| 300 | + dict({ |
| 301 | + 'kind': 'CLIENT REQUEST', |
| 302 | + 'payload': list([ |
| 303 | + dict({ |
| 304 | + 'content': 'Just so you know, I need some stuff.', |
| 305 | + 'role': 'user', |
| 306 | + }), |
| 307 | + dict({ |
| 308 | + 'content': ''' |
| 309 | + |
| 310 | + You are a service that translates user requests into JSON objects of type "ExampleABC" according to the following TypeScript definitions: |
| 311 | + ``` |
| 312 | + interface ExampleABC { |
| 313 | + a: string; |
| 314 | + b: boolean; |
| 315 | + c: number; |
| 316 | + } |
| 317 | + |
| 318 | + ``` |
| 319 | + The following is a user request: |
| 320 | + ''' |
| 321 | + Get me stuff. |
| 322 | + ''' |
| 323 | + The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined: |
| 324 | + |
| 325 | + ''', |
| 326 | + 'role': 'user', |
| 327 | + }), |
| 328 | + ]), |
| 329 | + }), |
85 | 330 | dict({ |
86 | 331 | 'kind': 'MODEL RESPONSE', |
87 | 332 | 'payload': '{ "a": "hello", "b": true }', |
|
90 | 335 | 'kind': 'CLIENT REQUEST', |
91 | 336 | 'payload': list([ |
92 | 337 | dict({ |
93 | | - 'content': 'Get me stuff.', |
| 338 | + 'content': 'Just so you know, I need some stuff.', |
94 | 339 | 'role': 'user', |
95 | 340 | }), |
96 | 341 | dict({ |
|
114 | 359 | ''', |
115 | 360 | 'role': 'user', |
116 | 361 | }), |
| 362 | + dict({ |
| 363 | + 'content': '{ "a": "hello", "b": true }', |
| 364 | + 'role': 'assistant', |
| 365 | + }), |
117 | 366 | dict({ |
118 | 367 | 'content': ''' |
119 | 368 |
|
|
0 commit comments