()
| 15 | |
| 16 | |
| 17 | def sync_main() -> None: |
| 18 | from azure.identity import DefaultAzureCredential, get_bearer_token_provider |
| 19 | |
| 20 | token_provider: AzureADTokenProvider = get_bearer_token_provider(DefaultAzureCredential(), scopes) |
| 21 | |
| 22 | client = AzureOpenAI( |
| 23 | api_version=api_version, |
| 24 | azure_endpoint=endpoint, |
| 25 | azure_ad_token_provider=token_provider, |
| 26 | ) |
| 27 | |
| 28 | completion = client.chat.completions.create( |
| 29 | model=deployment_name, |
| 30 | messages=[ |
| 31 | { |
| 32 | "role": "user", |
| 33 | "content": "How do I output all files in a directory using Python?", |
| 34 | } |
| 35 | ], |
| 36 | ) |
| 37 | |
| 38 | print(completion.to_json()) |
| 39 | |
| 40 | |
| 41 | async def async_main() -> None: |
no test coverage detected