Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
doc: Update azure example
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt authored Nov 20, 2024
2 parents 5db2784 + 77f9d6e commit 6969d11
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions examples/azure-openai/basic.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import os
from openai import AzureOpenAI
import lunary
import lunary

DEPLOYMENT_ID = os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID")
RESOURCE_NAME = os.environ.get("AZURE_OPENAI_RESOURCE_NAME")
API_VERSION = os.environ.get("OPENAI_API_VERSION")
API_KEY = os.environ.get("AZURE_OPENAI_API_KEY")
AZURE_ENDPOINT = os.environ.get("AZURE_OPENAI_ENDPOINT")
RESOURCE_NAME = os.environ.get("AZURE_OPENAI_RESOURCE_NAME")


client = AzureOpenAI(
api_version="2023-07-01-preview",
api_key=API_KEY,
azure_endpoint=f"https://{DEPLOYMENT_ID}.openai.azure.com",
api_version=API_VERSION,
azure_endpoint=AZURE_ENDPOINT,
api_key=API_KEY
)

lunary.monitor(client)

completion = client.chat.completions.create(
model=RESOURCE_NAME,
messages=[
{
{
"role": "user",
"content": "Say AzureOpenAI Basic",
},
],
"content": "How do I output all files in a directory using Python?",
},
],
)
print(completion.to_json())

0 comments on commit 6969d11

Please sign in to comment.