Sign In
공부 내용

OpenAI API

Y
yeji Kim

Batch API 이용하기

1.
Upload batch file
from openai import OpenAI client = OpenAI() batch_input_file = client.files.create( file=open("batchinput.jsonl", "rb"), purpose="batch" )
2.
Creating the batch
batch_input_file_id = batch_input_file.id client.batches.create( input_file_id=batch_input_file_id, endpoint="/v1/chat/completions", completion_window="24h", metadata={ "description": "nightly eval job" } )
3.
Checking the status of a batch
from openai import OpenAI client = OpenAI() client.batches.retrieve("batch_abc123")
4.
Retrieving the results
from openai import OpenAI client = OpenAI() file_response = client.files.content("file-xyz123") print(file_response.text)

다른 LLM 알아보기

이걸로 기본적인 처리는 해야겠다!!! (와)
Subscribe to '아무튼-작업일지'
Subscribe to my site to be the first to receive notifications and emails about the latest updates, including new posts.
Join Slashpage and subscribe to '아무튼-작업일지'!
Subscribe
👍