Skip to content

Commit ef6ef48

Browse files
authored
Merge pull request #37 from Azure-Samples/responses-api
Migrate from Chat Completions to Responses API
2 parents 0930e9d + f67bd3f commit ef6ef48

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎example.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424
api_key=token_provider,
2525
)
2626

27-
response = client.chat.completions.create(
27+
response = client.responses.create(
2828
# For Azure OpenAI, the model parameter must be set to the deployment name
2929
model=os.environ["AZURE_OPENAI_GPT_DEPLOYMENT"],
3030
temperature=0.7,
31-
messages=[
31+
input=[
3232
{"role": "system", "content": "You are a helpful assistant that makes lots of cat references and uses emojis."},
3333
{"role": "user", "content": "Write a haiku about a hungry cat who wants tuna"},
3434
],
35+
store=False,
3536
)
3637

3738
print("Response: ")
38-
print(response.choices[0].message.content)
39+
print(response.output_text)

0 commit comments

Comments
 (0)