Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,6 +134,18 @@ def generate_full_text_query(input: str) -> str:
|
|
| 134 |
full_text_query += f" {words[-1]}~2"
|
| 135 |
return full_text_query.strip()
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
# Function to generate a response using the prompt and the context
|
| 138 |
def generate_response_with_prompt(context, question):
|
| 139 |
formatted_prompt = prompt.format(context=context, question=question)
|
|
|
|
| 134 |
full_text_query += f" {words[-1]}~2"
|
| 135 |
return full_text_query.strip()
|
| 136 |
|
| 137 |
+
|
| 138 |
+
# Define the template for generating responses based on context
|
| 139 |
+
template = """I am a guide for Birmingham, Alabama. I can provide recommendations and insights about the city, including events and activities.
|
| 140 |
+
Ask your question directly, and I'll provide a precise and quick,short and crisp response in a conversational and straight-foreward way without any Greet.
|
| 141 |
+
Context:
|
| 142 |
+
{context}
|
| 143 |
+
Question: {question}
|
| 144 |
+
Answer concisely:"""
|
| 145 |
+
|
| 146 |
+
# Create a prompt object using the template
|
| 147 |
+
prompt = ChatPromptTemplate.from_template(template)
|
| 148 |
+
|
| 149 |
# Function to generate a response using the prompt and the context
|
| 150 |
def generate_response_with_prompt(context, question):
|
| 151 |
formatted_prompt = prompt.format(context=context, question=question)
|