Hey everyone, does anyone know when Generative AI Studio will have access to the internet?
When I prompted Generative AI Studio with "When did the Queen died?", its giving me silly answers, so this tells me Generative AI Studio doesn't currently have access to the internet (unlike Google Bard which has access to the internet).
If Generative AI Studio isn't having this feature anytime soon, what's the best way for me to add this feature into my Python code?
Would really appreciate if anyone can give any pointers. Thanks!
Solved! Go to Solution.
There is no public information about when Generative AI Studio will have access to the internet. However, you can add this feature to your Python code by using a library like Google Search API or DuckDuckGo API. These libraries allow you to search the internet and get the results back in JSON format. You can then use this JSON data to provide more accurate and up-to-date information to Generative AI Studio.
Here is an example of how you can use Google Search API to add internet access to Generative AI Studio:
import googlesearch def get_internet_info(query): """Gets information from the internet about the given query.""" results = googlesearch.search(query, num_results=1) return results[0].url def generate_text(prompt, internet_info): """Generates text using Generative AI Studio with internet access.""" return gca.generate_text(prompt, internet_info) if __name__ == "__main__": query = "When did the Queen died?" internet_info = get_internet_info(query) text = generate_text(query, internet_info) print(text)
This code will first use Google Search API to get the URL of the first search result for the given query. It will then use this URL to provide internet access to Generative AI Studio. Finally, it will generate text using Generative AI Studio with internet access.
You can also use other libraries like DuckDuckGo API to add internet access to Generative AI Studio. The process is similar to using Google Search API.
There is no public information about when Generative AI Studio will have access to the internet. However, you can add this feature to your Python code by using a library like Google Search API or DuckDuckGo API. These libraries allow you to search the internet and get the results back in JSON format. You can then use this JSON data to provide more accurate and up-to-date information to Generative AI Studio.
Here is an example of how you can use Google Search API to add internet access to Generative AI Studio:
import googlesearch def get_internet_info(query): """Gets information from the internet about the given query.""" results = googlesearch.search(query, num_results=1) return results[0].url def generate_text(prompt, internet_info): """Generates text using Generative AI Studio with internet access.""" return gca.generate_text(prompt, internet_info) if __name__ == "__main__": query = "When did the Queen died?" internet_info = get_internet_info(query) text = generate_text(query, internet_info) print(text)
This code will first use Google Search API to get the URL of the first search result for the given query. It will then use this URL to provide internet access to Generative AI Studio. Finally, it will generate text using Generative AI Studio with internet access.
You can also use other libraries like DuckDuckGo API to add internet access to Generative AI Studio. The process is similar to using Google Search API.
Many thanks for the above!
Can I ask what is gca in your code below?
import googlesearch
def get_internet_info(query):
"""Gets information from the internet about the given query."""
results = googlesearch.search(query, num_results=1)
return results[0].url
def generate_text(prompt, internet_info):
"""Generates text using Generative AI Studio with internet access."""
return gca.generate_text(prompt, internet_info)
if __name__ == "__main__":
query = "When did the Queen died?"
internet_info = get_internet_info(query)
text = generate_text(query, internet_info)
print(text)
Do you also happen to know if there is a way in your code above to enable a user to specify/filter a date to only look at posts which are posted on that date? I am thinking this may be possible because when you go onto Google's page and search for something, on the next page where it's displaying all the searched links, on the top right there is a "Tools" button that you can click on -> click "Any Time" -> click "Custom range" and this will let you specify the date of all the links that was posted on a particular date (see screenshot below).
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |