langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
94.17k stars 15.22k forks source link

azure_search_key in AzureSearch should be optional and default to None #27536

Open koberghe opened 1 week ago

koberghe commented 1 week ago

Checked other resources

Example Code

In following code

class AzureSearch(VectorStore):
    """`Azure Cognitive Search` vector store."""

    def __init__(
        self,
        azure_search_endpoint: str,
        azure_search_key: str 

the parameter azure_search_key should be optional and default to None.

Error Message and Stack Trace (if applicable)

No response

Description

These changes made key in _get_search_client optional, defaulting to None. Consequently, None should be allowed for azure_search_key when initializing the AzureSearch client.

Background: When running my Azure Function App locally, I use a ManagedIdentity. For this setup, I set azure_search_key to None so that _get_search_client falls back to using DefaultAzureCredential()

System Info

System Information

OS: Windows OS Version: 10.0.19045 Python Version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]

Package Information

langchain_core: 0.3.12 langchain: 0.3.4 langchain_community: 0.3.3 langsmith: 0.1.129
langchain_openai: 0.2.1 langchain_text_splitters: 0.3.0

Optional packages not installed

langgraph langserve

Other Dependencies

aiohttp: 3.10.8 async-timeout: 4.0.3 dataclasses-json: 0.6.7 httpx: 0.27.2 jsonpatch: 1.33 numpy: 1.26.4 openai: 1.51.0 orjson: 3.10.7 packaging: 24.1 pydantic: 2.9.2 pydantic-settings: 2.5.2 PyYAML: 6.0.2 requests: 2.32.3 SQLAlchemy: 2.0.35 tenacity: 8.5.0 tiktoken: 0.7.0 typing-extensions: 4.12.2

e-than-c commented 1 week ago

Hi @koberghe, we're a group of University of Toronto students. Do you mind if we try to implement this fix and submit a PR for this issue?