Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typing in samples #38354

Open
wants to merge 13 commits into
base: feature/azure-ai-projects
Choose a base branch
from
Open

Conversation

nick863
Copy link
Contributor

@nick863 nick863 commented Nov 6, 2024

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-ai-projects

@@ -121,22 +123,22 @@ async def sample_connections_async():
print("====> Creating ChatCompletionsClient using API key authentication")
from azure.core.credentials import AzureKeyCredential

client = ChatCompletionsClient(
endpoint=connection.endpoint_url, credential=AzureKeyCredential(connection.key)
ai_client = ChatCompletionsClient(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change of name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the sync sample version you call it inference_client. So if you want to change the name, you can change it to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mypy defines the variable type y its first occurrence in the code and once it was assigned specific type, it will complain if we call methods of the other type.


import os
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import ConnectionType, AuthenticationType
from azure.identity import DefaultAzureCredential

#from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from azure.core.credentials import TokenCredential
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this import statement above the line that uses it.


import asyncio
import os
from azure.ai.projects.aio import AIProjectClient
from azure.ai.projects.models import ConnectionType, AuthenticationType
from azure.core.credentials_async import AsyncTokenCredential
from azure.identity.aio import DefaultAzureCredential
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the line from azure.core.credentials_async import AsyncTokenCredential above the line that uses it, not at the top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants