SiddarthaRachakonda commited on
Commit
ea9dc6f
1 Parent(s): 53023f3

fixed issues

Browse files
Files changed (3) hide show
  1. .gitignore +3 -0
  2. app/chains.py +6 -6
  3. app/data_indexing.py +10 -2
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ env.sh
2
+
3
+ test_request.py
app/chains.py CHANGED
@@ -31,12 +31,12 @@ history_chain = None
31
  # TODO: Let's construct the standalone_chain by piping standalone_prompt_formatted with the LLM
32
  standalone_chain = None
33
 
34
- input_1 = RunnablePassthrough.assign(new_question=standalone_chain)
35
- input_2 = {
36
- 'context': lambda x: format_context(data_indexer.search(x['new_question'])),
37
- 'standalone_question': lambda x: x['new_question']
38
- }
39
- input_to_rag_chain = input_1 | input_2
40
 
41
  # TODO: use input_to_rag_chain, rag_prompt_formatted,
42
  # HistoryInput and the LLM to build the rag_chain.
 
31
  # TODO: Let's construct the standalone_chain by piping standalone_prompt_formatted with the LLM
32
  standalone_chain = None
33
 
34
+ # input_1 = RunnablePassthrough.assign(new_question=standalone_chain)
35
+ # input_2 = {
36
+ # 'context': lambda x: format_context(data_indexer.search(x['new_question'])),
37
+ # 'standalone_question': lambda x: x['new_question']
38
+ # }
39
+ # input_to_rag_chain = input_1 | input_2
40
 
41
  # TODO: use input_to_rag_chain, rag_prompt_formatted,
42
  # HistoryInput and the LLM to build the rag_chain.
app/data_indexing.py CHANGED
@@ -27,11 +27,19 @@ class DataIndexer:
27
  if index_name not in self.pinecone_client.list_indexes().names():
28
  # TODO: create your index if it doesn't exist. Use the create_index function.
29
  # Make sure to choose the dimension that corresponds to your embedding model
30
- pass
 
 
 
 
 
 
 
 
31
 
32
  self.index = self.pinecone_client.Index(self.index_name)
33
  # TODO: make sure to build the index.
34
- self.source_index = None
35
 
36
  def get_source_index(self):
37
  if not os.path.isfile(self.source_file):
 
27
  if index_name not in self.pinecone_client.list_indexes().names():
28
  # TODO: create your index if it doesn't exist. Use the create_index function.
29
  # Make sure to choose the dimension that corresponds to your embedding model
30
+ self.pinecone_client.create_index(
31
+ name=self.index_name,
32
+ dimension=1536,
33
+ metric="cosine",
34
+ spec=ServerlessSpec(
35
+ cloud="aws",
36
+ region="us-east-1",
37
+ ),
38
+ )
39
 
40
  self.index = self.pinecone_client.Index(self.index_name)
41
  # TODO: make sure to build the index.
42
+ self.source_index = self.get_source_index()
43
 
44
  def get_source_index(self):
45
  if not os.path.isfile(self.source_file):