Spaces:
Sleeping
Sleeping
John Graham Reynolds
commited on
Commit
·
d687543
1
Parent(s):
c1c75a4
pass date_str in chain for system prompt
Browse files
chain.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import mlflow
|
|
|
3 |
import streamlit as st
|
4 |
from operator import itemgetter
|
5 |
from langchain_huggingface import HuggingFaceEmbeddings
|
@@ -162,8 +163,8 @@ class ChainBuilder:
|
|
162 |
# RAG Chain
|
163 |
chain = (
|
164 |
{
|
165 |
-
|
166 |
-
"question": itemgetter("messages") | RunnableLambda(self.extract_user_query_string),
|
167 |
"chat_history": itemgetter("messages") | RunnableLambda(self.extract_chat_history),
|
168 |
"formatted_chat_history": itemgetter("messages")
|
169 |
| RunnableLambda(self.format_chat_history_for_prompt),
|
|
|
1 |
import os
|
2 |
import mlflow
|
3 |
+
import datetime
|
4 |
import streamlit as st
|
5 |
from operator import itemgetter
|
6 |
from langchain_huggingface import HuggingFaceEmbeddings
|
|
|
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")
|
170 |
| RunnableLambda(self.format_chat_history_for_prompt),
|