Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing "method" for OpenAI batch #1120

Closed
DGoettlich opened this issue Oct 25, 2024 · 2 comments
Closed

missing "method" for OpenAI batch #1120

DGoettlich opened this issue Oct 25, 2024 · 2 comments

Comments

@DGoettlich
Copy link

I am creating a batch for gpt-3.5-turbo:

chunks = pd.read_csv(input_path)

def create_batch(chunks):
for index, row in chunks.iterrows():
chunk_text = row["chunk_text"]
yield [
{
"role": "system",
"content": system_prompt,
},
{
"role": "user",
"content": prompt.format(chunk=chunk_text, examples=examples),
},
]

batch_job = BatchJob.create_from_messages(
messages_batch=messages,
model=model,
temperature=temp,
file_path=output_path,
response_model=ClassModel
)

but when i want to upload it using

$instructor batch create-from-file --file-path /my/path/example_batchname.jsonl

I'm getting the processing status "failed". Checking the OpenAI message revealed its missing the method, url, and body in the jsonl. In other words, the format isn't what OpenAI expects. Any idea what I'm doing wrong? Help would be appreciated. Thanks in advance.

@DGoettlich
Copy link
Author

the json format is:

{"custom_id":"b43f1dca-dac0-4ece-b6cf-3aae7b433ac4","params":{"model":"gpt-3.5-turbo","messages":[...],"max_tokens":1000,"temperature":0.0,"tools":[{"type":"function","function":{"name":"ClassModel","description":"Correctly extracted ClassModel with all the required parameters with correct types","parameters":{"properties":{"relevant":{"title":"Relevant","type":"integer"},"confidence":{"title":"Confidence","type":"integer"},"relevant_section":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Relevant Section"},"justification":{"title":"Justification","type":"string"}},"required":["confidence","justification","relevant","relevant_section"],"type":"object"}}}],"tool_choice":{"type":"function","function":{"name":"ClassModel"}}}}

@DGoettlich
Copy link
Author

is a duplicate of #1119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant