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

Python: support all auth options for azure ai search #8495

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

franklinlindemberg
Copy link
Contributor

@franklinlindemberg franklinlindemberg commented Sep 3, 2024

Motivation and Context

Description

Azure AI Search data source supports 4 types of authentication but semantic kernel only supports ApiKeyapi key.

This PR adds support to the other authentication options as defined in its docs, which are

  • system_assigned_managed_identity
  • user_assigned_managed_identity
  • access_token

Contribution Checklist

@franklinlindemberg franklinlindemberg requested a review from a team as a code owner September 3, 2024 17:51
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Sep 3, 2024
@github-actions github-actions bot changed the title support all auth options for azure ai search Python: support all auth options for azure ai search Sep 3, 2024
@franklinlindemberg franklinlindemberg marked this pull request as draft September 3, 2024 17:52
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Sep 3, 2024

Python Test Coverage

Python Test Coverage Report
FileStmtsMissCoverMissing
semantic_kernel
   kernel.py1994776%148, 159, 163, 313–316, 423, 437–480
semantic_kernel/agents/channels
   open_ai_assistant_channel.py49198%42
semantic_kernel/agents/group_chat
   agent_chat.py116199%91
   agent_group_chat.py67297%113, 135
   broadcast_queue.py72199%35
semantic_kernel/agents/open_ai
   assistant_content_generation.py68297%81–82
   open_ai_assistant_base.py358399%243, 321–322
semantic_kernel/connectors/ai
   chat_completion_client_base.py116298%382, 392
   completion_usage.py8188%17
semantic_kernel/connectors/ai/anthropic/services
   anthropic_chat_completion.py124398%120, 137, 173
semantic_kernel/connectors/ai/azure_ai_inference/services
   azure_ai_inference_chat_completion.py114695%131–134, 144, 165, 187
semantic_kernel/connectors/ai/embeddings
   embedding_generator_base.py8188%50
semantic_kernel/connectors/ai/google
   shared_utils.py26196%56
semantic_kernel/connectors/ai/google/google_ai/services
   google_ai_chat_completion.py119497%127, 153, 176, 178
   google_ai_text_completion.py63297%98, 121
   utils.py65395%140, 160–165
semantic_kernel/connectors/ai/google/vertex_ai/services
   utils.py66395%141, 161–166
   vertex_ai_chat_completion.py119497%121, 147, 170, 172
   vertex_ai_text_completion.py62297%95, 116
semantic_kernel/connectors/ai/hugging_face/services
   hf_text_completion.py60395%103, 112, 127
   hf_text_embedding.py32584%79–83
semantic_kernel/connectors/ai/mistral_ai/services
   mistral_ai_chat_completion.py118794%118–121, 307–310
semantic_kernel/connectors/ai/ollama/services
   ollama_chat_completion.py60592%95–98, 108, 143
   ollama_text_completion.py55591%87–90, 100, 128
semantic_kernel/connectors/ai/open_ai/services
   azure_chat_completion.py84199%105
   azure_text_completion.py28196%81
   open_ai_chat_completion_base.py122398%71, 123, 266
   open_ai_text_completion_base.py80298%56, 161
semantic_kernel/connectors/ai/open_ai/settings
   azure_open_ai_settings.py22195%99
semantic_kernel/connectors/memory/azure_ai_search
   azure_ai_search_collection.py87298%150, 152
semantic_kernel/connectors/memory/redis
   redis_collection.py160299%146, 316
   utils.py451176%145–146, 164, 166, 173–188
semantic_kernel/connectors/openapi_plugin
   openapi_manager.py58297%110–111
   openapi_parser.py88199%127
   openapi_runner.py105298%181–182
semantic_kernel/connectors/openapi_plugin/models
   rest_api_operation.py129199%242
semantic_kernel/contents
   function_call_content.py97199%201
semantic_kernel/core_plugins/sessions_python_tool
   sessions_python_plugin.py134894%69, 82–91, 99
   sessions_python_settings.py39490%84–87
semantic_kernel/data
   vector_store_record_collection.py2491992%410, 470–474, 482–486, 526–529, 536–539
   vector_store_record_utils.py26292%50, 52
semantic_kernel/functions
   kernel_function_decorator.py98199%102
   kernel_function_from_method.py96199%153
   kernel_function_from_prompt.py154795%165–166, 180, 201, 219, 239, 322
   kernel_function_log_messages.py36683%37–43
   kernel_plugin.py187299%472, 475
semantic_kernel/planners
   plan.py2344581%54, 163–165, 197, 214–227, 264, 269, 277–278, 288–291, 308, 313, 329, 332–337, 355, 360, 363, 365, 372, 386–388, 393–397
semantic_kernel/planners/function_calling_stepwise_planner
   function_calling_stepwise_planner.py116497%145, 189–190, 198
semantic_kernel/planners/sequential_planner
   sequential_planner.py64691%71, 75, 109, 125, 134–135
   sequential_planner_extensions.py50982%31–32, 56, 110–124
   sequential_planner_parser.py771284%66–74, 93, 117–120
semantic_kernel/schema
   kernel_json_schema_builder.py119596%50, 84, 206, 210–211
semantic_kernel/services
   ai_service_client_base.py22195%64
semantic_kernel/template_engine/blocks
   code_block.py77199%119
   named_arg_block.py43198%98
semantic_kernel/utils/authentication
   entra_id_authentication.py15287%26, 38
semantic_kernel/utils/telemetry
   user_agent.py16288%18–19
semantic_kernel/utils/telemetry/model_diagnostics
   decorators.py169498%370–373
TOTAL1095928697% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2440 4 💤 0 ❌ 0 🔥 1m 40s ⏱️

@franklinlindemberg franklinlindemberg marked this pull request as ready for review September 3, 2024 18:13
@franklinlindemberg
Copy link
Contributor Author

Hey @markwallace-microsoft! First time contributing here and trying to navigate the process.

Do you think its worth to add tests for this change? I didnt find specific tests for that file.

Also please let me know if I missed anything on how it works. My guess is that we just need to add these classes and it will automatically use the new options when calling openAI

@eavanvalkenburg
Copy link
Member

Hey @markwallace-microsoft! First time contributing here and trying to navigate the process.

Do you think its worth to add tests for this change? I didnt find specific tests for that file.

Also please let me know if I missed anything on how it works. My guess is that we just need to add these classes and it will automatically use the new options when calling openAI

Would be good to validate the validation that happens with a test, can be part of the tests/unit/connectors/open_ai/services/test_azure_chat_completion.py

@franklinlindemberg
Copy link
Contributor Author

@moonbox3 Could you please take another look? I reverted the change on the ApiKey parameter (to make the key required)

@franklinlindemberg
Copy link
Contributor Author

@eavanvalkenburg I noticed 2 approvals are required, could you please take a look as well?

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Sep 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 17, 2024
@moonbox3 moonbox3 added this pull request to the merge queue Sep 17, 2024
Merged via the queue into microsoft:main with commit 35f9c52 Sep 17, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants