-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v34.96; add Google searches into ChatGPT responses
- Loading branch information
1 parent
2223468
commit 8a89040
Showing
8 changed files
with
78 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
34.95 | ||
34.96 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import config, json, googlesearch | ||
|
||
# Use google https://pypi.org/project/googlesearch-python/ to search internet for information, about which ChatGPT doesn't know. | ||
|
||
def get_internet_info(function_args): | ||
# retrieve argument values from a dictionary | ||
#print(function_args) | ||
keywords = function_args.get("keywords") # required | ||
|
||
news = {} | ||
for index, item in enumerate(googlesearch.search(keywords, advanced=True, num_results=config.chatGPTApiMaximumInternetSearchResults)): | ||
news[f"result {index}"] = { | ||
"title": item.title, | ||
"url": item.url, | ||
"description": item.description, | ||
} | ||
return json.dumps(news) | ||
|
||
functionSignature = { | ||
"name": "get_internet_info", | ||
"description": "Search internet for keywords when ChatGPT does not have information", | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"keywords": { | ||
"type": "string", | ||
"description": "keywords for searches, e.g. ChatGPT", | ||
}, | ||
}, | ||
"required": ["keywords"], | ||
}, | ||
} | ||
|
||
config.chatGPTApiFunctionSignatures.append(functionSignature) | ||
config.chatGPTApiAvailableFunctions["get_internet_info"] = get_internet_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters