Gen AI with Open AI - amitbhilagude/userfullinks GitHub Wiki

  1. Introduction
    1. Create account in OpenAI
    2. Free 5$ credit for POC
    3. Use of Open AI, Install Open AI Python library
    4. Prompt: Input provided to LLM
    5. Token: Answer retrieved from Open AI converted into small segement called token. e.g Every word will be token and cost is based on number of token you pass.
  2. Python env setup
    1. Create virtual environment
    2. Install all packages from requirements.txt
    3. Create API Key.
    4. Setup open AI API key as environment variable
    5. There will multiple language model available so make sure find our right language model
    6. Define prompt using OpenAI object. Prompt take input as string, model name, allowed max token, temp etc.
  3. Conversation AI
    1. Conversation AI is build project like chatgpt
    2. Open AI has chat completion API it takes prompt as a role and message. Role is give the context to give better accuracy
    3. Chat gpt LLM doesn't have realt time data. it is provides data to trainned but there is option to give input of trained data which is called prompt engineering 4.Real time data calling
    4. Models are training for particular schedule and it will not have real time
    5. Want to build real time data need to extend LLM capabilities with Function calling
    6. Function calling
      1. Define function and parameter
      2. Pass that function parameter as dev tool.
      3. LLM understands it doesn't have this data, it can respond you back
      4. call that function and generate extended response
  4. Building custom knowledge
    1. Models are trained but it doesn't have your domain specific data for product, company.
    2. Some time times same model will not give all information and you may end up with calling multiple models with LangChain
    3. One model output will pass to another model.
    4. Custom knowledge will be stored into Vector DB like chroma or vector db or elastic search
    5. Embedding
      1. Custom knowledge will be spitted in chunks
      2. Convert into Embedding with Open AI method
      3. Store into Vector DB
    6. Create a prompt template which will have context. When search is performed, query to vector db, pass that template with context has value from vector DB to model.