Shreyas094 commited on
Commit
6e35de4
·
verified ·
1 Parent(s): 91260de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -146,11 +146,11 @@ def create_web_search_vectors(search_results):
146
  def summarize_article(article, model, system_prompt, user_query, client, temperature=0.2):
147
  prompt = f"""Using the following article:
148
  Title: {article['title']}
149
- Content: {article['body']}
150
  URL: {article['href']}
151
-
152
- Write a concise summary that addresses the following user query: '{user_query}'
153
- """
154
 
155
  # Calculate input tokens (this is an approximation, you might need a more accurate method)
156
  input_tokens = len(prompt.split()) // 4
 
146
  def summarize_article(article, model, system_prompt, user_query, client, temperature=0.2):
147
  prompt = f"""Using the following article:
148
  Title: {article['title']}
149
+ Content (excerpt): {article['body'][:2000]} # Truncate if too long
150
  URL: {article['href']}
151
+ Using the following context from web search results (excerpt):
152
+ {content[:2000]} # Truncate if too long
153
+ Write a detailed and complete research document that includes an introduction, key findings, and a conclusion that addresses the following user request: '{query}'."""
154
 
155
  # Calculate input tokens (this is an approximation, you might need a more accurate method)
156
  input_tokens = len(prompt.split()) // 4