Skip to content

Commit

Permalink
Updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
COLONAYUSH committed May 18, 2023
1 parent c6d0e84 commit 5d3685d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
58 changes: 29 additions & 29 deletions superagi/helper/google_serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,33 @@ def get_result(self, query):

return snippets, webpages, links

# Replace with your actual SerpApi API key
api_key = '75ca64b9b25cd49faec4976fa63a93180425750a074824470518252d6c87fd02'

# Create an instance of GoogleSerpApiWrap
serp_api = GoogleSerpApiWrap(api_key)

# Define the search query
query = 'Python programming'

# Perform the search and retrieve the results
snippets, webpages, links = serp_api.get_result(query)

# Print the snippets
print("Snippets:")
for snippet in snippets:
print(snippet)
print()

# Print the extracted webpages
print("Webpages:")
for webpage in webpages:
print(webpage)
print()

# Print the links
print("Links:")
for link in links:
print(link)
print()
# # Replace with your actual SerpApi API key
# api_key = ''

# # Create an instance of GoogleSerpApiWrap
# serp_api = GoogleSerpApiWrap(api_key)

# # Define the search query
# query = 'Python programming'

# # Perform the search and retrieve the results
# snippets, webpages, links = serp_api.get_result(query)

# # Print the snippets
# print("Snippets:")
# for snippet in snippets:
# print(snippet)
# print()

# # Print the extracted webpages
# print("Webpages:")
# for webpage in webpages:
# print(webpage)
# print()

# # Print the links
# print("Links:")
# for link in links:
# print(link)
# print()

28 changes: 14 additions & 14 deletions superagi/tools/google_search/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ def execute(self, query: str) -> tuple:
return json.dumps(result)


# Import necessary modules
import os
import json
# # Import necessary modules
# import os
# import json

# Define the environment variables
os.environ["GOOGLE_API_KEY"] = "AIzaSyCinJK2sB7Ky-3DmmsSNWFn5leAwev-9Hs"
os.environ["SEARCH_ENGINE_ID"] = "e6fbba732ab9e49fd"
# # Define the environment variables
# os.environ["GOOGLE_API_KEY"] = ""
# os.environ["SEARCH_ENGINE_ID"] = ""

# Create an instance of GoogleSearchTool
google_search_tool = GoogleSearchTool()
# # Create an instance of GoogleSearchTool
# google_search_tool = GoogleSearchTool()

# Define the search query
query = "Python programming"
# # Define the search query
# query = "Python programming"

# Execute the Google search tool
result = google_search_tool.execute(query)
# # Execute the Google search tool
# result = google_search_tool.execute(query)

# Print the result
print(result)
# # Print the result
# print(result)

0 comments on commit 5d3685d

Please sign in to comment.