wibboweaver commited on
Commit
e6d285a
·
1 Parent(s): 1261548

Updated requirements and added Chroma

Browse files
.streamlit/config.toml CHANGED
@@ -9,3 +9,24 @@
9
  [logger]
10
  level = 'INFO'
11
  format = '{time:YYYY MM DD HH:MM:SS} | {level} | {function} | Line {line} | {message}'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  [logger]
10
  level = 'INFO'
11
  format = '{time:YYYY MM DD HH:MM:SS} | {level} | {function} | Line {line} | {message}'
12
+
13
+ [llama]
14
+ pc_host = 'https://legal-b8ccca3.svc.aped-4627-b74a.pinecone.io'
15
+ pc_region = 'us-east-1'
16
+ pc_index_name = 'legal'
17
+
18
+ [DATA]
19
+ folder = './data' # Files in this folder will be processed
20
+ chunk_size = 300 # Size of text chunks
21
+ overlap = 25 # The amount by which text chunks overlap
22
+ parser = ['\n\n', '\n', '(?<=\. )', ' ', '']
23
+
24
+ [MODELS]
25
+ embed_model = 'text-embedding-ada-002' # The model with which to create embeddings
26
+ batch_size = 100 # The embeddings batch size
27
+ openai_model = 'gpt-3.5-turbo' # A general LLM for compiling responses
28
+ temperature = 0 # The temperature to use when responding
29
+
30
+ [CHROMA]
31
+ pdf_file = './data/sga.pdf'
32
+ chroma_dir = 'docs/chroma/'
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import toml
3
  import utils as ut
4
- from views.pages import WelcomePage, FirstPage
5
 
6
  st.set_page_config(page_title="GenAI Demo", layout="wide")
7
 
@@ -21,7 +21,7 @@ def update_ui() -> None:
21
  # Dictionary of application views (pages).
22
  page_map = {
23
  'Home Page': WelcomePage(),
24
- 'RAG Demo': FirstPage(),
25
  # Add pages here as required
26
  }
27
 
 
1
  import streamlit as st
2
  import toml
3
  import utils as ut
4
+ from views.pages import WelcomePage, RAGDemo
5
 
6
  st.set_page_config(page_title="GenAI Demo", layout="wide")
7
 
 
21
  # Dictionary of application views (pages).
22
  page_map = {
23
  'Home Page': WelcomePage(),
24
+ 'RAG Demo': RAGDemo(),
25
  # Add pages here as required
26
  }
27
 
data/sga.pdf ADDED
Binary file (590 kB). View file
 
langutils.py → models/md_RAGDemo.py RENAMED
@@ -1,6 +1,4 @@
1
  import os
2
- import openai
3
- import sys
4
  from dotenv import load_dotenv
5
  from langchain_community.document_loaders import PyPDFLoader
6
  from langchain_community.embeddings import OpenAIEmbeddings
@@ -54,8 +52,8 @@ class LangUtils:
54
  return self.returned_chunks
55
 
56
 
57
- config = toml.load('.streamlit/config.toml')
58
- lc = LangUtils(config, './data/sga.pdf')
59
  # lc.store_pdf_vectors()
60
  docs = lc.get_relevant_chunks('what is the sale of goods act', 3)
61
 
 
1
  import os
 
 
2
  from dotenv import load_dotenv
3
  from langchain_community.document_loaders import PyPDFLoader
4
  from langchain_community.embeddings import OpenAIEmbeddings
 
52
  return self.returned_chunks
53
 
54
 
55
+ config = toml.load('../.streamlit/config.toml')
56
+ lc = LangUtils(config, '../data/sga.pdf')
57
  # lc.store_pdf_vectors()
58
  docs = lc.get_relevant_chunks('what is the sale of goods act', 3)
59
 
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
 
views/pages.py CHANGED
@@ -29,7 +29,7 @@ class WelcomePage(Page):
29
  st.write('Generative AI Demonstrations')
30
 
31
 
32
- class FirstPage(Page):
33
  def __init_(self):
34
  super().__init__()
35
  self.fp = Fp
@@ -42,6 +42,9 @@ class FirstPage(Page):
42
  st.write('Interact with a selected PDF file ')
43
 
44
  file = st.sidebar.file_uploader("Choose a PDF file", type="pdf")
 
 
 
45
 
46
  if file:
47
  binary_data = file.getvalue()
 
29
  st.write('Generative AI Demonstrations')
30
 
31
 
32
+ class RAGDemo(Page):
33
  def __init_(self):
34
  super().__init__()
35
  self.fp = Fp
 
42
  st.write('Interact with a selected PDF file ')
43
 
44
  file = st.sidebar.file_uploader("Choose a PDF file", type="pdf")
45
+ chunk_size = st.sidebar.slider('Chunk size', 200, 1000, 250)
46
+ overlap = st.sidebar.slider('Overlap', 10, 100, 30)
47
+ k_items = st.sidebar.slider('Matching chunks', 1, 10, 4)
48
 
49
  if file:
50
  binary_data = file.getvalue()