From 4a0273016d154a3bc698b98be6f1712bf6a9b0c8 Mon Sep 17 00:00:00 2001 From: Ivan Leo Date: Mon, 21 Oct 2024 10:26:07 +0800 Subject: [PATCH] docs: fix typo in multimodal (#1101) --- docs/concepts/multimodal.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/concepts/multimodal.md b/docs/concepts/multimodal.md index baad197ce..a18dcec31 100644 --- a/docs/concepts/multimodal.md +++ b/docs/concepts/multimodal.md @@ -99,7 +99,6 @@ from openai import OpenAI from pydantic import BaseModel import instructor from instructor.multimodal import Audio -import base64 client = instructor.from_openai(OpenAI()) @@ -109,20 +108,21 @@ class User(BaseModel): age: int -with open("./output.wav", "rb") as f: - encoded_string = base64.b64encode(f.read()).decode("utf-8") - resp = client.chat.completions.create( model="gpt-4o-audio-preview", response_model=User, modalities=["text"], audio={"voice": "alloy", "format": "wav"}, + messages=[ + { + "role": "user", + "content": [ "Extract the following information from the audio:", Audio.from_path("./output.wav"), ], - }, + }, # type: ignore ], -) # type: ignore +) print(resp) # > name='Jason' age=20