raghavNCI
commited on
Commit
·
9d31665
1
Parent(s):
0f20317
changes v6
Browse files- question.py +3 -1
question.py
CHANGED
@@ -33,13 +33,15 @@ async def ask_question(input: QuestionInput):
|
|
33 |
query_string = " AND ".join(f'"{kw}"' for kw in keywords[:7])
|
34 |
encoded_query = quote_plus(query_string)
|
35 |
|
36 |
-
gnews_url = f"https://gnews.io/api/v4/search?q={
|
37 |
try:
|
38 |
response = requests.get(gnews_url, timeout=10)
|
39 |
response.raise_for_status()
|
40 |
articles = response.json().get("articles", [])
|
41 |
except Exception as e:
|
42 |
return {"error": f"GNews API error: {str(e)}"}
|
|
|
|
|
43 |
|
44 |
context = "\n\n".join([
|
45 |
article.get("content") or article.get("description") or ""
|
|
|
33 |
query_string = " AND ".join(f'"{kw}"' for kw in keywords[:7])
|
34 |
encoded_query = quote_plus(query_string)
|
35 |
|
36 |
+
gnews_url = f"https://gnews.io/api/v4/search?q={query_string}&lang=en&max=3&expand=content&token={GNEWS_API_KEY}"
|
37 |
try:
|
38 |
response = requests.get(gnews_url, timeout=10)
|
39 |
response.raise_for_status()
|
40 |
articles = response.json().get("articles", [])
|
41 |
except Exception as e:
|
42 |
return {"error": f"GNews API error: {str(e)}"}
|
43 |
+
|
44 |
+
print("the articles are", articles)
|
45 |
|
46 |
context = "\n\n".join([
|
47 |
article.get("content") or article.get("description") or ""
|