0% found this document useful (0 votes)
5 views4 pages

GenAI Class Notes

The document outlines the steps for setting up a Generative AI project, including initializing the repository, designing user interactions, and implementing document ingestion and retrieval. It details the project structure, technologies to use (like FastAPI), and the importance of vector-based knowledge stores for semantic search. Additionally, it emphasizes the need for reliability, safety controls, and deployment options, with a deadline for project submission set for one month from now.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

GenAI Class Notes

The document outlines the steps for setting up a Generative AI project, including initializing the repository, designing user interactions, and implementing document ingestion and retrieval. It details the project structure, technologies to use (like FastAPI), and the importance of vector-based knowledge stores for semantic search. Additionally, it emphasizes the need for reliability, safety controls, and deployment options, with a deadline for project submission set for one month from now.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

******************************************

Capstone_Project_GenAI_Discussion
******************************************

1. Set up the project foundation:


– Initialize the project repository, environment configuration, and basic application structure for the
Generative AI system.
Activity:
- Create your Github Account - Free Account ([Link]
- Create your own git Repoistory (Remote storage)
- setup the Virtual Environment.( Standalone project , dont have any conflit with other team.)
Team 1:
- Pandas 2.1.0
Team 2:
- Pandas 1.5.0
Team 3:
- Pandas 2.2.0
- Prompt: Create Virtual environemnt in python and give the detail steps.
python -m venv genai-doc-assistant
venv\Scripts\activate

Project Folder Structure:


genai-doc-assistant
app/
api/
[Link]
services/
agents/
core/
utils/
data/
<inputfiles>
[Link] (pip install -r [Link])
.gtiignore

2. Design the user interaction layer:


- Interface to user to upload the documents to the LLM Models
- Rest API ( Flask, Django, FastAPI Framework) - Recommentation - FastAPI
OR
- Web UI ( Stramlit / React / Angular)

Fast-API core Endpoints:


/Upload-document - Injecting data(filess) to LLM Model
/Ask-Questions - Injecting data(prompt) to LLM Model
/Health-Check - API is up and running , Status = 200

3. Implement document ingestion:


- Data Ingestion to the LLM Nodel
- Support for different varity of file format
txt - os
pdf - pypdf2
csv - pandas (read_csv() )
excel - pandas and openpyxl (read_excel())
json - json (read_json())
yaml - pyyaml (load() save())

4. Prepare data for semantic search:


- Split the extracted text into manageable format( small chunks of data)
- Concept ??? Tokenization
Chunking Strategy:
i) Fixed Size (200 Tokens )
ii) Overmap
ii) Semantic Boundaries

from langchain.text_splitter import CharacterTextSplitter

text = "LangChain simplifies AI workflows. It enables advanced retrieval-augmented generation systems for
NLP tasks."
splitter = CharacterTextSplitter(chunk_size=50, chunk_overlap=10)
chunks = splitter.split_text(text)
print(chunks)

output:

[
"LangChain simplifies AI workflows. It enables adv",
"es AI workflows. It enables advanced retrieval-au",
"vanced retrieval-augmented generation systems for",
"d generation systems for NLP tasks."
]

5. Build a vector-based knowledge store:


- to stor the different types of data into numerical representation.
vectorDB Into:
[Link]
utm_campaign=brand_educative&utm_source=google&utm_medium=ppc&utm_content=performance_
max_india&utm_term=&aff=K3Zq&utm_term=&utm_campaign=%5BNew
%5D+Performance+Max&utm_source=adwords&utm_medium=ppc&hsa_acc=5451446008&hsa_cam=18
931439518&hsa_grp=&hsa_ad=&hsa_src=x&hsa_tgt=&hsa_kw=&hsa_mt=&hsa_net=adwords&hsa_ver=3
&gad_source=1&gad_campaignid=18924941403&gbraid=0AAAAADfWLuTAdcldPc4Vr9xraql0PmfTf&gclid=
CjwKCAjw6f3RBhApEiwAMaCqWV5V0U6mUf4fijipqocN89ZHBOKLu--
vKaF0xfXo_dtKq7Zh1DqAJBoCb8QQAvD_BwE

Type of VectorDB:
[Link]
utm_campaign=brand_educative&utm_source=google&utm_medium=ppc&utm_content=performance_
max_india&utm_term=&aff=K3Zq&utm_term=&utm_campaign=%5BNew
%5D+Performance+Max&utm_source=adwords&utm_medium=ppc&hsa_acc=5451446008&hsa_cam=18
931439518&hsa_grp=&hsa_ad=&hsa_src=x&hsa_tgt=&hsa_kw=&hsa_mt=&hsa_net=adwords&hsa_ver=3
&gad_source=1&gad_campaignid=18924941403&gbraid=0AAAAADfWLuTAdcldPc4Vr9xraql0PmfTf&gclid=
CjwKCAjw6f3RBhApEiwAMaCqWSvEo-
MVUVZpyNCh1CirpV8IsrlqaMcB9tCIqa1H05lTeiHBERSIRRoCucsQAvD_BwE
Step:
- Convert small chunk to embedding
- Store enbedding with mdetadata
- Index for similarity search
Types od Vector DB:
- Chromadb (Developer Friently)
- Pinecore (Easy to manage and scable)
- FAISS (Local, faster)

Break , we will resume at 9:20 PM IST

6. Implement intelligent document retrieval


– Retrieve the most relevant document content based on user queries using similarity search.

Steps:
- Enbedding the user query.
- Perform the similarity search(Cosine)
- Sekect the Top-N relevant chunks
Benefit:
Relevant document concepts.
Reduce the noise and improve the grouping technique.
Modules:
langchain_openai

7. Develop a Retrieval-Augmented Generation pipeline:


– Combine retrieved document context with an LLM to generate accurate, grounded responses

RAG Flows:
- User Question
- Embedding
- Vector search
- Relevant content
- LLM Prompt
- Grouping the answers

- LLM Model provide the result only for the provided inputs.

[Link] agent-based reasoning


Create one or more AI agents that plan,retrieve, reason, and generate responses using available tools.

Agent Roles:
Planner ==> Decides the steps (tasks)
Retriver ==> Fetch the context from the knowledge base.
reasoning ==> Analuze the content.
Response ==> Generate the Final output.

Benefits:
- Multi-Step Reasoning
- Tool technique (search, Calculation, Validation, Reson, Response.... )
- Improve the accuracy of the Agent

[Link] reliability and safety controls


- Handle errors, validate inputs, and apply guardrails to reduce hallucinations and unsafe outputs.

Proper Error handling technique.


Validate inputs
Apply the Guardrails to reduce the unsafe o/pandas
Robustness app

Control:
- Input validation( file tupe, file zie, )
- Error handling and proper logging mechanism.(looging)
- Monitor the model
- output verification agent.

10. Deploy and document the solution:


- Deploy the application and provide documentation explaining the architecture, workflow, and
limitations.
- Production Ready Application
- End-use can access

Deployment Options:
- Docker
- AWS / Azure /GCP
- Render Tool (Open source)

locahost:8080/gen_ai (local to your maachine)

pulbic:
[Link]/8080/gen_ai

Project Submission:
1) Code implementation ==> Mandatory
2) Any public data ==> Good to have
3) Documentation ==> Good to have
4) Result or output ==> Mandatory

Dealine abt project Submission:


1 month from now (30 day)

You might also like