GithubHelp home page GithubHelp logo

langchain-project's Introduction

Langchain-Project (with Ollama)

Langchain Project following Krish Naik's Updated Langchain Tutorial

Log

Part 2 of Updated Langchain playlist

  1. Create localama.py using ollama and gemma model
  2. To run go to venv and type streamlit run chatbot/localama.py

Part 3 of Updated Langchain playlist

  1. Create api app.py and client.py to route different task to different LLM
  2. To run go to type python api/app.py to activate the api app
  3. Next, open another terminal and navigate to venv and type streamlit run api/client.py to run the frontend app

Part 4 of Updated Langchain playlist

  1. Ingest data from .txt, website, .pdf
  2. Use Recursive text splitter to split corpus into chunks
  3. Vector Embedding using open source model (Ollama = llama3)
  4. Store in vector store FAISS
  5. perform query using similarity search

Part 5 of Updated Langchain playlist

  1. Combine Chain and Retriever into a retriever_chain to obtain response for LLM model based on context
  2. Context are the text information embeddeded and stored in the vector store
  3. Some prompts are listed as part of the input to ensure better quality answer suited to the case.

Part 6 of Updated Langchain playlist

  1. Using agents and tools for multi-data source RAG
  2. Used Groqchat as it supports tools (https://python.langchain.com/docs/integrations/chat/)
  3. Used Groqcloud to obtain API keys
  4. Invoking the agents to use the relevant tools requires explicit command on the

Part 7 of Updated Langchain playlist

  1. Groq inferencing engine using open source LLM
  2. Stored 3 websites for context, gave better performance with details compared to chatGPT and Copilot

Part 8 of Updated Langchain playlist

  1. Try out Huggingface embedder in notebook

Part 9 of Updated Langchain playlist

  1. Q&A using Llama3 model and RAG on documents
  2. Added gif for processing effect
  3. change to dark mode.

Reference documents

Detailed explaination of groq/llama3.py script

The script sets up a Streamlit app where users can ask questions related to Pokémon Scarlet & Violet documents. It prepares document embeddings and retrieves relevant responses using the ChatGroq model and document retrieval techniques.

image

  • Imports: The script imports necessary libraries and modules including Streamlit for building the web app, os for handling environment variables, various components from the "langchain" package for language processing, and dotenv for loading environment variables from a .env file.

  • Loading Environment Variables: It loads environment variables, particularly the GROQ API key, from a .env file using the dotenv library.

  • Initializing ChatGroq: Creates an instance of the ChatGroq class with the GROQ API key and model name "Llama3-8b-8192".

  • Setting Up Chat Prompt Template: Defines a template for generating prompts for interacting with the ChatGroq model.

  • Function Definition (vector_embedding): Defines a function named vector_embedding which sets up document embeddings using Ollama embeddings and FAISS for vector storage.

  • User Input: Accepts user input via a text input field (st.text_input) for asking questions.

  • Button for Document Embedding: Displays a button labeled "Documents Embedding". Upon clicking this button, it triggers the vector_embedding function to prepare the document embeddings.

  • Document Retrieval: If the user inputs a question and submits it, the script initiates document retrieval by creating a retrieval chain using the prepared document embeddings and the ChatGroq model. It then retrieves and displays the response.

  • Document Similarity Search: It expands an expander section in the Streamlit app to display document similarity search results. This section iterates over the retrieved documents and displays their content along with a separator.

langchain-project's People

Contributors

yyorky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.