John Graham Reynolds commited on
Commit
ee63f07
·
1 Parent(s): 6e20b16

format history to encode a messages object of all past user and assistant messages as input

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -139,11 +139,13 @@ def chain_call(history):
139
  {'content': 'Can you tell me more about how they are used?', 'role': 'user'},
140
  {'content': 'At Vanderbilt University Medical Center, a data lake is used as a centralized repository for storing and managing large amounts of data in its native format. This allows for the data to be easily accessed and analyzed by different teams and business units within the organization. The data lake also provides functionalities such as data analysis, machine learning, cataloging and data movement, making it a versatile tool for handling diverse data sets.\n\nAn Enterprise Data Warehouse (EDW) is used for executing analytic queries on structured data. It is optimized for this purpose, with data being stored in a way that allows for efficient querying and analysis. This makes it a useful tool for teams that need to perform complex analyses on large data sets.\n\nA data mart is a specific organizational structure or pattern used in the context of data warehouses. It is a layer that has specific subdivisions for each business unit or team, such as finance, marketing, and product. This allows users to consume data in a format that meets their specific needs.\n\nA data lakehouse is a term used to describe approaches that attempt to combine the data structure and management features of a data warehouse with the low cost of storage of a data lake. This includes a structured transactional layer, which allows for efficient querying and analysis of data. This approach aims to provide the benefits of both data lakes and data warehouses in a single platform.', 'role': 'assistant'},
141
  {'content': 'Nice answer. Can you tell me what the HCERA is?', 'role': 'user'}]}
 
 
142
 
143
- st.write(history)
144
  # search_result = vector_store.similarity_search(query=st.session_state["messages"][-1]["content"], k=5)
145
  # chat_completion = search_result # TODO update this after we implement our chain
146
- chat_completion = chain.invoke(input_example) # *** TODO here we will pass only the chat history, the chain handles the system prompt
 
147
  return chat_completion
148
 
149
  def write_response():
 
139
  {'content': 'Can you tell me more about how they are used?', 'role': 'user'},
140
  {'content': 'At Vanderbilt University Medical Center, a data lake is used as a centralized repository for storing and managing large amounts of data in its native format. This allows for the data to be easily accessed and analyzed by different teams and business units within the organization. The data lake also provides functionalities such as data analysis, machine learning, cataloging and data movement, making it a versatile tool for handling diverse data sets.\n\nAn Enterprise Data Warehouse (EDW) is used for executing analytic queries on structured data. It is optimized for this purpose, with data being stored in a way that allows for efficient querying and analysis. This makes it a useful tool for teams that need to perform complex analyses on large data sets.\n\nA data mart is a specific organizational structure or pattern used in the context of data warehouses. It is a layer that has specific subdivisions for each business unit or team, such as finance, marketing, and product. This allows users to consume data in a format that meets their specific needs.\n\nA data lakehouse is a term used to describe approaches that attempt to combine the data structure and management features of a data warehouse with the low cost of storage of a data lake. This includes a structured transactional layer, which allows for efficient querying and analysis of data. This approach aims to provide the benefits of both data lakes and data warehouses in a single platform.', 'role': 'assistant'},
141
  {'content': 'Nice answer. Can you tell me what the HCERA is?', 'role': 'user'}]}
142
+
143
+ input = {'messages': [{"role": m["role"], "content": m["content"]} for m in history]}
144
 
 
145
  # search_result = vector_store.similarity_search(query=st.session_state["messages"][-1]["content"], k=5)
146
  # chat_completion = search_result # TODO update this after we implement our chain
147
+ # chat_completion = chain.invoke(input_example) # *** TODO here we will pass only the chat history, the chain handles the system prompt
148
+ chat_completion = chain.invoke(input)
149
  return chat_completion
150
 
151
  def write_response():