Spaces:
Sleeping
Sleeping
John Graham Reynolds
commited on
Commit
·
80dda63
1
Parent(s):
d687543
move date string to just before prompt() and template it is used in- looks like passing str into RunnablePassthrough() is erroneous
Browse files
chain.py
CHANGED
@@ -163,7 +163,6 @@ class ChainBuilder:
|
|
163 |
# RAG Chain
|
164 |
chain = (
|
165 |
{
|
166 |
-
"date_str": datetime.datetime.now().strftime("%B %d, %Y"), # date to be passed to system prompt for context of when knowledge base was last updated
|
167 |
"question": itemgetter("messages") | RunnableLambda(self.extract_user_query_string), # set 'question' to the result of: grabbing the ["messages"] component of the dict we 'invoke()' or 'stream()', then passing to extract_user_query_string()
|
168 |
"chat_history": itemgetter("messages") | RunnableLambda(self.extract_chat_history),
|
169 |
"formatted_chat_history": itemgetter("messages")
|
@@ -182,6 +181,7 @@ class ChainBuilder:
|
|
182 |
| RunnableLambda(self.format_context),
|
183 |
"formatted_chat_history": itemgetter("formatted_chat_history"),
|
184 |
"question": itemgetter("question"),
|
|
|
185 |
}
|
186 |
| self.get_prompt() # 'context', 'formatted_chat_history', and 'question' passed to prompt
|
187 |
| self.get_model() # prompt passed to model
|
|
|
163 |
# RAG Chain
|
164 |
chain = (
|
165 |
{
|
|
|
166 |
"question": itemgetter("messages") | RunnableLambda(self.extract_user_query_string), # set 'question' to the result of: grabbing the ["messages"] component of the dict we 'invoke()' or 'stream()', then passing to extract_user_query_string()
|
167 |
"chat_history": itemgetter("messages") | RunnableLambda(self.extract_chat_history),
|
168 |
"formatted_chat_history": itemgetter("messages")
|
|
|
181 |
| RunnableLambda(self.format_context),
|
182 |
"formatted_chat_history": itemgetter("formatted_chat_history"),
|
183 |
"question": itemgetter("question"),
|
184 |
+
"date_str": datetime.datetime.now().strftime("%B %d, %Y"), # date to be passed to system prompt for context of when knowledge base was last updated
|
185 |
}
|
186 |
| self.get_prompt() # 'context', 'formatted_chat_history', and 'question' passed to prompt
|
187 |
| self.get_model() # prompt passed to model
|