提交 eb620dde 作者: hzg0601

修复 bing_search.py的typo;更新model_config.py中Bing Subscription Key申请方式及注意事项

上级 17f9a00e
...@@ -7,7 +7,7 @@ from configs.model_config import BING_SEARCH_URL, BING_SUBSCRIPTION_KEY ...@@ -7,7 +7,7 @@ from configs.model_config import BING_SEARCH_URL, BING_SUBSCRIPTION_KEY
def bing_search(text, result_len=3): def bing_search(text, result_len=3):
if not (BING_SEARCH_URL and BING_SUBSCRIPTION_KEY): if not (BING_SEARCH_URL and BING_SUBSCRIPTION_KEY):
return [{"snippet": "please set BING_SUBSCRIPTION_KEY and BING_SEARCH_URL in os ENV", return [{"snippet": "please set BING_SUBSCRIPTION_KEY and BING_SEARCH_URL in os ENV",
"title": "env inof not fould", "title": "env info is not found",
"link": "https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html"}] "link": "https://python.langchain.com/en/latest/modules/agents/tools/examples/bing_search.html"}]
search = BingSearchAPIWrapper(bing_subscription_key=BING_SUBSCRIPTION_KEY, search = BingSearchAPIWrapper(bing_subscription_key=BING_SUBSCRIPTION_KEY,
bing_search_url=BING_SEARCH_URL) bing_search_url=BING_SEARCH_URL)
......
...@@ -165,7 +165,14 @@ flagging username: {FLAG_USER_NAME} ...@@ -165,7 +165,14 @@ flagging username: {FLAG_USER_NAME}
OPEN_CROSS_DOMAIN = False OPEN_CROSS_DOMAIN = False
# Bing 搜索必备变量 # Bing 搜索必备变量
# 使用 Bing 搜索需要使用 Bing Subscription Key # 使用 Bing 搜索需要使用 Bing Subscription Key,需要在azure port中申请试用bing search
# 具体申请方式请见 https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/quickstarts/rest/python # 具体申请方式请见
# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource
# 使用python创建bing api 搜索实例详见:
# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/quickstarts/rest/python
BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search" BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"
# 注意不是bing Webmaster Tools的api key,
# 此外,如果是在服务器上,报Failed to establish a new connection: [Errno 110] Connection timed out
# 是因为服务器加了防火墙,需要联系管理员加白名单,如果公司的服务器的话,就别想了GG
BING_SUBSCRIPTION_KEY = "" BING_SUBSCRIPTION_KEY = ""
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论