mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-12 14:23:58 +00:00
community: undo azure_ad_access_token breaking change (#25818)
This commit is contained in:
parent
6047138379
commit
f7e62754a1
@ -265,7 +265,6 @@ class AzureSearch(VectorStore):
|
|||||||
self,
|
self,
|
||||||
azure_search_endpoint: str,
|
azure_search_endpoint: str,
|
||||||
azure_search_key: str,
|
azure_search_key: str,
|
||||||
azure_ad_access_token: Optional[str],
|
|
||||||
index_name: str,
|
index_name: str,
|
||||||
embedding_function: Union[Callable, Embeddings],
|
embedding_function: Union[Callable, Embeddings],
|
||||||
search_type: str = "hybrid",
|
search_type: str = "hybrid",
|
||||||
@ -281,6 +280,7 @@ class AzureSearch(VectorStore):
|
|||||||
*,
|
*,
|
||||||
vector_search_dimensions: Optional[int] = None,
|
vector_search_dimensions: Optional[int] = None,
|
||||||
additional_search_client_options: Optional[Dict[str, Any]] = None,
|
additional_search_client_options: Optional[Dict[str, Any]] = None,
|
||||||
|
azure_ad_access_token: Optional[str] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
@ -1298,14 +1298,18 @@ class AzureSearch(VectorStore):
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
**{
|
**{
|
||||||
"captions": {
|
"captions": (
|
||||||
"text": result.get("@search.captions", [{}])[0].text,
|
{
|
||||||
|
"text": result.get("@search.captions", [{}])[
|
||||||
|
0
|
||||||
|
].text,
|
||||||
"highlights": result.get("@search.captions", [{}])[
|
"highlights": result.get("@search.captions", [{}])[
|
||||||
0
|
0
|
||||||
].highlights,
|
].highlights,
|
||||||
}
|
}
|
||||||
if result.get("@search.captions")
|
if result.get("@search.captions")
|
||||||
else {},
|
else {}
|
||||||
|
),
|
||||||
"answers": semantic_answers_dict.get(
|
"answers": semantic_answers_dict.get(
|
||||||
result.get(FIELDS_ID, ""),
|
result.get(FIELDS_ID, ""),
|
||||||
"",
|
"",
|
||||||
@ -1382,14 +1386,18 @@ class AzureSearch(VectorStore):
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
**{
|
**{
|
||||||
"captions": {
|
"captions": (
|
||||||
"text": result.get("@search.captions", [{}])[0].text,
|
{
|
||||||
|
"text": result.get("@search.captions", [{}])[
|
||||||
|
0
|
||||||
|
].text,
|
||||||
"highlights": result.get("@search.captions", [{}])[
|
"highlights": result.get("@search.captions", [{}])[
|
||||||
0
|
0
|
||||||
].highlights,
|
].highlights,
|
||||||
}
|
}
|
||||||
if result.get("@search.captions")
|
if result.get("@search.captions")
|
||||||
else {},
|
else {}
|
||||||
|
),
|
||||||
"answers": semantic_answers_dict.get(
|
"answers": semantic_answers_dict.get(
|
||||||
result.get(FIELDS_ID, ""),
|
result.get(FIELDS_ID, ""),
|
||||||
"",
|
"",
|
||||||
@ -1421,10 +1429,10 @@ class AzureSearch(VectorStore):
|
|||||||
azure_search = cls(
|
azure_search = cls(
|
||||||
azure_search_endpoint,
|
azure_search_endpoint,
|
||||||
azure_search_key,
|
azure_search_key,
|
||||||
azure_ad_access_token,
|
|
||||||
index_name,
|
index_name,
|
||||||
embedding,
|
embedding,
|
||||||
fields=fields,
|
fields=fields,
|
||||||
|
azure_ad_access_token=azure_ad_access_token,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
azure_search.add_texts(texts, metadatas, **kwargs)
|
azure_search.add_texts(texts, metadatas, **kwargs)
|
||||||
@ -1447,10 +1455,10 @@ class AzureSearch(VectorStore):
|
|||||||
azure_search = cls(
|
azure_search = cls(
|
||||||
azure_search_endpoint,
|
azure_search_endpoint,
|
||||||
azure_search_key,
|
azure_search_key,
|
||||||
azure_ad_access_token,
|
|
||||||
index_name,
|
index_name,
|
||||||
embedding,
|
embedding,
|
||||||
fields=fields,
|
fields=fields,
|
||||||
|
azure_ad_access_token=azure_ad_access_token,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
await azure_search.aadd_texts(texts, metadatas, **kwargs)
|
await azure_search.aadd_texts(texts, metadatas, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user