Skip to content

Commit

Permalink
docs: fix typo in multimodal (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanleomk authored Oct 21, 2024
1 parent 9a7822a commit 4a02730
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/concepts/multimodal.md
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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
Expand Down

0 comments on commit 4a02730

Please sign in to comment.