Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ embeddings = OpenAIEmbeddings(api_key=os.environ['OPENAI_API_KEY'])
|
|
33 |
|
34 |
# Initialize Redis Vector Store with Hugging Face embeddings
|
35 |
vector_store = RedisVectorStore(embeddings, config=config)
|
36 |
-
retriever = vector_store.as_retriever(search_type="similarity", search_kwargs={"k":
|
37 |
|
38 |
|
39 |
# Define the language model
|
@@ -45,7 +45,7 @@ prompt = ChatPromptTemplate.from_messages(
|
|
45 |
(
|
46 |
"human",
|
47 |
"""You’re Annie a country music voicebot, a charming media personality created by Amit Lamba, guiding people around Birmingham, Alabama.You’re here to give friendly, concise, and accurate advice with a dash of humor in short one or two sentences.
|
48 |
-
|
49 |
Question: {question}
|
50 |
Context: {context}
|
51 |
Answer:""",
|
@@ -53,7 +53,7 @@ Answer:""",
|
|
53 |
]
|
54 |
)
|
55 |
|
56 |
-
|
57 |
|
58 |
def format_docs(docs):
|
59 |
return "\n\n".join(doc.page_content for doc in docs)
|
@@ -66,7 +66,7 @@ rag_chain = (
|
|
66 |
)
|
67 |
|
68 |
|
69 |
-
|
70 |
|
71 |
|
72 |
|
|
|
33 |
|
34 |
# Initialize Redis Vector Store with Hugging Face embeddings
|
35 |
vector_store = RedisVectorStore(embeddings, config=config)
|
36 |
+
retriever = vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5})
|
37 |
|
38 |
|
39 |
# Define the language model
|
|
|
45 |
(
|
46 |
"human",
|
47 |
"""You’re Annie a country music voicebot, a charming media personality created by Amit Lamba, guiding people around Birmingham, Alabama.You’re here to give friendly, concise, and accurate advice with a dash of humor in short one or two sentences.
|
48 |
+
Be conversational, like chatting with a clever friend, and encourage follow-up questions to create a smooth flow. Make users smile and deliver a delightful, using new country experience—like a perfect dessert after a great meal.
|
49 |
Question: {question}
|
50 |
Context: {context}
|
51 |
Answer:""",
|
|
|
53 |
]
|
54 |
)
|
55 |
|
56 |
+
#
|
57 |
|
58 |
def format_docs(docs):
|
59 |
return "\n\n".join(doc.page_content for doc in docs)
|
|
|
66 |
)
|
67 |
|
68 |
|
69 |
+
#
|
70 |
|
71 |
|
72 |
|