Zethris-Temporal-Loom commited on
Commit
9c4c771
·
1 Parent(s): 39b9870

Added app.py requirements.txt and input files and static folder

Browse files
.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ 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
31
+ -----END CERTIFICATE-----
app.py CHANGED
@@ -1,64 +1,839 @@
 
 
 
 
 
 
 
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
  def respond(
11
- message,
12
- history: list[tuple[str, str]],
13
- system_message,
14
- max_tokens,
15
- temperature,
16
- top_p,
 
17
  ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  messages = [{"role": "system", "content": system_message}]
19
 
20
- for val in history:
21
- if val[0]:
22
- messages.append({"role": "user", "content": val[0]})
23
- if val[1]:
24
- messages.append({"role": "assistant", "content": val[1]})
 
 
 
25
 
 
26
  messages.append({"role": "user", "content": message})
27
 
28
- response = ""
 
 
 
29
 
30
- for message in client.chat_completion(
31
- messages,
32
- max_tokens=max_tokens,
33
- stream=True,
34
- temperature=temperature,
35
- top_p=top_p,
36
- ):
37
- token = message.choices[0].delta.content
38
 
39
- response += token
40
- yield response
 
 
41
 
 
 
 
 
 
42
 
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
- demo = gr.ChatInterface(
47
- respond,
48
- additional_inputs=[
49
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
50
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
51
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
52
- gr.Slider(
53
- minimum=0.1,
54
- maximum=1.0,
55
- value=0.95,
56
- step=0.05,
57
- label="Top-p (nucleus sampling)",
58
- ),
59
- ],
60
- )
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  if __name__ == "__main__":
64
- demo.launch()
 
 
 
1
+ import hashlib
2
+ import os
3
+ from abc import ABC, abstractmethod
4
+ from glob import glob
5
+ from typing import Union
6
+ from uuid import uuid4
7
+ import faiss
8
  import gradio as gr
9
+ import numpy as np
10
+ import openai
11
+ import torch
12
+ from langchain_community.docstore.in_memory import InMemoryDocstore
13
+ from langchain_community.document_loaders import (BSHTMLLoader, CSVLoader,
14
+ JSONLoader, PyPDFLoader,
15
+ TextLoader)
16
+ from langchain_community.vectorstores import FAISS
17
+ from langchain_core.documents import Document
18
+ from sentence_transformers import SentenceTransformer
19
+ from transformers import AutoModel, AutoTokenizer
20
+ import os
21
+ from groq import Groq
22
+ from dotenv import load_dotenv
23
+ import time
24
 
25
+ import json
26
+ import os
27
+ load_dotenv()
28
+ INDEX_PATH = os.path.join(os.getcwd(), "static")
29
+
30
+
31
+ print(INDEX_PATH)
32
+
33
+
34
+
35
+ pdf_prompt = """
36
+ You are a helpful Employee Handbook assistant, designed to provide concise, accurate, and relevant information from folio3 (our company) internal handbook. Your role is to answer questions clearly, focusing on one topic at a time while remaining formal yet personable.
37
+
38
+ Tone: Maintain a formal tone suited for office communication, but ensure it’s friendly and approachable to foster engagement.
39
+
40
+ Responses:
41
+
42
+ Always greet the user warmly.
43
+
44
+ Provide brief answers when possible, but if the user asks follow-up questions, offer more detailed explanations.
45
+
46
+ If the user asks multiple questions, respond to each briefly, ensuring clarity without overwhelming the user.
47
+
48
+
49
+ Numeric Data: Always bold numerical information such as expenses (e.g., 2000/-) and time periods (e.g., 2 months), and keep them unchanged from the input.
50
+
51
+ Summarization: Summarize information effectively, extracting key details from the handbook without lengthening responses unnecessarily.
52
+
53
+ User Engagement: Avoid asking multiple questions at once. Instead, facilitate clear communication with a focus on being helpful and concise.
54
+
55
+ Sensitive Information: Share all relevant handbook information openly, as it is accessible to all employees.
56
+
57
+
58
+ At all times, remain professional, respectful, and supportive in your responses, guiding users to the information they need in the clearest way possible.
59
+ """
60
+
61
+
62
+ html_prompt = """
63
+ You are an expert on the input text extracted from HTML pages and can provide relevant answers to questions based on this information. Your primary role is to ensure that the information you provide is accurate, relevant, and based solely on the content from the text.
64
+
65
+ Tone: Maintain a friendly and helpful tone to engage the user effectively.
66
+
67
+ Responses:
68
+
69
+ Answer all user questions briefly, but if they ask multiple questions in one prompt, respond to each one concisely.
70
+
71
+ After answering, invite the user to ask more specific questions if they need further details.
72
+
73
+
74
+ Error Handling: If the input text does not contain relevant information, clearly state that no information is found. Do not create or fabricate answers.
75
+
76
+
77
+ Always prioritize clarity and relevance, helping the user get the most accurate and direct information possible.
78
  """
79
+
80
+
81
+ chat_prompt = """
82
+ You are an expert on the input text, which contains JSON data representing a Google Chat dump. Your role is to provide accurate and relevant answers to user questions based on the content of the chats.
83
+
84
+ Tone: Maintain a neutral, factual, and helpful tone in all responses.
85
+
86
+ Responses:
87
+
88
+ Focus on answering questions about the content of the chat. If a user asks a follow-up or more specific question, you may include the timestamp but avoid including the message ID.
89
+
90
+ If the user asks about multiple messages, provide a brief response for each one and encourage the user to ask for more details if needed.
91
+
92
+ If no relevant information is found, clearly state that no relevant information is available without making up any data.
93
+
94
+
95
+ Context: Include who said what in the chat and the context of the conversation, if available. Ensure responses are concise and directly answer the user's query.
96
+
97
+ Error Handling: If any data is missing or the query cannot be answered due to incomplete information, briefly specify the error (e.g., "No speaker information found").
98
  """
99
+
100
+ api_key = os.getenv("OPEN_API_KEY")
101
+
102
+ if api_key:
103
+ print("OpenAI: API Key retrieved successfully.")
104
+ openai.api_key = api_key
105
+ else:
106
+ print("OpenAI: API Key not found. Please set the environment variable.")
107
+
108
+
109
+
110
+ groq_api_key = os.environ.get("GROQ_KEY")
111
+ if groq_api_key:
112
+ print("GROQ Key retrieved successfully.")
113
+ PORT = os.environ.get("PORT")
114
+ print(f"PORT: {PORT}")
115
+
116
+ def find_key(
117
+ nested_structure: Union[list, dict], key_to_find: str
118
+ ) -> Union[dict, None]:
119
+ # TODO: Move this to utils
120
+ """
121
+ Recursively searches for a specified key within a nested structure that can be
122
+ either a list or a dictionary. If the key is found, returns the value associated with the key.
123
+ The search proceeds depth-first through dictionaries and iterates through lists.
124
+
125
+ :param nested_structure: (Union[list, dict]) The nested structure to search through.
126
+ It can be a complex structure containing nested lists and dictionaries.
127
+ :param key_to_find: (str) The key to search for in the nested structure.
128
+ Returns a unique id.
129
+
130
+ Example of a nested structure and how to call this function:
131
+
132
+ [
133
+ [[],{}],
134
+ [[],{}],
135
+ [[],{
136
+ 'data': {
137
+ 'product':{'name':'imac'}
138
+ },
139
+ 'metadata':{}
140
+ }],
141
+ ]
142
+
143
+ Example output
144
+ {'name':'imac'}
145
+
146
+ :returns: Union[dict, None]: The value associated with the specified key if found; otherwise, None.
147
+ :returns: str: A unique id.
148
+ """
149
+ # Check if the current element is a dictionary
150
+ if isinstance(nested_structure, dict):
151
+ # If the dictionary has the specified key, return the value
152
+ if key_to_find in nested_structure:
153
+ return nested_structure[key_to_find]
154
+ # Otherwise, recursively search each value in the dictionary
155
+ else:
156
+ for key, value in nested_structure.items():
157
+ result = find_key(
158
+ value, key_to_find
159
+ ) # Fixed: added key_to_find in recursive call
160
+ if result:
161
+ return result
162
+ # Check if the current element is a list
163
+ elif isinstance(nested_structure, list):
164
+ # Recursively search each item in the list
165
+ for item in nested_structure:
166
+ result = find_key(
167
+ item, key_to_find
168
+ ) # Fixed: added key_to_find in recursive call
169
+ if result:
170
+ return result
171
+
172
+ class Metadata(ABC):
173
+ def __init__(self) -> None:
174
+ super().__init__()
175
+ self.documents = []
176
+ self.ids = []
177
+
178
+ def generate_ids(self):
179
+ self.ids = [str(uuid4()) for _ in self.documents]
180
+
181
+ @abstractmethod
182
+ def load(self):
183
+ # Loading Documents
184
+ pass # This method should be implemented by child classes
185
+
186
+ @abstractmethod
187
+ def generate_metadata(self, *args, **kwargs):
188
+ pass # This method should be implemented by child classes
189
+
190
+
191
+ class Pdf(Metadata):
192
+ def __init__(self, files_path: list) -> None:
193
+ super().__init__()
194
+ self.files_path = files_path
195
+
196
+ def load(self):
197
+ self.load_pdfs()
198
+ self.generate_ids()
199
+
200
+ def load_pdfs(self) -> list:
201
+ for file_path in self.files_path:
202
+ loader = PyPDFLoader(file_path)
203
+ pages = loader.load_and_split()
204
+ for page in pages:
205
+ page.metadata = self.generate_metadata(page=page)
206
+ self.documents.extend(pages)
207
+
208
+ def generate_metadata(self, *args, **kwargs):
209
+ page = kwargs.get("page")
210
+ page.metadata["test"] = 1
211
+ return page.metadata
212
+
213
+
214
+ class Json(Metadata):
215
+ def __init__(
216
+ self,
217
+ file_path: str,
218
+ jq_schema: str = ".",
219
+ content_key: str = None,
220
+ metadata_keys: list = [],
221
+ ) -> None:
222
+ super().__init__()
223
+ self.file_path = file_path
224
+ self.jq_schema = jq_schema
225
+ self.content_key = content_key
226
+ self.metadata_keys = metadata_keys
227
+
228
+ def load(self):
229
+ self.load_json()
230
+ self.generate_ids()
231
+
232
+ def load_json(self):
233
+ if self.metadata_keys:
234
+ loader = JSONLoader(
235
+ file_path=self.file_path,
236
+ jq_schema=self.jq_schema,
237
+ content_key=self.content_key,
238
+ metadata_func=self.generate_metadata,
239
+ )
240
+
241
+ elif self.content_key:
242
+ loader = JSONLoader(
243
+ file_path=self.file_path,
244
+ jq_schema=self.jq_schema,
245
+ content_key=self.content_key,
246
+ text_content=False,
247
+ )
248
+ else:
249
+ loader = JSONLoader(
250
+ file_path=self.file_path, jq_schema=self.jq_schema, text_content=False
251
+ )
252
+ pages = loader.load()
253
+ self.documents.extend(pages)
254
+
255
+ def generate_metadata(self, record: dict, metadata: dict) -> dict:
256
+ for key in self.metadata_keys:
257
+ value = find_key(record, key)
258
+ if value:
259
+ metadata[key] = value
260
+ return metadata
261
+
262
+
263
+ class Csv(Metadata):
264
+ def __init__(
265
+ self, file_path: str, csv_args: dict = None, source_column: str = None
266
+ ) -> None:
267
+ super().__init__()
268
+ self.file_path = file_path
269
+ self.csv_args = csv_args
270
+ self.source_column = source_column
271
+
272
+ def load(self):
273
+ self.load_csv()
274
+ self.generate_ids()
275
+
276
+ def load_csv(self):
277
+ if self.csv_args:
278
+ # Example args:
279
+ """
280
+ csv_args={
281
+ 'delimiter': ',',
282
+ 'quotechar': '"',
283
+ 'fieldnames': ['MLB Team', 'Payroll in millions', 'Wins']
284
+ }
285
+ """
286
+ loader = CSVLoader(file_path=self.file_path, csv_args=self.csv_args)
287
+ elif self.source_column:
288
+ loader = CSVLoader(
289
+ file_path=self.file_path, source_column=self.source_column
290
+ )
291
+ else:
292
+ loader = CSVLoader(file_path=self.file_path)
293
+ pages = loader.load()
294
+ for page in pages:
295
+ page.metadata = self.generate_metadata(page=page)
296
+ self.documents.extend(pages)
297
+
298
+ def generate_metadata(self, *args, **kwargs):
299
+ page = kwargs.get("page")
300
+ page.metadata["length"] = len(page.page_content)
301
+ return page.metadata
302
+
303
+
304
+ class Text(Metadata):
305
+ def __init__(self, files_path: list) -> None:
306
+ super().__init__()
307
+ self.files_path = files_path
308
+
309
+ def load(self):
310
+ self.load_texts()
311
+ self.generate_ids()
312
+
313
+ def load_texts(self):
314
+ for file_path in self.files_path:
315
+ loader = TextLoader(file_path)
316
+ pages = loader.load()
317
+ # TODO: Do Chunking if required
318
+ for page in pages:
319
+ page.metadata = self.generate_metadata(page=page)
320
+ self.documents.extend(pages)# Use Groq API for response generation
321
+ api_key = os.environ.get("GROQ_KEY")
322
+ print(f"Using Groq API Key: {api_key}")
323
+
324
+ if not api_key:
325
+ raise ValueError("GROQ_KEY environment variable not set!")
326
+
327
+ def generate_metadata(self, *args, **kwargs):
328
+ page = kwargs.get("page")
329
+ page.metadata["length"] = len(page.page_content)
330
+ return page.metadata
331
+
332
+
333
+ class Html(Metadata):
334
+ def __init__(self, files_path: list) -> None:
335
+ super().__init__()
336
+ self.files_path = files_path
337
+
338
+ def load(self):
339
+ self.load_html()
340
+ self.generate_ids()
341
+
342
+ def load_html(self):
343
+ for file_path in self.files_path:
344
+ loader = BSHTMLLoader(file_path, bs_kwargs={"features": "html.parser"})
345
+ pages = loader.load()
346
+ for page in pages:
347
+ page.metadata = self.generate_metadata(page=page)
348
+ self.documents.extend(pages)
349
+
350
+ def generate_metadata(self, *args, **kwargs):
351
+ page = kwargs.get("page")
352
+ page.metadata["length"] = len(page.page_content)
353
+ return page.metadata
354
+
355
+
356
+ class Image(Metadata):
357
+ def __init__(self, directory_path: str, extension: str = None) -> None:
358
+ super().__init__()
359
+ self.directory_path = directory_path
360
+ self.extension = extension
361
+ self.documents = []
362
+
363
+ def load(self):
364
+ self.load_images()
365
+ self.generate_ids()
366
+
367
+ def load_images(self):
368
+ if self.extension:
369
+ pattern = os.path.join(self.directory_path, f"**/*{self.extension}")
370
+ else:
371
+ pattern = os.path.join(self.directory_path, "**/*")
372
+
373
+ image_paths = glob(pattern, recursive=True)
374
+ print(image_paths)
375
+ for image_path in image_paths:
376
+ self.documents.append(
377
+ Document(page_content=image_path, metadata={"image_path": image_path})
378
+ )
379
+
380
+ def generate_metadata(self, *args, **kwargs):
381
+ pass
382
+
383
+
384
+ # TODO: add support for Python source code files , Markdown etc
385
+
386
+ class Model(ABC):
387
+ def __init__(self, model_name: str, system_prompt: str) -> None:
388
+ super().__init__()
389
+ self.model = None
390
+ self.system_prompt = system_prompt
391
+ self.model_name = model_name
392
+ self.device = (
393
+ torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
394
+ )
395
+
396
+ @abstractmethod
397
+ def get_embeddings(self, input_text: str):
398
+ pass # This method should be implemented by child classes
399
+
400
+ @abstractmethod
401
+ def get_embedding_dimension(self, dummy_text: str = "Hello World!"):
402
+ pass # This method should be implemented by child classes
403
+
404
+
405
+ class MiniLM_L6_v2(Model):
406
+ def __init__(self, model_name: str, system_prompt) -> None:
407
+ super().__init__(model_name, system_prompt)
408
+ self.model = SentenceTransformer("all-MiniLM-L6-v2")
409
+
410
+ def get_embedding_dimension(self, dummy_text: str = "Hello World!"):
411
+ return len(self.get_embeddings(dummy_text))
412
+
413
+ def get_embeddings(self, input_text: str):
414
+ embeddings = self.model.encode(input_text)
415
+ return embeddings
416
+
417
+
418
+ class TextEmbedding3Large(Model):
419
+ def __init__(self, model_name: str, system_prompt) -> None:
420
+ super().__init__(model_name, system_prompt)
421
+
422
+ def get_embedding_dimension(self, dummy_text: str = "Hello World!"):
423
+ return len(self.get_embeddings(dummy_text))
424
+
425
+ def get_embeddings(self, input_text: str):
426
+ if isinstance(input_text, str):
427
+ input_text = [input_text]
428
+
429
+ response = openai.Embedding.create(model=self.model_name, input=input_text)
430
+ embeddings = [data["embedding"] for data in response["data"]]
431
+ embeddings = np.array(embeddings).astype("float32")
432
+ if embeddings.ndim == 2 and embeddings.shape[0] == 1:
433
+ embeddings = embeddings.flatten()
434
+ return embeddings
435
+
436
+ # TODO: Complete it for cosine similiarity
437
+ # For Cosine Similiarity
438
+ # if embeddings.ndim == 1: # Single embedding
439
+ # return embeddings / np.linalg.norm(embeddings)
440
+ # return embeddings / np.linalg.norm(embeddings, axis=1, keepdims=True)
441
+
442
+
443
+ class UAE_Large_V1(Model):
444
+ def __init__(
445
+ self,
446
+ model_name: str,
447
+ system_prompt,
448
+ cache_dir: str = INDEX_PATH,
449
+ ) -> None:
450
+ super().__init__(model_name, system_prompt)
451
+ self.cache_dir = cache_dir
452
+ self.model, self.tokenizer = self.load_or_download_model_and_tokenizer()
453
+
454
+ def load_or_download_model_and_tokenizer(self):
455
+ model_path = os.path.join(self.cache_dir, "_model.pt")
456
+ tokenizer_path = os.path.join(self.cache_dir, "_tokenizer")
457
+ print(model_path, tokenizer_path)
458
+
459
+ if not os.path.exists(self.cache_dir):
460
+ os.makedirs(self.cache_dir)
461
+
462
+ if os.path.exists(model_path) and os.path.exists(tokenizer_path):
463
+ print(f"Loading model and tokenizer from {self.cache_dir}")
464
+ model = torch.load(model_path)
465
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
466
+ else:
467
+ print(f"Downloading and saving model and tokenizer to {self.cache_dir}")
468
+ model = AutoModel.from_pretrained(self.model_name)
469
+ tokenizer = AutoTokenizer.from_pretrained(self.model_name)
470
+
471
+ torch.save(model, model_path)
472
+ tokenizer.save_pretrained(tokenizer_path)
473
+
474
+ return model, tokenizer
475
+
476
+ def get_embedding_dimension(self, dummy_text: str = "Hello World!"):
477
+ embeddings = self.get_embeddings(dummy_text)
478
+ return len(embeddings)
479
+
480
+ def get_embeddings(self, input_text: str):
481
+ if isinstance(input_text, str):
482
+ input_text = [input_text]
483
+
484
+ inputs = self.tokenizer(
485
+ input_text,
486
+ padding=True,
487
+ truncation=True,
488
+ return_tensors="pt",
489
+ max_length=512,
490
+ ).to(self.device)
491
+ with torch.no_grad():
492
+ last_hidden_state = self.model(**inputs, return_dict=True).last_hidden_state
493
+
494
+ embeddings = last_hidden_state[:, 0]
495
+ embeddings = embeddings.cpu().numpy()
496
+ if embeddings.ndim == 2 and embeddings.shape[0] == 1:
497
+ embeddings = embeddings.flatten()
498
+ return embeddings
499
+
500
+
501
+ # TODO: Complete implementation
502
+ class CliForImages(Model):
503
+ def __init__(self, model_name: str, system_prompt: str) -> None:
504
+ super().__init__(model_name, system_prompt)
505
+
506
+ self.model = SentenceTransformer("clip-ViT-B-32")
507
+
508
+ def get_embedding_dimension(
509
+ self,
510
+ dummy_text: str = "",
511
+ ):
512
+ return len(self.get_embeddings(dummy_text))
513
+
514
+ def get_embeddings(self, input_text: str):
515
+ # TODO: complete this function
516
+ pass
517
+
518
+ class VectorSpace:
519
+ def __init__(self, model, file_path_to_save_or_load) -> None:
520
+ self.model = model
521
+ self.file_path = file_path_to_save_or_load
522
+ self.vector_store = None
523
+ self.build_vector_space()
524
+
525
+ def build_vector_space(self):
526
+ if self.vector_store is not None:
527
+ print("Warning: Vector store is already created.")
528
+ return
529
+ index = faiss.IndexFlatL2(self.model.get_embedding_dimension())
530
+ self.vector_store = FAISS(
531
+ embedding_function=self.model.get_embeddings,
532
+ index=index,
533
+ docstore=InMemoryDocstore(),
534
+ index_to_docstore_id={},
535
+ )
536
+
537
+ # TODO: Add Support for Cosine Similiarity
538
+
539
+ # Indexing documents
540
+ def add_docs(self, documents, ids):
541
+ if not self.vector_store:
542
+ raise ValueError(f"Build vector Space First")
543
+ self.vector_store.add_documents(documents=documents, ids=ids)
544
+
545
+ # Retrieval
546
+ def search_docs(self, query: str, k: int = 3, filter: dict = {}):
547
+ if not self.vector_store:
548
+ raise ValueError(f"Build vector Space First")
549
+ results = self.vector_store.similarity_search(query, k=k, filter=filter)
550
+ return results
551
+
552
+ # Retrieval with scores
553
+ def search_with_score(self, query: str, k: int = 3, filter: dict = {}):
554
+ if not self.vector_store:
555
+ raise ValueError(f"Build vector Space First")
556
+ results = self.vector_store.similarity_search_with_score(
557
+ query, k=k, filter=filter
558
+ )
559
+ return results
560
+
561
+ def save_local(self):
562
+ if not self.vector_store:
563
+ raise ValueError(f"Build vector Space First")
564
+ self.vector_store.save_local(self.file_path)
565
+ print("Index Saved")
566
+
567
+ def load_local(self):
568
+ self.vector_store = FAISS.load_local(
569
+ self.file_path,
570
+ self.model.get_embeddings,
571
+ allow_dangerous_deserialization=True,
572
+ )
573
+ print("Index Loaded")
574
+
575
+
576
+ class Controller:
577
+ # TODO: Implementation can be improved
578
+ def __init__(self, input_json: dict) -> None:
579
+ self.input_json = input_json
580
+ self.document_loader = self.get_loader()
581
+ self.model = self.get_model()
582
+ self.index_path = self.get_index_path()
583
+
584
+ # If index exists, load it; otherwise, load documents and build the index
585
+ if self.index_exists():
586
+ print(f"Index found, loading from {self.index_path}")
587
+ self.vector_space = VectorSpace(self.model, self.index_path)
588
+ self.vector_space.load_local()
589
+ else:
590
+ print("Index not found, building a new one")
591
+ self.load_documents()
592
+ self.vector_space = VectorSpace(self.model, self.index_path)
593
+ self.vector_space.add_docs(
594
+ self.document_loader.documents, self.document_loader.ids
595
+ )
596
+ self.vector_space.save_local()
597
+
598
+ def get_index_path(self):
599
+ files_path = self.input_json["files_path"]
600
+ model_name = self.input_json["model_name"]
601
+ if isinstance(files_path, list):
602
+ files_path_str = "".join(files_path)
603
+ elif isinstance(files_path, str):
604
+ files_path_str = files_path
605
+ else:
606
+ raise ValueError("Invalid files_path: Expected str or list of str")
607
+
608
+ unique_identifier = hashlib.md5(
609
+ (files_path_str + model_name).encode()
610
+ ).hexdigest()
611
+
612
+ index_dir = INDEX_PATH
613
+ os.makedirs(index_dir, exist_ok=True)
614
+
615
+ path = os.path.join(index_dir, f"index_{unique_identifier}.faiss")
616
+ print(path)
617
+ return path
618
+
619
+ def index_exists(self):
620
+ return os.path.exists(self.index_path)
621
+
622
+ # vector Store Functions:
623
+ def add_docs(self):
624
+ if not self.vector_space:
625
+ raise ValueError(f"Build vector Space First")
626
+ self.vector_space.add_docs(
627
+ self.document_loader.documents, self.document_loader.ids
628
+ )
629
+ print("Documents Added!")
630
+
631
+ def search(self, query, k: int = 3, filter: dict = {}, with_score: bool = False):
632
+ if with_score:
633
+ results = self.vector_space.search_with_score(query, k, filter)
634
+ else:
635
+ results = self.vector_space.search_docs(query, k, filter)
636
+ return results
637
+
638
+ def get_loader(self):
639
+ input_file_type = find_key(self.input_json, "type")
640
+ files_path = find_key(self.input_json, "files_path")
641
+
642
+ if input_file_type == "PDF":
643
+ if not self.is_list(files_path):
644
+ raise ValueError(f"PDF files path should be List")
645
+ return Pdf(files_path)
646
+
647
+ elif input_file_type == "JSON":
648
+ if self.is_list(files_path):
649
+ raise ValueError(f"JSON file path should be str")
650
+ jq_schema = find_key(self.input_json, "jq_schema") or "."
651
+ content_key = find_key(self.input_json, "content_key")
652
+ metadata_keys = find_key(self.input_json, "metadata_keys") or []
653
+ return Json(files_path, jq_schema, content_key, metadata_keys)
654
+
655
+ elif input_file_type == "CSV":
656
+ if self.is_list(files_path):
657
+ raise ValueError(f"CSV file path should be str")
658
+ csv_args = find_key(self.input_json, "csv_args") or {}
659
+ source_column = find_key(self.input_json, "source_column")
660
+ return Csv(files_path, csv_args, source_column)
661
+
662
+ elif input_file_type == "TEXT":
663
+ if not self.is_list(files_path):
664
+ raise ValueError(f"TEXT files path should be List")
665
+ return Text(files_path)
666
+
667
+ elif input_file_type == "HTML":
668
+ if not self.is_list(files_path):
669
+ raise ValueError(f"HTML files path should be List")
670
+ return Html(files_path)
671
+
672
+ elif input_file_type == "IMAGE":
673
+ if self.is_list(files_path):
674
+ raise ValueError(f"IMAGE files path should be str")
675
+ extension = find_key(self.input_json, "extension", default=None)
676
+ return Image(files_path, extension)
677
+ else:
678
+ raise ValueError(f"Unsupported file type: {input_file_type}")
679
+
680
+ def get_model(self):
681
+ model_name = find_key(self.input_json, "model_name")
682
+ system_prompt = find_key(self.input_json, "system_prompt")
683
+ if model_name == "all-MiniLM-L6-v2":
684
+ return MiniLM_L6_v2(model_name, system_prompt)
685
+ elif model_name == "text-embedding-3-large":
686
+ return TextEmbedding3Large(model_name, system_prompt)
687
+ elif model_name == "WhereIsAI/UAE-Large-V1":
688
+ return UAE_Large_V1(model_name, system_prompt)
689
+ else:
690
+ raise ValueError(f"Unsupported model name: {model_name}")
691
+ # TODO: Add support for other models like CLIP
692
+
693
+ def load_documents(self):
694
+ if not self.document_loader:
695
+ print("Error Occurred")
696
+ exit(1)
697
+ self.document_loader.load()
698
+ print("Documents Loaded", len(self.document_loader.documents))
699
+
700
+ def is_list(self, input_value):
701
+ return isinstance(input_value, list)
702
+
703
+ # AVAILABLE MODELS and Their Dimensions
704
+ # all-MiniLM-L6-v2 (384)
705
+ # text-embedding-3-large (3072)
706
+ # WhereIsAI/UAE-Large-V1 (1024)
707
+
708
+ # NOTE
709
+ # Text, PDF and HTML suppport list of paths, Image support directory, Json and CSVs support single Files
710
+
711
+ # TODO: your files path here
712
+ input_json = {
713
+ "files_path": [f"{os.path.join(INDEX_PATH, "Employee_handbook.pdf")}"],
714
+ "type": "PDF",
715
+ "system_prompt": pdf_prompt,
716
+ "model_name": "all-MiniLM-L6-v2",
717
+ }
718
+
719
+ controller = Controller(input_json=input_json)
720
+
721
 
722
 
723
  def respond(
724
+ message: str,
725
+ history: list,
726
+ system_message: str,
727
+ max_tokens: int,
728
+ use_groq: bool = True,
729
+ use_history: bool = True,
730
+ max_history_length: int = 10 # Limit the number of historical messages
731
  ):
732
+ """
733
+ Handles conversation with context, manages RAG flow, and streams responses.
734
+
735
+ Args:
736
+ message (str): User's query.
737
+ history (list): Conversation history (user and assistant responses).
738
+ system_message (str): System prompt for the assistant.
739
+ max_tokens (int): Maximum tokens for the response.
740
+ use_groq (bool): Whether to use Groq client or OpenAI API.
741
+ use_history (bool): Whether to include history in the prompt.
742
+ max_history_length (int): Maximum number of messages to keep in history.
743
+
744
+ Yields:
745
+ str: Streamed response from the model.
746
+ """
747
+ # Manage system message
748
+ system_message = controller.model.system_prompt
749
+ print(controller.get_index_path())
750
  messages = [{"role": "system", "content": system_message}]
751
 
752
+ # Include history if enabled
753
+ if use_history and history:
754
+ trimmed_history = history[-max_history_length:] # Trim history to last N messages
755
+ for user_msg, assistant_msg in trimmed_history:
756
+ if user_msg:
757
+ messages.append({"role": "user", "content": user_msg})
758
+ if assistant_msg:
759
+ messages.append({"role": "assistant", "content": assistant_msg})
760
 
761
+ # Add the new user query
762
  messages.append({"role": "user", "content": message})
763
 
764
+ # RAG - Retrieval
765
+ print("\nUser Query:")
766
+ print(message) # Print user query
767
+ results = controller.search(message, with_score=True, k=3)
768
 
769
+ relevant_pages = []
770
+ print("\nFetched Documents:")
771
+ for docs, score in results:
772
+ print(f"* [SIM={score:.3f}] {docs.page_content} [{docs.metadata}]")
773
+ relevant_pages.append(docs.page_content)
 
 
 
774
 
775
+ # Prepare context from relevant documents
776
+ context = "\n".join(relevant_pages)
777
+ if context.strip():
778
+ messages.append({"role": "system", "content": "Relevant documents: " + context})
779
 
780
+
781
+ # Response generation
782
+ if use_groq:
783
+ # Groq Client Setup
784
+ client = Groq(api_key=groq_api_key)
785
 
786
+ # Prepare the full prompt
787
+ prompt = "\n".join(f"{msg['role']}: {msg['content']}" for msg in messages)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
788
 
789
+ # Stream response
790
+ response = client.chat.completions.create(
791
+ messages=[{"role": "user", "content": prompt}],
792
+ model="llama-3.3-70b-versatile",
793
+ stream=True,
794
+ )
795
+ cumulative_response = "" # Keep track of the cumulative response
796
+ for chunk in response:
797
+ if hasattr(chunk, "choices") and chunk.choices:
798
+ delta = chunk.choices[0].delta # Access the `delta` attribute
799
+ token = getattr(delta, "content", "") # Get the 'content' field
800
+ if token: # If a token is received
801
+ cumulative_response += token
802
+ yield cumulative_response # Stream the cumulative response
803
+ else:
804
+ # Use OpenAI API for response generation
805
+ completion = openai.ChatCompletion.create(
806
+ model="gpt-4",
807
+ messages=messages,
808
+ max_tokens=max_tokens,
809
+ temperature=0.1,
810
+ top_p=0.1,
811
+ stream=True, # Enable streaming
812
+ )
813
+ response = ""
814
+ for chunk in completion:
815
+ token = chunk["choices"][0]["delta"].get("content", "")
816
+ response += token
817
+ yield response
818
+
819
+ # Increase the size of the Gradio Blocks
820
+ demo = gr.Blocks(fill_height=True)
821
+
822
+ with demo:
823
+ gr.Markdown("**Employee handbook assistant **")
824
+ gr.Markdown("‼Disclaimer:‼️")
825
+
826
+ chatbot = gr.ChatInterface(
827
+ respond,
828
+ examples=[
829
+ [
830
+ "what are the rules regarding staying in late and ordering food, on the company?"
831
+ ],
832
+ ],
833
+ title="Employee handbook assistant 👩‍⚕️",
834
+ )
835
 
836
  if __name__ == "__main__":
837
+ # Set share = True for a public link that lasts around 72 hours (iff and only iff your machine is up and running this notebook)
838
+ demo.launch(share=True, debug=True, server_port=int(PORT))
839
+
requirements.txt CHANGED
@@ -1 +1,153 @@
1
- huggingface_hub==0.25.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ huggingface_hub==0.25.2
2
+ huggingface_hub==0.25.2
3
+ aiofiles==23.2.1
4
+ aiohappyeyeballs==2.4.3
5
+ aiohttp==3.10.10
6
+ aiosignal==1.3.1
7
+ annotated-types==0.7.0
8
+ anyio==4.6.0
9
+ asttokens==2.4.1
10
+ attrs==24.2.0
11
+ autopep8==2.3.1
12
+ beautifulsoup4==4.12.3
13
+ black==24.10.0
14
+ certifi==2024.8.30
15
+ charset-normalizer==3.4.0
16
+ click==8.1.7
17
+ comm==0.2.2
18
+ contourpy==1.3.0
19
+ cycler==0.12.1
20
+ dataclasses-json==0.6.7
21
+ debugpy==1.8.7
22
+ decorator==5.1.1
23
+ distro==1.9.0
24
+ executing==2.1.0
25
+ faiss-cpu==1.9.0
26
+ fastapi==0.115.0
27
+ ffmpy==0.4.0
28
+ filelock==3.16.1
29
+ fonttools==4.54.1
30
+ frozenlist==1.4.1
31
+ fsspec==2024.9.0
32
+ gradio==5.0.1
33
+ gradio_client==1.4.0
34
+ greenlet==3.1.1
35
+ groq==0.13.0
36
+ h11==0.14.0
37
+ httpcore==1.0.6
38
+ httpx==0.27.2
39
+ huggingface-hub==0.25.2
40
+ idna==3.10
41
+ ipykernel==6.29.5
42
+ ipython==8.28.0
43
+ isort==5.13.2
44
+ jedi==0.19.1
45
+ Jinja2==3.1.4
46
+ jiter==0.6.1
47
+ joblib==1.4.2
48
+ jq==1.8.0
49
+ jsonpatch==1.33
50
+ jsonpointer==3.0.0
51
+ jupyter_client==8.6.3
52
+ jupyter_core==5.7.2
53
+ kiwisolver==1.4.7
54
+ langchain==0.3.3
55
+ langchain-community==0.3.2
56
+ langchain-core==0.3.10
57
+ langchain-text-splitters==0.3.0
58
+ langsmith==0.1.134
59
+ markdown-it-py==3.0.0
60
+ MarkupSafe==2.1.5
61
+ marshmallow==3.22.0
62
+ matplotlib==3.9.2
63
+ matplotlib-inline==0.1.7
64
+ mdurl==0.1.2
65
+ mpmath==1.3.0
66
+ multidict==6.1.0
67
+ mypy-extensions==1.0.0
68
+ nbqa==1.9.0
69
+ nest-asyncio==1.6.0
70
+ networkx==3.4
71
+ numpy==1.26.4
72
+ nvidia-cublas-cu12==12.1.3.1
73
+ nvidia-cuda-cupti-cu12==12.1.105
74
+ nvidia-cuda-nvrtc-cu12==12.1.105
75
+ nvidia-cuda-runtime-cu12==12.1.105
76
+ nvidia-cudnn-cu12==9.1.0.70
77
+ nvidia-cufft-cu12==11.0.2.54
78
+ nvidia-curand-cu12==10.3.2.106
79
+ nvidia-cusolver-cu12==11.4.5.107
80
+ nvidia-cusparse-cu12==12.1.0.106
81
+ nvidia-nccl-cu12==2.20.5
82
+ nvidia-nvjitlink-cu12==12.6.77
83
+ nvidia-nvtx-cu12==12.1.105
84
+ openai==0.28.0
85
+ orjson==3.10.7
86
+ packaging==24.1
87
+ pandas==2.2.3
88
+ parso==0.8.4
89
+ pathspec==0.12.1
90
+ pexpect==4.9.0
91
+ pillow==10.4.0
92
+ platformdirs==4.3.6
93
+ prettytable==3.11.0
94
+ prompt_toolkit==3.0.48
95
+ propcache==0.2.0
96
+ psutil==6.0.0
97
+ ptyprocess==0.7.0
98
+ pure_eval==0.2.3
99
+ pycodestyle==2.12.1
100
+ pydantic==2.9.2
101
+ pydantic-settings==2.5.2
102
+ pydantic_core==2.23.4
103
+ pydub==0.25.1
104
+ Pygments==2.18.0
105
+ PyMuPDF==1.24.11
106
+ pyparsing==3.2.0
107
+ pypdf==5.0.1
108
+ python-dateutil==2.9.0.post0
109
+ python-dotenv==1.0.1
110
+ python-multipart==0.0.12
111
+ pytz==2024.2
112
+ PyYAML==6.0.2
113
+ pyzmq==26.2.0
114
+ regex==2024.9.11
115
+ requests==2.32.3
116
+ requests-toolbelt==1.0.0
117
+ rich==13.9.2
118
+ ruff==0.6.9
119
+ safetensors==0.4.5
120
+ scikit-learn==1.5.2
121
+ scipy==1.14.1
122
+ semantic-version==2.10.0
123
+ sentence-transformers==3.2.0
124
+ setuptools==75.1.0
125
+ shellingham==1.5.4
126
+ six==1.16.0
127
+ sniffio==1.3.1
128
+ soupsieve==2.6
129
+ SQLAlchemy==2.0.35
130
+ stack-data==0.6.3
131
+ starlette==0.38.6
132
+ sympy==1.13.3
133
+ tenacity==8.5.0
134
+ threadpoolctl==3.5.0
135
+ tokenize_rt==6.1.0
136
+ tokenizers==0.20.1
137
+ tomli==2.0.2
138
+ tomlkit==0.12.0
139
+ torch==2.4.1
140
+ tornado==6.4.1
141
+ tqdm==4.66.5
142
+ traitlets==5.14.3
143
+ transformers==4.45.2
144
+ triton==3.0.0
145
+ typer==0.12.5
146
+ typing-inspect==0.9.0
147
+ typing_extensions==4.12.2
148
+ tzdata==2024.2
149
+ urllib3==2.2.3
150
+ uvicorn==0.31.1
151
+ wcwidth==0.2.13
152
+ websockets==12.0
153
+ yarl==1.14.0
static/Employee_handbook.pdf ADDED
Binary file (818 kB). View file
 
static/index_3a2ce688802ac5fa49d7515083e17e69.faiss/index.faiss ADDED
Binary file (101 kB). View file
 
static/index_3a2ce688802ac5fa49d7515083e17e69.faiss/index.pkl ADDED
Binary file (172 kB). View file