File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed
Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1010
1111file_to_upload_path = "./tests/configs/threads/sample.pdf"
1212
13+
1314async def main ():
1415 print ("Step 1: Create Assistant" )
1516 assistant = await AsyncAssistants (portkey ).create (
@@ -35,7 +36,9 @@ async def main():
3536 print (part )
3637
3738 print ("Step 4: Complete the upload" )
38- complete_upload = await AsyncUploads (portkey ).complete (upload_id = upload .id , part_ids = [part .id ])
39+ complete_upload = await AsyncUploads (portkey ).complete (
40+ upload_id = upload .id , part_ids = [part .id ]
41+ )
3942 print (complete_upload )
4043
4144 print ("Step 5: Create a run and poll" )
@@ -61,7 +64,7 @@ async def main():
6164
6265 print ("Step 6: Get the list of the messages" )
6366 messages = await AsyncMessages (portkey ).list (thread_id = run .thread_id )
64- print (messages )
67+ print (messages )
6568
6669
67- asyncio .run (main ())
70+ asyncio .run (main ())
Original file line number Diff line number Diff line change 22from portkey_ai import Portkey
33
44portkey = Portkey (
5- api_key = "Xgv7++HhSeF70UzdVSsmtJuGYe0=" ,
6- virtual_key = "portkey-welcome-e248d3"
5+ api_key = "Xgv7++HhSeF70UzdVSsmtJuGYe0=" , virtual_key = "portkey-welcome-e248d3"
76)
87
98
109file_name = "./tests/configs/batches/seed_tasks.jsonl"
1110
1211
1312print ("Step 1: Create a batch file" )
14- batch_file = portkey .files .create (
15- file = open (file_name , "rb" ),
16- purpose = "batch"
17- )
13+ batch_file = portkey .files .create (file = open (file_name , "rb" ), purpose = "batch" )
1814print (batch_file )
1915
2016
2117print ("Step 2: Create a batch job" )
2218batch_job = portkey .batches .create (
23- input_file_id = batch_file .id ,
24- endpoint = "/v1/chat/completions" ,
25- completion_window = "24h"
19+ input_file_id = batch_file .id ,
20+ endpoint = "/v1/chat/completions" ,
21+ completion_window = "24h" ,
2622)
2723print (batch_job )
2824
3430print ("Step 4: Retrieve the result" )
3531result_file_id = batch_job .output_file_id
3632result = portkey .files .content (result_file_id ).content
37- print (result )
33+ print (result )
You can’t perform that action at this time.
0 commit comments