From c373577d3d5fe4bb08d3ad0f239e19de683c19c4 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Mon, 5 Feb 2024 13:45:18 -0500 Subject: [PATCH] bump --- docs/concepts/caching.md | 4 +- docs/concepts/lists.md | 4 +- docs/concepts/parallel.md | 2 +- docs/concepts/partial.md | 1340 +++++++++++++++++++++++++++++++++ docs/concepts/raw_response.md | 4 +- docs/concepts/retrying.md | 11 +- 6 files changed, 1357 insertions(+), 8 deletions(-) diff --git a/docs/concepts/caching.md b/docs/concepts/caching.md index f0b64da12..0074f730e 100644 --- a/docs/concepts/caching.md +++ b/docs/concepts/caching.md @@ -33,12 +33,12 @@ def extract(data) -> UserDetail: start = time.perf_counter() # (1) model = extract("Extract jason is 25 years old") print(f"Time taken: {time.perf_counter() - start}") -#> Time taken: 0.4529974169563502 +#> Time taken: 0.4476582088973373 start = time.perf_counter() model = extract("Extract jason is 25 years old") # (2) print(f"Time taken: {time.perf_counter() - start}") -#> Time taken: 7.080379873514175e-07 +#> Time taken: 2.7909409254789352e-06 ``` 1. Using `time.perf_counter()` to measure the time taken to run the function is better than using `time.time()` because it's more accurate and less susceptible to system clock changes. diff --git a/docs/concepts/lists.md b/docs/concepts/lists.md index 77275dbc7..ac4edd9fa 100644 --- a/docs/concepts/lists.md +++ b/docs/concepts/lists.md @@ -159,8 +159,8 @@ async def print_iterable_results(): ) async for m in model: print(m) - #> name='John Doe' age=30 - #> name='Jane Doe' age=28 + #> name='John Doe' age=45 + #> name='Jane Doe' age=40 import asyncio diff --git a/docs/concepts/parallel.md b/docs/concepts/parallel.md index 890b2cdab..8afe1dcae 100644 --- a/docs/concepts/parallel.md +++ b/docs/concepts/parallel.md @@ -46,7 +46,7 @@ for fc in function_calls: print(fc) #> location='Toronto' units='metric' #> location='Dallas' units='imperial' - #> query='who won the super bowl' + #> query='Super Bowl winner' ``` 1. Set the mode to `PARALLEL_TOOLS` to enable parallel function calling. diff --git a/docs/concepts/partial.md b/docs/concepts/partial.md index 025c79b9f..4b0724c78 100644 --- a/docs/concepts/partial.md +++ b/docs/concepts/partial.md @@ -1440,6 +1440,1346 @@ for extraction in extraction_stream: 'deadline': '2024-02-20', } """ + #> {'users': [], 'date': None, 'location': None, 'budget': None, 'deadline': None} + """ + { + 'users': [{'name': None, 'email': None, 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': '', 'email': None, 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John', 'email': None, 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': None, 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': '', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'j', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'joh', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'johnd', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'johndoe', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'johndoe@email', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': None}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [{'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': '@'}], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + {'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': '@Tech'} + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + {'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': '@TechG'} + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + {'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': '@TechGuru'} + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + {'name': 'John Doe', 'email': 'johndoe@email.com', 'twitter': '@TechGuru44'} + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': None, 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': '', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': '', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'j', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'janes', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'janesmith', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'janesmith@email', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'janesmith@email.com', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + {'name': 'Jane Smith', 'email': 'janesmith@email.com', 'twitter': '@'}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@Digital', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalD', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': None, 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': '', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': None, 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': '', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alex', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alexj', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alexj@email', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alexj@email.com', 'twitter': None}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alexj@email.com', 'twitter': '@'}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + {'name': 'Alex Johnson', 'email': 'alexj@email.com', 'twitter': '@Code'}, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster202', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': None, + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '202', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': None, + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': '', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena,', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 452', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': None, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 500, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': None, + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '202', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '2024', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '2024-', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '2024-02', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '2024-02-', + } + """ + """ + { + 'users': [ + { + 'name': 'John Doe', + 'email': 'johndoe@email.com', + 'twitter': '@TechGuru44', + }, + { + 'name': 'Jane Smith', + 'email': 'janesmith@email.com', + 'twitter': '@DigitalDiva88', + }, + { + 'name': 'Alex Johnson', + 'email': 'alexj@email.com', + 'twitter': '@CodeMaster2023', + }, + ], + 'date': '2024-03-15', + 'location': 'Grand Tech Arena, 4521 Innovation Drive', + 'budget': 50000, + 'deadline': '2024-02-20', + } + """ console.clear() console.print(obj) ``` diff --git a/docs/concepts/raw_response.md b/docs/concepts/raw_response.md index b6a541f7c..1f6c991db 100644 --- a/docs/concepts/raw_response.md +++ b/docs/concepts/raw_response.md @@ -25,7 +25,7 @@ user: UserExtract = client.chat.completions.create( print(user._raw_response) """ ChatCompletion( - id='chatcmpl-8oyEqKoveJqZ2nnh5j8dAzpG2RtIv', + id='chatcmpl-8oyFg6k7g47CsGsgr401Zr6hIdTJQ', choices=[ Choice( finish_reason='stop', @@ -42,7 +42,7 @@ ChatCompletion( ), ) ], - created=1707158648, + created=1707158700, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, diff --git a/docs/concepts/retrying.md b/docs/concepts/retrying.md index 8292838bd..831ba267d 100644 --- a/docs/concepts/retrying.md +++ b/docs/concepts/retrying.md @@ -47,10 +47,12 @@ import openai import instructor from pydantic import BaseModel + class UserDetail(BaseModel): name: str age: int + client = instructor.patch(openai.OpenAI(), mode=instructor.Mode.TOOLS) response = client.chat.completions.create( @@ -61,7 +63,14 @@ response = client.chat.completions.create( ], max_retries=3, # (1)! ) -print(response.model_dump_json(indent=2)) # (2)! +print(response.model_dump_json(indent=2)) +""" +{ + "name": "jason", + "age": 12 +} +""" +# (2)! ``` 1. We set the maximum number of retries to 3. This means that if the model returns an error, we'll reask the model up to 3 times.