Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ co = cohere.Client(cohere_api_key)
|
|
30 |
@tool('DuckDuckGoSearchResults')
|
31 |
def search_results(search_query: str) -> dict:
|
32 |
"""Search the web for snippets and links on a given topic"""
|
33 |
-
return DuckDuckGoSearchResults(max_results=
|
34 |
|
35 |
@tool('WebScrapper')
|
36 |
def web_scrapper(url: str, topic: str) -> str:
|
@@ -40,14 +40,14 @@ def web_scrapper(url: str, topic: str) -> str:
|
|
40 |
content = scraper.run()
|
41 |
|
42 |
# Prepare the prompt for generating the summary
|
43 |
-
prompt = f"Generate a summary of the following content on the topic ## {topic} ### \n\nCONTENT:\n\n" + content
|
44 |
|
45 |
# Generate the summary using Cohere
|
46 |
response = co.chat(
|
47 |
model='command-r-plus',
|
48 |
message=prompt,
|
49 |
temperature=0.2,
|
50 |
-
max_tokens=
|
51 |
chat_history=[],
|
52 |
prompt_truncation='AUTO'
|
53 |
)
|
@@ -130,7 +130,8 @@ def kickoff_crew(topic: str) -> dict:
|
|
130 |
"Review and refine the initial draft report from the research task. Organize the content logically to enhance information flow. "
|
131 |
"Verify the accuracy of all data, correct discrepancies, and update information to ensure it reflects current knowledge and is well-supported by sources. "
|
132 |
"Improve the report’s readability by enhancing language clarity, adjusting sentence structures, and maintaining a consistent tone. "
|
133 |
-
"Include a section listing all sources used, formatted as bullet points
|
|
|
134 |
),
|
135 |
expected_output=(
|
136 |
"A polished, comprehensive report on topic ## {topic} ##, with a clear, professional narrative that accurately reflects the research findings. "
|
|
|
30 |
@tool('DuckDuckGoSearchResults')
|
31 |
def search_results(search_query: str) -> dict:
|
32 |
"""Search the web for snippets and links on a given topic"""
|
33 |
+
return DuckDuckGoSearchResults(max_results=10).run(search_query)
|
34 |
|
35 |
@tool('WebScrapper')
|
36 |
def web_scrapper(url: str, topic: str) -> str:
|
|
|
40 |
content = scraper.run()
|
41 |
|
42 |
# Prepare the prompt for generating the summary
|
43 |
+
prompt = f"Generate a summary of the following content on the topic ## {topic} ### \n\nCONTENT:\n\n" + content + "\nFollow this template:\n- Title:\nURL:\nSummary:"
|
44 |
|
45 |
# Generate the summary using Cohere
|
46 |
response = co.chat(
|
47 |
model='command-r-plus',
|
48 |
message=prompt,
|
49 |
temperature=0.2,
|
50 |
+
max_tokens=500,
|
51 |
chat_history=[],
|
52 |
prompt_truncation='AUTO'
|
53 |
)
|
|
|
130 |
"Review and refine the initial draft report from the research task. Organize the content logically to enhance information flow. "
|
131 |
"Verify the accuracy of all data, correct discrepancies, and update information to ensure it reflects current knowledge and is well-supported by sources. "
|
132 |
"Improve the report’s readability by enhancing language clarity, adjusting sentence structures, and maintaining a consistent tone. "
|
133 |
+
"Include a section listing all sources used, formatted as bullet points following this template: "
|
134 |
+
"- title: url'."
|
135 |
),
|
136 |
expected_output=(
|
137 |
"A polished, comprehensive report on topic ## {topic} ##, with a clear, professional narrative that accurately reflects the research findings. "
|