I am trying to run this code:
from pydantic import BaseModel
from openai import OpenAI
client = OpenAI()
class CalendarEvent(BaseModel):
name: str
date: str
participants: list[str]
completion = client.beta.chatpletions.parse(
model="gpt-4o-2024-08-06",
messages=[
{"role": "system", "content": "Extract the event information."},
{"role": "user", "content": "Alice and Bob are going to a science fair on Friday."},
],
response_format=CalendarEvent,
)
event = completion.choices[0].message.parsed
From OpenAI webpage, using AzureChatOpenAI client
from langchain_openai import AzureChatOpenAI
client = AzureChatOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
openai_api_version="2024-06-01",
model=MODEL_NAME,
openai_api_key=os.environ["AZURE_OPENAI_API_KEY"],
temperature=0.0,
)
However, I am encountering this error:
'AzureChatOpenAI' object has no attribute 'beta'
Any solution on this?