community: add default value to bing_search_url (#23306)

bing_search_url is an endpoint to requests bing search resource and is
normally invariant to users, we can give it the default value to simply
the uesages of this utility/tool
This commit is contained in:
Qingchuan Hao 2024-06-25 20:08:41 +08:00 committed by GitHub
parent 68e0ae3286
commit ad50702934
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,10 @@ import requests
from langchain_core.pydantic_v1 import BaseModel, Extra, Field, root_validator
from langchain_core.utils import get_from_dict_or_env
# BING_SEARCH_ENDPOINT is the default endpoint for Bing Search API and is normally
# invariant to users.
BING_SEARCH_ENDPOINT = "https://api.bing.microsoft.com/v7.0/search"
class BingSearchAPIWrapper(BaseModel):
"""Wrapper for Bing Search API."""
@ -52,7 +56,7 @@ class BingSearchAPIWrapper(BaseModel):
values,
"bing_search_url",
"BING_SEARCH_URL",
# default="https://api.bing.microsoft.com/v7.0/search",
default=BING_SEARCH_ENDPOINT,
)
values["bing_search_url"] = bing_search_url