From 4065cc00d42fb80ee2bbe397432a0b26f0f8fb66 Mon Sep 17 00:00:00 2001 From: Goutham Karunakaran Date: Sun, 20 Oct 2024 05:30:07 +0200 Subject: [PATCH] docs: update example to use file_path arg; reflecting updated BatchJob.create_from_messages (#1096) --- docs/cli/batch.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/docs/cli/batch.md b/docs/cli/batch.md index 9cd00394f..5cd3953b7 100644 --- a/docs/cli/batch.md +++ b/docs/cli/batch.md @@ -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