Krish Gen AI

 https://learn.krishnaikacademy.com/web/login

Prereqs

LLMs
  • Transformers models
    • LLAMA - Open Source from meta & can be run local
    • Chat GPT
    • DeepSeek  -> Along with training mechanism, they added reinforcement training which helped in faster training and inferencing(response time) 
  • BERT
    • Google Gemini
Introduction
  • Anakonda + VS code
  • Anakonda
    • Operating System for AI
    • For data science, machine learning, and scientific computing initiatives
    • It includes package management and deployment tools, such as Conda, and comes bundled with many popular data analysis libraries (e.g., NumPy, pandas, scikit-learn).
    • Installation
      • Download  Anakonda installer and run it
      • Download VS code installer and run it

  • Objectives
    • NLP techniques and applns in AI systems
    • Implement and optimize NLP models using SpaCy and Hugging Face
    • GenAI techniques including transformers and language models, for generating and completing text tasks
    • Develop agentic systems 
      • multi-agent collab
      • decision making frameworks
      • feedback loops in complex environments
    • Master RAG for improving information retrieval
    • LangChain & LangFlow to build scalable and efficient NLP workflows
    • Build and Deploy conversational agents and chatbots using LangGraph, LangChain and integration with third party tools and apis
    • Apply observability techniques for monitoring LLMs and agentic systems, leveraging tools like langfuse and langwatch
  • Agents vs Agentic AI vs AI Agents vs gen AI vs multi-agents
  • Agentic AI Frameworks
    • Phi Data
    • LangChain & LCEL
      • LangServ for effecient deployment
    • LangGraph
      • UX and Human-in-the-loop
      • Agentic RAG
        • Adaptive RAG
        • RAG Variants
      • Multi-agent in LangGraph
      • CrewAI platform
    • LangFlow - no code platform
  • Integration with third-party tools
  • Langfuse for observability
  • Metrics and Monitoring in LangWatch
  • LangSmith - testing of AI models
  • Autogen from MicroSoft
  • end-end agentic ai projects
  • AWS cloud for Gen AI 
  • AWS bedrock
  • AWS SageMaker
  • AWS Lambda
  • GCP projects
  • GCP - vertex  for GenAI

  • Statistics
  • Multi Models
    • Text
      • NLP Machine learning
      • NLP Deep learning
      • RNN and its variants
      • Transformers and BERTS
    • Image/video generation 
      • Computer Vision
        • CNN and Object Detection
Learn GEN AI

  • Frameworks to develop GenAI applns
    • LangChain, LAMAIndex, ChainLit, HUGGING FACE
    • LLM, MultiModel, Open source LLM models
    • Finetuning (Qlora, Lora)
    • Differentiator -> MLOps, LLMops
    • Inferencing -> GROQ
  • Lang Chain
    • Langsmith
      • Monitoring, Debugging and Testing
    • LangServe
      • FastAPI
    • Chains
    • Agents, Retrival
    • LCEL
    • LLM
  • Anaconda
    • Operating System for AI
    • Package management. It helps in packages and env maintenance
    • conda create -n test python==3.12
  • Agenda
    • ML, DL, Generative ai, ai agents, agentic ai
    • VS code -> environment creation for project  -> package management
  • AI
    • Perform its own task with out human intervention eg: self-driving cars
  • Machine learning
    • Provides statistics tools to analyze, visualize, prediction of the data
    • Data can be in different kinds - tabular, timeseries and others
    • With dimension increases, ML performance will saturate and go down.
    • ML algos are based on some kind of equations with some parameters, and there will be some fine tuning techniques. 
  • Deep Learning(Multi layer NN)
    • As the data increases, accuracy also increases
    • This is because of back propagation
    • ANN, CNN(computer vision), RCNN, YOLO 9, YOLO 11  -> for computer Vision
    • RNN -> LSTM RNN, RNN GRU -> Encoder Decoder -> Attention is all you need -> Transformer -> BERT
  • NLP
    • Sentiment Analysis problem -> solved using ML algorithms initially
      • Text -> Vectors -> train with ML Algorithms
        • OHE(one hot encoding), BoW, TFIDF, NGrams, word2vec, Avgword2vec
    • GPT stands for Generative Pre-trained Transformer
    • LLama, chatgpt, deepseek -> are based on transformers
  • Google Gemini -> BERT architecture -> only encoder
  • LLama -> Transformers -> both encoder and decoder
  • GenAI
    • subset of deep learning model
    • To generate new content
  • LLM -> ask for today news
    • Given LLM is not trained with todays data it gets information from external source(API)
    • APIs like SERPAPI , TAVILY, DUCKDUCKGO for web search, 
    • Arxif api/repository for research papers
    • External sources can be created as tools
  • Agentic AI
    • subset of GenAI
    • Task is to solve complex workflows and not just generate new content
  • External source
    • Information which LLM will get as needed. External source can be configured as a tool
  • Attention is all you need -> research paper for Transformers
  • AI agents vs Agentic AI
    • AI agents are individual tools that perform specific tasks within a AI system
      • eg: Google Search, Calculation, customer service, coding, planning
    • Agentic AI is a broader system that uses these tools to achieve goals
      • AI system that uses AI agents, learn and make decisions within a defined scope
  • Development Team
    • Product Manager
    • Business Analyst
  • Virtual Environment
    • conda create -p venv python==3.12
    • conda activiate venv  OR cmd prompt  -> conda activate "c:\.... \venv"
    • New libraries will be created inside virtual env
    • Important Library required to run code in Jupyter notebook is ipykernel
      pip install ipykernel
    • pip install -r requirements.txt
Langchain Tutorials

  • .ipynb is a Jupiter notebook file. 
  • pip install ipython
  • LangChain framework
    • Open source framework
    • Common framework which can integrate with any LLM model and build applications
    • LangChain
      • Langchain
        • Build ai agents, gen ai applns
      • langsmith 
        • debug
        • acts as playground
        • prompt mgmt
        • annotation, testing and monitoring
      • Integrations(components) 
        • Libraries to integrate with with 3rd party tools
      • langgraph 
        • implement complex workflows
      • langserve 
        •  to deploy genai applns deployable inform of apis
    • Coding
      • API keys
        • https://platform.openai.com/settings/organization/api-keys
        • https://smith.langchain.com/ -> settings -> 
      • llm=ChatOpenAI(model="o1-mini")
        llm.invoke("<qn>")
      • prompt=ChatPromptTemplate.from_messages([ ("system","You are an expert AI Engineer. Provide me answer based on the question"),     ("user","{input}") ])
      • chain=prompt|llm
        response=chain.invoke({"input":"Can you tell me about Langsmith"})

Rag source -> context to LLM


  • Ollama 
    • Platform to run open source LLMs locally
    • open source model
      • document reader, text splitter, vector database, embedding techniques(open ai, ollama, huggingface)
    • Download and install Ollama -> 
      • weights and bias combined together are called LLM Parameters 
    • ollama run llama3.2:1b  -> Installs the LLM and opens chatbot
    • /bye to exit
    • Document Chain -> is to combine different chunks of promt
  • Create_stuff_document_chain 
    • to create chain of documents to pass it to the model
  • Create retrieval chain
    • Adds document and retrieval chain together
LangGraph Tutorials

  • Chatbot
    • Memory, chatbots, message history
    • retrievers
    • tools and agents
  • Tools and AI agents
    • Tools are interface that chain/agent/llm used to interact with the world.

  • Lang Chain
    • Advantages
      • Amazing libraries it has support for components, core, integration
    • Disadvantages
      • Documentation is bad
      • chaining, visualization missing,
      • Complex workflow
        • State management, visualization
    • Generative AI appln -> Agentic AI appln
      • Gen ai applns
        • message history and ask qns
        • Develop rags
        • Develop tools
        • Develop Agents
      • Agentic AI applns
        • Plan 5 day trip to France -> complex workflow which requires state management
        • ReAct (Reasoning and action)
    • Basic Architecture of Agentic AI application

  • Langgraph
    • Lang+Graph
    • Entire workflow is converted into graphs
    • It has conditional edges, Nodes, graph state
      • Node can be LLM invoke, function calling, Tool calling
    • Things to be developed for Langgraph application
      • State Schema
      • Nodes -> functions
      • Edges -> connects Nodes
      • State Graph
  • Agents using langgraph
    • ReAct  -> General Agent Architecture
      • act -> Let the model call specific tool
      • observe -> pass the tool output back to the model
      • react/reason -> let the model reason about the tool output to decide what to do next(call another tool or respond back)
  • Agents with memory
    • Memory in Agents using Memory Saver

  • Langgraph studio
  • StateSchema
    • Structure and types of data that graph uses

  • Pydantic
    • State Schema
  • Prompt Chaining
    • Prompt chaining decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one.
    • When to use this workflow: This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks. The main goal is to trade off latency for higher accuracy, by making each LLM call an easier task.
  • Workflows -> Langraph applications 
    • Prompt Chaining
    • Parallelization
    • Routing -Orchestrator-Worker
    • Evaluator - Optimizer

  • Human in the loop required for
    • Approval
    • Debugging
    • Editing

Langgraphs Assignments

  • Types of RAG with LangGraph
    • Agentic RAG
      • Use an agent to figure out how to retrieve the most relevant information before using the retrieved info to answer the user question.
    • Adaptive RAG
      • It is a strategy for RAG that unites query analysis with active/self-corrective RAG

  • End to End Projects
    • conda create -p venv python==3.12
    • conda activiate venv  OR cmd prompt  -> conda activate "c:\.... \venv"
    • Load LLM
    • Create Graph Structure (.py file)
    • node.py file for all nodes code
    • retriever.py

  • Search APIs
    • Tavily 
    • Serper 

  • conda create -p venv python==3.12
  • conda activate venv/
  • pip install -r requirements.txt

  • Lightweight library for building multimodal Agents with memory, knowledge and tools.
  • It was prior phidata
  • Open source framework to build AI Agents and Agentic AI applns


  • Agentic AI framework
  • Agno vs Crewai
  • Every Agent will have some type of task. Task can be attached to some type of tools. 
  • Agent definition -> task definition ->  tool definition(tools, llm)
  • CrewAI Crews

  • CrewAI Flows

  • LLM output is not deterministic
  • Crew ai official implementation
    • crewai create crew research_crew
  • Trip planner app
  • Agentic RAG with crewai
  • Trip Planner
    • CLI
    • Streamlit
    • api server -> FASTAPI
  • Flows Setup
    • crewai create flow <flowname>
    • App ready on flows


  • Knowledge source
  • Memory
  • Process
  • Guardrails
  • Multimodal
Crew ai Part 6    --next 2.34
  • MCP
    • Model context Protocol - It is a protocol that standardizes how applications provide context to LLMs. 
    • Tools -> Model controlled
    • Resources -> appln controlled
      • files, db
    • Prompt -> User controlled
      • predefined templates, workflow



  • Data science ->ML ->DL -> NLP -> GAN -> AI
  • Async Foundation
  • Faster and more flexible
  • Backed by Microsoft
  • Layered API Design






15 June Day - 36 Autogen Projects

21 June Day - 37 Autogen final project + advance concept


Hackathon
  • Mock interview platform -> AI Powered Interview Practice 
  • Internship platform
  • Get Advice platform
  • AI Labs
  • Mentorship 
  • Research Assistant
    • On YouTube upload event
    • Write a Blog using the Transcript of the video
    • Review the blog
    • Go back to write blog if review fails
    • end
  • Code Reviews
    • Review
    • Generate test cases
    • run test cases
    • analyze the failed tests
    • Give summary
  • Article Generation from  youtube video
    • Youtube API -> Get transcript -> Create Blog
  • Youtube API -> Get transcript -> Create Blog -> Reviewer -> Ask for human feedback -> if not satisified send to blog writer  else end;
  • Code convert from Java to Python -> reviewer -> Human feedback -> end
  • Generate feedback from KT videos(understand the gist) -> Ask for feedback from KT person -> if yes, end the loop

Comments

Popular posts from this blog

LangChain

AutoGen