nagesh5 commited on
Commit
4ecf86d
·
verified ·
1 Parent(s): 5752744

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -149,7 +149,21 @@ def expand_query(state: AgentState) -> AgentState:
149
  state['expanded_query'] = chain.invoke({"query": state['query'], "question": state['query'], "query_feedback": state.get('query_feedback', '')}) # Pass all required variables
150
  return state
151
 
 
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  def retrieve_context(state: AgentState) -> AgentState:
155
  """
 
149
  state['expanded_query'] = chain.invoke({"query": state['query'], "question": state['query'], "query_feedback": state.get('query_feedback', '')}) # Pass all required variables
150
  return state
151
 
152
+ db_loc = 'nutritional_db'
153
 
154
+ # Initialize the Chroma vector store for retrieving documents
155
+ vector_store = Chroma(
156
+ collection_name="nutritional_hypotheticals",
157
+ persist_directory=db_loc,
158
+ embedding_function=embedding_model
159
+
160
+ )
161
+
162
+ # Create a retriever from the vector store
163
+ retriever = vector_store.as_retriever(
164
+ search_type='similarity',
165
+ search_kwargs={'k': 3}
166
+ )
167
 
168
  def retrieve_context(state: AgentState) -> AgentState:
169
  """