| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ba3beaf commit bb95fe3
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,3 @@ | |||
| 1 | 1 | { | |
| 2 | - ".": "1.21.0" | ||
| 2 | + ".": "1.21.1" | ||
| 3 | 3 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,13 @@ | |||
| 1 | 1 | # Changelog | |
| 2 | 2 | ||
| 3 | + ## 1.21.1 (2024-04-17) | ||
| 4 | + | ||
| 5 | + Full Changelog: [v1.21.0...v1.21.1](https://github.com/openai/openai-python/compare/v1.21.0...v1.21.1) | ||
| 6 | + | ||
| 7 | + ### Chores | ||
| 8 | + | ||
| 9 | + * **api:** docs and response_format response property ([#1327](https://github.com/openai/openai-python/issues/1327)) ([7a6d142](https://github.com/openai/openai-python/commit/7a6d142f013994c4eb9a4f55888464c885f8baf0)) | ||
| 10 | + | ||
| 3 | 11 | ## 1.21.0 (2024-04-17) | |
| 4 | 12 | ||
| 5 | 13 | Full Changelog: [v1.20.0...v1.21.0](https://github.com/openai/openai-python/compare/v1.20.0...v1.21.0) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | [project] | |
| 2 | 2 | name = "openai" | |
| 3 | - version = "1.21.0" | ||
| 3 | + version = "1.21.1" | ||
| 4 | 4 | description = "The official Python library for the openai API" | |
| 5 | 5 | dynamic = ["readme"] | |
| 6 | 6 | license = "Apache-2.0" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | |
| 2 | 2 | ||
| 3 | 3 | __title__ = "openai" | |
| 4 | - __version__ = "1.21.0" # x-release-please-version | ||
| 4 | + __version__ = "1.21.1" # x-release-please-version | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,7 +109,7 @@ def create( | |||
| 109 | 109 | ||
| 110 | 110 | response_format: Specifies the format that the model must output. Compatible with | |
| 111 | 111 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 112 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 112 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 113 | 113 | ||
| 114 | 114 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 115 | 115 | message the model generates is valid JSON. | |
@@ -253,7 +253,7 @@ def update( | |||
| 253 | 253 | ||
| 254 | 254 | response_format: Specifies the format that the model must output. Compatible with | |
| 255 | 255 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 256 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 256 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 257 | 257 | ||
| 258 | 258 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 259 | 259 | message the model generates is valid JSON. | |
@@ -494,7 +494,7 @@ async def create( | |||
| 494 | 494 | ||
| 495 | 495 | response_format: Specifies the format that the model must output. Compatible with | |
| 496 | 496 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 497 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 497 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 498 | 498 | ||
| 499 | 499 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 500 | 500 | message the model generates is valid JSON. | |
@@ -638,7 +638,7 @@ async def update( | |||
| 638 | 638 | ||
| 639 | 639 | response_format: Specifies the format that the model must output. Compatible with | |
| 640 | 640 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 641 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 641 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 642 | 642 | ||
| 643 | 643 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 644 | 644 | message the model generates is valid JSON. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -340,7 +340,7 @@ def create_and_run( | |||
| 340 | 340 | ||
| 341 | 341 | response_format: Specifies the format that the model must output. Compatible with | |
| 342 | 342 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 343 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 343 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 344 | 344 | ||
| 345 | 345 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 346 | 346 | message the model generates is valid JSON. | |
@@ -366,7 +366,7 @@ def create_and_run( | |||
| 366 | 366 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 367 | 367 | not call any tools and instead generates a message. `auto` is the default value | |
| 368 | 368 | and means the model can pick between generating a message or calling a tool. | |
| 369 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 369 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 370 | 370 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 371 | 371 | call that tool. | |
| 372 | 372 | ||
@@ -382,6 +382,11 @@ def create_and_run( | |||
| 382 | 382 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 383 | 383 | means only the tokens comprising the top 10% probability mass are considered. | |
| 384 | 384 | ||
| 385 | + We generally recommend altering this or temperature but not both. | ||
| 386 | + | ||
| 387 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 388 | + control the intial context window of the run. | ||
| 389 | + | ||
| 385 | 390 | extra_headers: Send extra headers | |
| 386 | 391 | ||
| 387 | 392 | extra_query: Add additional query parameters to the request | |
@@ -481,7 +486,7 @@ def create_and_run( | |||
| 481 | 486 | ||
| 482 | 487 | response_format: Specifies the format that the model must output. Compatible with | |
| 483 | 488 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 484 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 489 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 485 | 490 | ||
| 486 | 491 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 487 | 492 | message the model generates is valid JSON. | |
@@ -503,7 +508,7 @@ def create_and_run( | |||
| 503 | 508 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 504 | 509 | not call any tools and instead generates a message. `auto` is the default value | |
| 505 | 510 | and means the model can pick between generating a message or calling a tool. | |
| 506 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 511 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 507 | 512 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 508 | 513 | call that tool. | |
| 509 | 514 | ||
@@ -519,6 +524,11 @@ def create_and_run( | |||
| 519 | 524 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 520 | 525 | means only the tokens comprising the top 10% probability mass are considered. | |
| 521 | 526 | ||
| 527 | + We generally recommend altering this or temperature but not both. | ||
| 528 | + | ||
| 529 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 530 | + control the intial context window of the run. | ||
| 531 | + | ||
| 522 | 532 | extra_headers: Send extra headers | |
| 523 | 533 | ||
| 524 | 534 | extra_query: Add additional query parameters to the request | |
@@ -618,7 +628,7 @@ def create_and_run( | |||
| 618 | 628 | ||
| 619 | 629 | response_format: Specifies the format that the model must output. Compatible with | |
| 620 | 630 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 621 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 631 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 622 | 632 | ||
| 623 | 633 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 624 | 634 | message the model generates is valid JSON. | |
@@ -640,7 +650,7 @@ def create_and_run( | |||
| 640 | 650 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 641 | 651 | not call any tools and instead generates a message. `auto` is the default value | |
| 642 | 652 | and means the model can pick between generating a message or calling a tool. | |
| 643 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 653 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 644 | 654 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 645 | 655 | call that tool. | |
| 646 | 656 | ||
@@ -656,6 +666,11 @@ def create_and_run( | |||
| 656 | 666 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 657 | 667 | means only the tokens comprising the top 10% probability mass are considered. | |
| 658 | 668 | ||
| 669 | + We generally recommend altering this or temperature but not both. | ||
| 670 | + | ||
| 671 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 672 | + control the intial context window of the run. | ||
| 673 | + | ||
| 659 | 674 | extra_headers: Send extra headers | |
| 660 | 675 | ||
| 661 | 676 | extra_query: Add additional query parameters to the request | |
@@ -1296,7 +1311,7 @@ async def create_and_run( | |||
| 1296 | 1311 | ||
| 1297 | 1312 | response_format: Specifies the format that the model must output. Compatible with | |
| 1298 | 1313 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 1299 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 1314 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 1300 | 1315 | ||
| 1301 | 1316 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 1302 | 1317 | message the model generates is valid JSON. | |
@@ -1322,7 +1337,7 @@ async def create_and_run( | |||
| 1322 | 1337 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 1323 | 1338 | not call any tools and instead generates a message. `auto` is the default value | |
| 1324 | 1339 | and means the model can pick between generating a message or calling a tool. | |
| 1325 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 1340 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 1326 | 1341 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 1327 | 1342 | call that tool. | |
| 1328 | 1343 | ||
@@ -1338,6 +1353,11 @@ async def create_and_run( | |||
| 1338 | 1353 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 1339 | 1354 | means only the tokens comprising the top 10% probability mass are considered. | |
| 1340 | 1355 | ||
| 1356 | + We generally recommend altering this or temperature but not both. | ||
| 1357 | + | ||
| 1358 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 1359 | + control the intial context window of the run. | ||
| 1360 | + | ||
| 1341 | 1361 | extra_headers: Send extra headers | |
| 1342 | 1362 | ||
| 1343 | 1363 | extra_query: Add additional query parameters to the request | |
@@ -1437,7 +1457,7 @@ async def create_and_run( | |||
| 1437 | 1457 | ||
| 1438 | 1458 | response_format: Specifies the format that the model must output. Compatible with | |
| 1439 | 1459 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 1440 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 1460 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 1441 | 1461 | ||
| 1442 | 1462 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 1443 | 1463 | message the model generates is valid JSON. | |
@@ -1459,7 +1479,7 @@ async def create_and_run( | |||
| 1459 | 1479 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 1460 | 1480 | not call any tools and instead generates a message. `auto` is the default value | |
| 1461 | 1481 | and means the model can pick between generating a message or calling a tool. | |
| 1462 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 1482 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 1463 | 1483 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 1464 | 1484 | call that tool. | |
| 1465 | 1485 | ||
@@ -1475,6 +1495,11 @@ async def create_and_run( | |||
| 1475 | 1495 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 1476 | 1496 | means only the tokens comprising the top 10% probability mass are considered. | |
| 1477 | 1497 | ||
| 1498 | + We generally recommend altering this or temperature but not both. | ||
| 1499 | + | ||
| 1500 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 1501 | + control the intial context window of the run. | ||
| 1502 | + | ||
| 1478 | 1503 | extra_headers: Send extra headers | |
| 1479 | 1504 | ||
| 1480 | 1505 | extra_query: Add additional query parameters to the request | |
@@ -1574,7 +1599,7 @@ async def create_and_run( | |||
| 1574 | 1599 | ||
| 1575 | 1600 | response_format: Specifies the format that the model must output. Compatible with | |
| 1576 | 1601 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 1577 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 1602 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 1578 | 1603 | ||
| 1579 | 1604 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 1580 | 1605 | message the model generates is valid JSON. | |
@@ -1596,7 +1621,7 @@ async def create_and_run( | |||
| 1596 | 1621 | tool_choice: Controls which (if any) tool is called by the model. `none` means the model will | |
| 1597 | 1622 | not call any tools and instead generates a message. `auto` is the default value | |
| 1598 | 1623 | and means the model can pick between generating a message or calling a tool. | |
| 1599 | - Specifying a particular tool like `{"type": "TOOL_TYPE"}` or | ||
| 1624 | + Specifying a particular tool like `{"type": "file_search"}` or | ||
| 1600 | 1625 | `{"type": "function", "function": {"name": "my_function"}}` forces the model to | |
| 1601 | 1626 | call that tool. | |
| 1602 | 1627 | ||
@@ -1612,6 +1637,11 @@ async def create_and_run( | |||
| 1612 | 1637 | model considers the results of the tokens with top_p probability mass. So 0.1 | |
| 1613 | 1638 | means only the tokens comprising the top 10% probability mass are considered. | |
| 1614 | 1639 | ||
| 1640 | + We generally recommend altering this or temperature but not both. | ||
| 1641 | + | ||
| 1642 | + truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to | ||
| 1643 | + control the intial context window of the run. | ||
| 1644 | + | ||
| 1615 | 1645 | extra_headers: Send extra headers | |
| 1616 | 1646 | ||
| 1617 | 1647 | extra_query: Add additional query parameters to the request | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | from ..._models import BaseModel | |
| 7 | 7 | from .assistant_tool import AssistantTool | |
| 8 | + from .assistant_response_format_option import AssistantResponseFormatOption | ||
| 8 | 9 | ||
| 9 | 10 | __all__ = ["Assistant", "ToolResources", "ToolResourcesCodeInterpreter", "ToolResourcesFileSearch"] | |
| 10 | 11 | ||
@@ -81,10 +82,45 @@ class Assistant(BaseModel): | |||
| 81 | 82 | `code_interpreter`, `file_search`, or `function`. | |
| 82 | 83 | """ | |
| 83 | 84 | ||
| 85 | + response_format: Optional[AssistantResponseFormatOption] = None | ||
| 86 | + """Specifies the format that the model must output. | ||
| 87 | + | ||
| 88 | + Compatible with | ||
| 89 | + [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | ||
| 90 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 91 | + | ||
| 92 | + Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | ||
| 93 | + message the model generates is valid JSON. | ||
| 94 | + | ||
| 95 | + **Important:** when using JSON mode, you **must** also instruct the model to | ||
| 96 | + produce JSON yourself via a system or user message. Without this, the model may | ||
| 97 | + generate an unending stream of whitespace until the generation reaches the token | ||
| 98 | + limit, resulting in a long-running and seemingly "stuck" request. Also note that | ||
| 99 | + the message content may be partially cut off if `finish_reason="length"`, which | ||
| 100 | + indicates the generation exceeded `max_tokens` or the conversation exceeded the | ||
| 101 | + max context length. | ||
| 102 | + """ | ||
| 103 | + | ||
| 104 | + temperature: Optional[float] = None | ||
| 105 | + """What sampling temperature to use, between 0 and 2. | ||
| 106 | + | ||
| 107 | + Higher values like 0.8 will make the output more random, while lower values like | ||
| 108 | + 0.2 will make it more focused and deterministic. | ||
| 109 | + """ | ||
| 110 | + | ||
| 84 | 111 | tool_resources: Optional[ToolResources] = None | |
| 85 | 112 | """A set of resources that are used by the assistant's tools. | |
| 86 | 113 | ||
| 87 | 114 | The resources are specific to the type of tool. For example, the | |
| 88 | 115 | `code_interpreter` tool requires a list of file IDs, while the `file_search` | |
| 89 | 116 | tool requires a list of vector store IDs. | |
| 90 | 117 | """ | |
| 118 | + | ||
| 119 | + top_p: Optional[float] = None | ||
| 120 | + """ | ||
| 121 | + An alternative to sampling with temperature, called nucleus sampling, where the | ||
| 122 | + model considers the results of the tokens with top_p probability mass. So 0.1 | ||
| 123 | + means only the tokens comprising the top 10% probability mass are considered. | ||
| 124 | + | ||
| 125 | + We generally recommend altering this or temperature but not both. | ||
| 126 | + """ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,7 +77,7 @@ class AssistantCreateParams(TypedDict, total=False): | |||
| 77 | 77 | ||
| 78 | 78 | Compatible with | |
| 79 | 79 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 80 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 80 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 81 | 81 | ||
| 82 | 82 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 83 | 83 | message the model generates is valid JSON. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ class AssistantUpdateParams(TypedDict, total=False): | |||
| 47 | 47 | ||
| 48 | 48 | Compatible with | |
| 49 | 49 | [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and | |
| 50 | - all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. | ||
| 50 | + all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. | ||
| 51 | 51 | ||
| 52 | 52 | Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the | |
| 53 | 53 | message the model generates is valid JSON. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments