Spaces:
Sleeping
Sleeping
John Graham Reynolds
commited on
Commit
·
806b1ef
1
Parent(s):
07b0d8d
move date to another location
Browse files
chain.py
CHANGED
@@ -166,7 +166,6 @@ class ChainBuilder:
|
|
166 |
# RAG Chain
|
167 |
chain = (
|
168 |
{
|
169 |
-
"date_str": RunnableLambda(get_date), # date to be passed to system prompt for context of when knowledge base was last updated
|
170 |
"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()
|
171 |
"chat_history": itemgetter("messages") | RunnableLambda(self.extract_chat_history),
|
172 |
"formatted_chat_history": itemgetter("messages")
|
@@ -184,7 +183,8 @@ class ChainBuilder:
|
|
184 |
| self.get_retriever() # set 'context' to the result of passing either the base question, or the reformatted question to the retriever for semantic search
|
185 |
| RunnableLambda(self.format_context),
|
186 |
"formatted_chat_history": itemgetter("formatted_chat_history"),
|
187 |
-
"question": itemgetter("question")
|
|
|
188 |
}
|
189 |
| self.get_prompt() # 'context', 'formatted_chat_history', and 'question' passed to prompt
|
190 |
| self.get_model() # prompt passed to model
|
|
|
166 |
# RAG Chain
|
167 |
chain = (
|
168 |
{
|
|
|
169 |
"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()
|
170 |
"chat_history": itemgetter("messages") | RunnableLambda(self.extract_chat_history),
|
171 |
"formatted_chat_history": itemgetter("messages")
|
|
|
183 |
| self.get_retriever() # set 'context' to the result of passing either the base question, or the reformatted question to the retriever for semantic search
|
184 |
| RunnableLambda(self.format_context),
|
185 |
"formatted_chat_history": itemgetter("formatted_chat_history"),
|
186 |
+
"question": itemgetter("question"),
|
187 |
+
"date_str": RunnableLambda(get_date), # date to be passed to system prompt for context of when knowledge base was last updated
|
188 |
}
|
189 |
| self.get_prompt() # 'context', 'formatted_chat_history', and 'question' passed to prompt
|
190 |
| self.get_model() # prompt passed to model
|