Skip to content

Commit

Permalink
Python: import fix for azure ai search settings in chat (#6562)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Fix for an issue where Azure AI search packages where needed for core
behavior.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https:/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https:/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
eavanvalkenburg authored Jun 5, 2024
1 parent b85bca1 commit 032fa2c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft. All rights reserved.

import logging
from typing import Annotated, Any, Literal, Union
from typing import TYPE_CHECKING, Annotated, Any, Literal, Union

from pydantic import AliasGenerator, ConfigDict, Field
from pydantic.alias_generators import to_camel, to_snake
Expand All @@ -10,9 +10,11 @@
from semantic_kernel.connectors.ai.open_ai.prompt_execution_settings.open_ai_prompt_execution_settings import (
OpenAIChatPromptExecutionSettings,
)
from semantic_kernel.connectors.memory.azure_cognitive_search.azure_ai_search_settings import AzureAISearchSettings
from semantic_kernel.kernel_pydantic import KernelBaseModel

if TYPE_CHECKING:
from semantic_kernel.connectors.memory.azure_cognitive_search.azure_ai_search_settings import AzureAISearchSettings

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -86,7 +88,7 @@ class AzureAISearchDataSource(AzureChatRequestBase):
parameters: Annotated[dict, AzureAISearchDataSourceParameters]

@classmethod
def from_azure_ai_search_settings(cls, azure_ai_search_settings: AzureAISearchSettings, **kwargs: Any):
def from_azure_ai_search_settings(cls, azure_ai_search_settings: "AzureAISearchSettings", **kwargs: Any):
"""Create an instance from Azure AI Search settings."""
kwargs["parameters"] = {
"endpoint": str(azure_ai_search_settings.endpoint),
Expand Down

0 comments on commit 032fa2c

Please sign in to comment.