Python: @overload decorator is missing on AzureTextEmbedding and OpenAITextEmbedding class.
Describe the bug
@overload decorator is missing on AzureTextEmbedding and OpenAITextEmbedding class.
https://github.com/microsoft/semantic-kernel/blob/563e1809e27c8bb918d605eaba9916d25e2cb478/python/semantic_kernel/connectors/ai/open_ai/services/azure_text_embedding.py#L45
https://github.com/microsoft/semantic-kernel/blob/563e1809e27c8bb918d605eaba9916d25e2cb478/python/semantic_kernel/connectors/ai/open_ai/services/open_ai_text_embedding.py#L39
To Reproduce
pyright would report this error
code
AzureTextEmbedding(
deployment_name=openai_config.model_id,
endpoint=openai_config.api_endpoint,
api_key=openai_config.api_key,
api_version=openai_config.api_version,
)
error
Initialize an AzureChatCompletion service.
Arguments:
deployment_name: The name of the Azure deployment. This value
will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under Resource Management > Deployments in the Azure portal or, alternatively, under Management > Deployments in Azure OpenAI Studio.
async_client {AsyncAzureOpenAI} -- An existing client to use.
log: The logger instance to use. (Optional)
Expected behavior
pyright shouldn't report any error.
Screenshots If applicable, add screenshots to help explain your problem.
Platform
- OS: Windows
- IDE: VS Code
- Language: Python
- Source: pip 0.4.2.dev0
Additional context Add any other context about the problem here.
Hi @chnldw, thanks for filing this. Could you let me know what the issue is?
We use @overload to declare different signatures of the same method. These declarations are like stubs and don't contain the actual implementation. They guide static type checkers and improve code readability.
The actual implementation of the method (in this case, the constructor) does not use @overload. That is why you see the constructor without decorator.
Thanks @moonbox3
Yes, the impact is type checking. pyright would report this error
code
AzureTextEmbedding(
deployment_name=openai_config.model_id,
endpoint=openai_config.api_endpoint,
api_key=openai_config.api_key,
api_version=openai_config.api_version,
)
error
Initialize an AzureChatCompletion service.
Arguments:
deployment_name: The name of the Azure deployment. This value
will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under Resource Management > Deployments in the Azure portal or, alternatively, under Management > Deployments in Azure OpenAI Studio.
async_client {AsyncAzureOpenAI} -- An existing client to use.
log: The logger instance to use. (Optional)
@eavanvalkenburg can you provide any insight here, please?
which python version are you using and how are you running pyright? @chnldw
As we haven't had a response on this in almost two months, closing this issue. If there is still a problem, please re-open the issue, or file a new one. Thank you.