Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dbgpt_plugins/search_engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ BING_API_KEY=your_bing_api_key
```

## Obtaining Google Cookie:
1. Go to the [Programmable Search Engine](https://developers.google.com/custom-search/v1/overview#api_key) website.
2. Go to the [Programmable Search Engine](https://programmablesearchengine.google.com/controlpanel/create) website.
1. Get Google Key, Go to the [Programmable Search Engine](https://developers.google.com/custom-search/v1/overview#api_key) website.
2. Google CX, Go to the [Programmable Search Engine](https://programmablesearchengine.google.com/controlpanel/create) website.
3. Get the API key and cx add it to the `.env` file in your project directory
4. You can refer to website https://developers.google.com/custom-search/v1/reference/rest
![Google Key](./screenshots/google_key.png)
Expand Down
2 changes: 1 addition & 1 deletion src/dbgpt_plugins/search_engine/baidu_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def _baidu_search(query: str, num_results=8):
'''
engine_cookie = os.getenv("BAIDU_COOKIE", None)
if not engine_cookie:
raise ValueError(f"Current search engine is baidu, please configure cookie information in .env ")
raise ValueError(f"Current search engine is baidu, please configure 'BAIDU_COOKIE' in .env ")

headers = {
'Cookie': engine_cookie,
Expand Down
2 changes: 1 addition & 1 deletion src/dbgpt_plugins/search_engine/bing_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _bing_search(query: str, num_results=8) -> str:
"""
subscription_key = os.getenv("BING_API_KEY")
if subscription_key is None:
raise ValueError("Please configure BING_API_KEY in .env first!")
raise ValueError("Please configure 'BING_API_KEY' in .env first!")

# Bing Search API endpoint
search_url = "https://api.bing.microsoft.com/v7.0/search"
Expand Down
2 changes: 1 addition & 1 deletion src/dbgpt_plugins/search_engine/google_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _google_search(query: str, num_results=8) -> str:
API_KEY = os.getenv("GOOGLE_API_KEY")
API_CX = os.getenv("GOOGLE_API_CX")
if API_KEY is None or API_CX is None:
raise ValueError("Please configure GOOGLE_API_KEY and GOOGLE_API_CX in .env first!")
raise ValueError("Please configure 'GOOGLE_API_KEY' and 'GOOGLE_API_CX' in .env first!")

# Bing Search API endpoint
search_url = f"https://www.googleapis.com/customsearch/v1?key={API_KEY}&q={query}&cx={API_CX}&start=0&num=10"
Expand Down