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.

remove summary.py from this branch to avoid merge conflict

HDKillerfbe1b0e5b004
diff --cc autogpt/commands/web_requests.py
index 00ec7ec358,59c3e5229f..d36e30ea01
--- a/autogpt/commands/web_requests.py
+++ b/autogpt/commands/web_requests.py
@@@ -145,54 -192,7 +192,7 @@@ 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'
+ "content": f'"""{chunk}""" Using the above text, answer the following'
f' question: "{question}" -- if the question cannot be answered using the'
- " text, please summarize the text.",
+ " text, summarize the text.",
}
-
-
- def summarize_text(url, text, question):
- """Summarize text using the LLM model"""
- if not text:
- return "Error: No text to summarize"
-
- text_length = len(text)
- print(f"Text length: {text_length} characters")
-
- summaries = []
- chunks = list(split_text(text))
-
- for i, chunk in enumerate(chunks):
- print(f"Adding chunk {i + 1} / {len(chunks)} to memory")
-
- memory_to_add = f"Source: {url}\n" f"Raw content part#{i + 1}: {chunk}"
-
- memory.add(memory_to_add)
-
- print(f"Summarizing chunk {i + 1} / {len(chunks)}")
- messages = [create_message(chunk, question)]
-
- summary = create_chat_completion(
- model=cfg.fast_llm_model,
- messages=messages,
- max_tokens=cfg.browse_summary_max_token,
- )
- summaries.append(summary)
- print(f"Added chunk {i + 1} summary to memory")
-
- memory_to_add = f"Source: {url}\n" f"Content summary part#{i + 1}: {summary}"
-
- memory.add(memory_to_add)
-
- print(f"Summarized {len(chunks)} chunks.")
-
- combined_summary = "\n".join(summaries)
- messages = [create_message(combined_summary, question)]
-
- final_summary = create_chat_completion(
- model=cfg.fast_llm_model,
- messages=messages,
- max_tokens=cfg.browse_summary_max_token,
- )
-
- return final_summary