fullstack-rag-ai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: fullstack-rag-ai
3
+ Version: 0.1.0
4
+ Summary: Lightweight RAG library for internal knowledge systems
5
+ Author: fullstack
6
+ Requires-Dist: langchain
7
+ Requires-Dist: langchain-community
8
+ Requires-Dist: langchain-huggingface
9
+ Requires-Dist: langchain-ollama
10
+ Requires-Dist: faiss-cpu
11
+ Requires-Dist: sentence-transformers
12
+ Requires-Dist: pypdf
File without changes
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: fullstack-rag-ai
3
+ Version: 0.1.0
4
+ Summary: Lightweight RAG library for internal knowledge systems
5
+ Author: fullstack
6
+ Requires-Dist: langchain
7
+ Requires-Dist: langchain-community
8
+ Requires-Dist: langchain-huggingface
9
+ Requires-Dist: langchain-ollama
10
+ Requires-Dist: faiss-cpu
11
+ Requires-Dist: sentence-transformers
12
+ Requires-Dist: pypdf
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ fullstack_rag_ai.egg-info/PKG-INFO
4
+ fullstack_rag_ai.egg-info/SOURCES.txt
5
+ fullstack_rag_ai.egg-info/dependency_links.txt
6
+ fullstack_rag_ai.egg-info/requires.txt
7
+ fullstack_rag_ai.egg-info/top_level.txt
8
+ fullstack_rag_lib/__init__.py
9
+ fullstack_rag_lib/config.py
10
+ fullstack_rag_lib/fullstack_rag_pipeline.py
11
+ fullstack_rag_lib/ingestion.py
12
+ fullstack_rag_lib/loaders.py
13
+ fullstack_rag_lib/vectordb.py
@@ -0,0 +1,7 @@
1
+ langchain
2
+ langchain-community
3
+ langchain-huggingface
4
+ langchain-ollama
5
+ faiss-cpu
6
+ sentence-transformers
7
+ pypdf
@@ -0,0 +1 @@
1
+ fullstack_rag_lib
@@ -0,0 +1,3 @@
1
+ from .ingestion import load_documents
2
+ from .vectordb import build_vector_db
3
+ from .fullstack_rag_pipeline import ask_question
@@ -0,0 +1,11 @@
1
+ DEFAULT_CONFIG = {
2
+
3
+ "embedding_model": "sentence-transformers/all-MiniLM-L6-v2",
4
+
5
+ "llm_model": "llama3",
6
+
7
+ "chunk_size": 800,
8
+
9
+ "chunk_overlap": 100
10
+
11
+ }
@@ -0,0 +1,35 @@
1
+ from langchain_community.vectorstores import FAISS
2
+ from langchain_huggingface import HuggingFaceEmbeddings
3
+ from langchain_ollama import ChatOllama
4
+ import warnings
5
+ warnings.filterwarnings("ignore")
6
+
7
+ def ask_question(question, index_path, model, embedding_model):
8
+
9
+ embeddings = HuggingFaceEmbeddings(
10
+ model_name=embedding_model
11
+ )
12
+
13
+ vectordb = FAISS.load_local(
14
+ index_path,
15
+ embeddings,
16
+ allow_dangerous_deserialization=True
17
+ )
18
+
19
+ docs = vectordb.similarity_search(question, k=3)
20
+
21
+ context = "\n\n".join(d.page_content for d in docs)
22
+
23
+ llm = ChatOllama(model=model)
24
+
25
+ prompt = f"""
26
+ Answer using the context below.
27
+
28
+ Context:
29
+ {context}
30
+
31
+ Question:
32
+ {question}
33
+ """
34
+
35
+ return llm.invoke(prompt)
@@ -0,0 +1,13 @@
1
+ import os
2
+ from langchain_community.document_loaders import PyPDFLoader
3
+
4
+ def load_documents(path):
5
+
6
+ documents = []
7
+
8
+ for file in os.listdir(path):
9
+ if file.endswith(".pdf"):
10
+ loader = PyPDFLoader(os.path.join(path, file))
11
+ documents.extend(loader.load())
12
+
13
+ return documents
@@ -0,0 +1,12 @@
1
+ from langchain.schema import Document
2
+
3
+
4
+ def load_from_text_list(texts):
5
+
6
+ docs = []
7
+
8
+ for t in texts:
9
+
10
+ docs.append(Document(page_content=t))
11
+
12
+ return docs
@@ -0,0 +1,20 @@
1
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
2
+ from langchain_community.vectorstores import FAISS
3
+ from langchain_huggingface import HuggingFaceEmbeddings
4
+
5
+ def build_vector_db(documents, index_path, embedding_model):
6
+
7
+ splitter = RecursiveCharacterTextSplitter(
8
+ chunk_size=800,
9
+ chunk_overlap=100
10
+ )
11
+
12
+ chunks = splitter.split_documents(documents)
13
+
14
+ embeddings = HuggingFaceEmbeddings(
15
+ model_name=embedding_model
16
+ )
17
+
18
+ vectorstore = FAISS.from_documents(chunks, embeddings)
19
+
20
+ vectorstore.save_local(index_path)
@@ -0,0 +1,22 @@
1
+ [project]
2
+ name = "fullstack-rag-ai"
3
+ version = "0.1.0"
4
+ description = "Lightweight RAG library for internal knowledge systems"
5
+ authors = [{name = "fullstack"}]
6
+ dependencies = [
7
+ "langchain",
8
+ "langchain-community",
9
+ "langchain-huggingface",
10
+ "langchain-ollama",
11
+ "faiss-cpu",
12
+ "sentence-transformers",
13
+ "pypdf"
14
+ ]
15
+
16
+ [build-system]
17
+ requires = ["setuptools", "wheel"]
18
+ build-backend = "setuptools.build_meta"
19
+
20
+ [tool.setuptools.packages.find]
21
+ where = ["."]
22
+ include = ["fullstack_rag_lib*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+