@tsukada.mamoru Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
Please use the below sample and let me know if that helps.
More info about the sample is here.
from openai import AzureOpenAI
# gets the API Key from environment variable AZURE_OPENAI_API_KEY
client = AzureOpenAI(
api_key = "156*********e19431",
api_version="2023-09-15-preview",
azure_endpoint="https://proc01.openai.azure.com",
)
completion = client.chat.completions.create(
model="gpt-35", # e.g. gpt-35-instant
messages=[{"role":"system","content":"Extract the person's name, company name, location, and phone number from the text below."},{"role":"user","content":"Hello, \\n\\nmy name is Robert Smith. My name is Robert Smith. I am calling from Contoso Insurance in Delaware. A colleague of mine wanted to know if you would like to learn more about our comprehensive benefits policy. If you have a few moments, could you please give me a call at (555) 346-9322. Thank you.\\n\\nRobert Smith\\nContoso Insurance\\nDelaware\\n(555) 346-9322"},{"role":"assistant","content":"Person's Name: Robert Smith\nCompany Name: Contoso Insurance\nLocation: Delaware\nPhone Number: (555) 346-9322"}],
)
print(completion.choices[0].message.content)
.
Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.
**
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.