Commit aa02563
Upgrade OpenAI SDK to v1 (#1017)
* Update version ranges for 1.3.5 openai lib
* Update the embeddings library in scripts to use OpenAI 1.3.5 remove some redundant methods
* Update the embedding response to use a typed model
* Rewrite test_prepdocs to patch out OpenAI v1 models and responses
* Update approaches to use new APIs
* Update backend service and read approaches to use new SDK
* Fix get_search_query. Update RRR approach tests
* Update search manager tests
* Change patching for app tests
* Use deployment ID only in the constructor of the Azure OpenAI Client object and remove it from the approach constructors (and all the logic that went with it)
* Explicitly include aiohttp in prepdocs requirements
* Use two clients because the new SDK doesn't support a deployment name in the chat or embeddings methods
* Ruff ruff
* Simplify typing constructor
* Update types for message history
* Convert RRR to dict before returning
* Bend the rules of physics to get mypy to pass
* Run black over scripts again
* Fix content filtering, update snapshot tests, implement pydantic models for streaming responses.
* Update the snapshots with the new required fields for chunked completions. Update the iterator to pass pydantic model validation
* Force keyword arguments as the list of arguments is long and complicated
* Refactor to have a single client object
* Drop argument
* Type the chat message builder with pydantic
* Rebuild requirements from merge conflicts
* Update formatting
* Fix issue with follow-up questions
* Simplify content check
* Don't use deployment field for non azure
* Update requirements.in
* Remove upper bound
* Remove dependabot constraint
* Merge the clients again
* Fix test_app client name
* Inline the ternary statement to pick either a model or deployment name for the OpenAI SDK calls
---------
Co-authored-by: Pamela Fox <[email protected]>
Co-authored-by: Pamela Fox <[email protected]>1 parent da24cf4 commit aa02563
File tree
55 files changed
+877
-402
lines changed- .github
- app/backend
- approaches
- core
- scripts
- prepdocslib
- tests
- snapshots/test_app
- test_ask_rtr_hybrid
- client0
- client1
- test_ask_rtr_text_filter/auth_client0
- test_ask_rtr_text_semanticcaptions
- client0
- client1
- test_ask_rtr_text_semanticranker
- client0
- client1
- test_ask_rtr_text
- client0
- client1
- test_chat_followup
- client0
- client1
- test_chat_hybrid
- client0
- client1
- test_chat_prompt_template_concat
- client0
- client1
- test_chat_prompt_template
- client0
- client1
- test_chat_session_state_persists
- client0
- client1
- test_chat_stream_followup
- client0
- client1
- test_chat_stream_session_state_persists
- client0
- client1
- test_chat_stream_text_filter/auth_client0
- test_chat_stream_text
- client0
- client1
- test_chat_text_filter/auth_client0
- test_chat_text_semanticcaptions
- client0
- client1
- test_chat_text_semanticranker
- client0
- client1
- test_chat_text
- client0
- client1
- test_chat_vector
- client0
- client1
- test_chat_with_history
- client0
- client1
- test_chat_with_long_history
- client0
- client1
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
55 files changed
+877
-402
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | | - | |
12 | 9 | | |
13 | | - | |
| 10 | + | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
| 14 | + | |
17 | 15 | | |
18 | 16 | | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
| 40 | + | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
105 | | - | |
| 103 | + | |
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
112 | | - | |
| 110 | + | |
113 | 111 | | |
114 | 112 | | |
115 | 113 | | |
| |||
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
133 | 128 | | |
134 | 129 | | |
135 | 130 | | |
| |||
178 | 173 | | |
179 | 174 | | |
180 | 175 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | 176 | | |
195 | 177 | | |
196 | 178 | | |
| |||
204 | 186 | | |
205 | 187 | | |
206 | 188 | | |
207 | | - | |
208 | | - | |
| 189 | + | |
| 190 | + | |
209 | 191 | | |
210 | 192 | | |
211 | 193 | | |
| |||
250 | 232 | | |
251 | 233 | | |
252 | 234 | | |
| 235 | + | |
| 236 | + | |
253 | 237 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 238 | + | |
259 | 239 | | |
260 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
261 | 245 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
265 | 250 | | |
266 | | - | |
| 251 | + | |
267 | 252 | | |
268 | 253 | | |
269 | 254 | | |
270 | 255 | | |
271 | 256 | | |
272 | 257 | | |
273 | 258 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
284 | 269 | | |
285 | 270 | | |
286 | 271 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
297 | 282 | | |
298 | 283 | | |
299 | 284 | | |
| |||
305 | 290 | | |
306 | 291 | | |
307 | 292 | | |
| 293 | + | |
| 294 | + | |
308 | 295 | | |
309 | 296 | | |
310 | 297 | | |
| |||
0 commit comments