Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Merge branch 'master' into dev

Andres Caicedo239accbd8271
diff --cc scripts/browse.py
index 20ffc03527,510f9c29d5..3fde8d25d3
--- a/scripts/browse.py
+++ b/scripts/browse.py
@@@ -85,12 -74,19 +85,21 @@@ def split_text(text, max_length=8192)
yield "\n".join(current_chunk)
- def summarize_text(text, is_website=True):
- """Summarize text using GPT-3"""
- if text == "":
+ def create_message(chunk, question):
++ """Create a message for the user to summarize a chunk of text"""
+ return {
+ "role": "user",
+ "content": f"\"\"\"{chunk}\"\"\" Using the above text, please answer the following question: \"{question}\" -- if the question cannot be answered using the text, please summarize the text."
+ }
+
+ def summarize_text(text, question):
++ """Summarize text using the LLM model"""
+ if not text:
return "Error: No text to summarize"
- print("Text length: " + str(len(text)) + " characters")
+ text_length = len(text)
+ print(f"Text length: {text_length} characters")
+
summaries = []
chunks = list(split_text(text))
diff --cc scripts/commands.py
index 7873c048d7,ed789c8e92..5569f1d5b2
--- a/scripts/commands.py
+++ b/scripts/commands.py
@@@ -157,9 -152,8 +157,9 @@@ def google_official_search(query, num_r
# Return the list of search result URLs
return search_results_links
- def browse_website(url):
- """Return the results of a google search"""
- summary = get_text_summary(url)
+ def browse_website(url, question):
++ """Browse a website and return the summary and links"""
+ summary = get_text_summary(url, question)
links = get_hyperlinks(url)
# Limit links to 5
@@@ -171,10 -165,9 +171,10 @@@
return result
- def get_text_summary(url):
+ def get_text_summary(url, question):
+ """Return the results of a google search"""
text = browse.scrape_text(url)
- summary = browse.summarize_text(text)
+ summary = browse.summarize_text(text, question)
return """ "Result" : """ + summary