Asaad Almutareb commited on
Commit
7be5589
1 Parent(s): 710401a

added a local cache

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +2 -1
  3. hf_mixtral_agent.py +3 -0
.gitignore CHANGED
@@ -171,3 +171,4 @@ obj
171
  *.zip
172
  *.faiss
173
  *.pkl
 
 
171
  *.zip
172
  *.faiss
173
  *.pkl
174
+ *.db
app.py CHANGED
@@ -61,7 +61,7 @@ if __name__ == "__main__":
61
  metadatas=[
62
  {
63
  "human_message":history[-1][0],
64
- "sources": src_list
65
  }
66
  ]
67
  )
@@ -70,6 +70,7 @@ if __name__ == "__main__":
70
  else:
71
  response_w_sources = response['output']+"\n\n\n Sources: \n\n\n"+src_list
72
  history[-1][1] = response_w_sources
 
73
  return history
74
 
75
  def infer(question, history):
 
61
  metadatas=[
62
  {
63
  "human_message":history[-1][0],
64
+ "sources": 'Internal Knowledge Base From: \n\n' + src_list
65
  }
66
  ]
67
  )
 
70
  else:
71
  response_w_sources = response['output']+"\n\n\n Sources: \n\n\n"+src_list
72
  history[-1][1] = response_w_sources
73
+ all_sources.clear()
74
  return history
75
 
76
  def infer(question, history):
hf_mixtral_agent.py CHANGED
@@ -14,7 +14,10 @@ from innovation_pathfinder_ai.structured_tools.structured_tools import (
14
  from langchain.prompts import PromptTemplate
15
  from innovation_pathfinder_ai.templates.react_json_with_memory import template_system
16
  from innovation_pathfinder_ai.utils import logger
 
 
17
 
 
18
  logger = logger.get_console_logger("hf_mixtral_agent")
19
 
20
  config = load_dotenv(".env")
 
14
  from langchain.prompts import PromptTemplate
15
  from innovation_pathfinder_ai.templates.react_json_with_memory import template_system
16
  from innovation_pathfinder_ai.utils import logger
17
+ from langchain.globals import set_llm_cache
18
+ from langchain.cache import SQLiteCache
19
 
20
+ set_llm_cache(SQLiteCache(database_path=".cache.db"))
21
  logger = logger.get_console_logger("hf_mixtral_agent")
22
 
23
  config = load_dotenv(".env")