Spaces:
Sleeping
Sleeping
Update brave.py
Browse files
brave.py
CHANGED
|
@@ -149,7 +149,7 @@ def load_web_content(urls):
|
|
| 149 |
|
| 150 |
@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10))
|
| 151 |
def generate_detailed_explanation(query, context):
|
| 152 |
-
prompt = f"""Based on the following summarized context, provide a
|
| 153 |
Here's the topic: "{query}".
|
| 154 |
|
| 155 |
Use this Context to answer the above query:
|
|
@@ -157,12 +157,12 @@ def generate_detailed_explanation(query, context):
|
|
| 157 |
|
| 158 |
Important: Don't mention that you are answering based on the context. Just start with the main response. Avoid phrases like 'Based on the context provided, ...' etc.
|
| 159 |
|
| 160 |
-
|
| 161 |
|
| 162 |
try:
|
| 163 |
chat_completion = groq_client.chat.completions.create(
|
| 164 |
messages=[
|
| 165 |
-
{"role": "system", "content": "You are a knowledgeable assistant that provides
|
| 166 |
{"role": "user", "content": prompt}
|
| 167 |
],
|
| 168 |
model="llama-3.1-8b-instant",
|
|
|
|
| 149 |
|
| 150 |
@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10))
|
| 151 |
def generate_detailed_explanation(query, context):
|
| 152 |
+
prompt = f"""Based on the following summarized context, provide a good and easy to understand explanation of the topic. Make sure to incorporate all relevant details, facts, and figures from the context.
|
| 153 |
Here's the topic: "{query}".
|
| 154 |
|
| 155 |
Use this Context to answer the above query:
|
|
|
|
| 157 |
|
| 158 |
Important: Don't mention that you are answering based on the context. Just start with the main response. Avoid phrases like 'Based on the context provided, ...' etc.
|
| 159 |
|
| 160 |
+
Explanation:"""
|
| 161 |
|
| 162 |
try:
|
| 163 |
chat_completion = groq_client.chat.completions.create(
|
| 164 |
messages=[
|
| 165 |
+
{"role": "system", "content": "You are a knowledgeable assistant that provides good and easy to understand explanations on various topics, incorporating all relevant information from the given context."},
|
| 166 |
{"role": "user", "content": prompt}
|
| 167 |
],
|
| 168 |
model="llama-3.1-8b-instant",
|