()
| 39 | |
| 40 | |
| 41 | async def async_main() -> None: |
| 42 | from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider |
| 43 | |
| 44 | token_provider: AsyncAzureADTokenProvider = get_bearer_token_provider(DefaultAzureCredential(), scopes) |
| 45 | |
| 46 | client = AsyncAzureOpenAI( |
| 47 | api_version=api_version, |
| 48 | azure_endpoint=endpoint, |
| 49 | azure_ad_token_provider=token_provider, |
| 50 | ) |
| 51 | |
| 52 | completion = await client.chat.completions.create( |
| 53 | model=deployment_name, |
| 54 | messages=[ |
| 55 | { |
| 56 | "role": "user", |
| 57 | "content": "How do I output all files in a directory using Python?", |
| 58 | } |
| 59 | ], |
| 60 | ) |
| 61 | |
| 62 | print(completion.to_json()) |
| 63 | |
| 64 | |
| 65 | sync_main() |
no test coverage detected