Skip to content

Commit

Permalink
docs: update example to use file_path arg; reflecting updated BatchJo…
Browse files Browse the repository at this point in the history
…b.create_from_messages (#1096)
  • Loading branch information
goutham794 authored Oct 20, 2024
1 parent 694c7c2 commit 4065cc0
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions docs/cli/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,20 @@ You'll need to supply a valid .jsonl file in order to be able to create a Batch
messages = [
[
{
"role": "system",
"role": "user",
"content": f"Classify the following email {email}",
}
]
for email in emails
]

import json

with open("output.jsonl", "w") as f:
for line in BatchJob.create_from_messages(
messages,
model="gpt-3.5-turbo",
response_model=Classification,
max_tokens=100,
):
f.write(json.dumps(line) + "\n")
BatchJob.create_from_messages(
messages,
model="gpt-3.5-turbo",
response_model=Classification,
max_tokens=100,
file_path="output.jsonl"
)
```

You can then import in the .jsonl file using the `instructor batch create-from-file` command
Expand Down

0 comments on commit 4065cc0

Please sign in to comment.