Skip to content

Looker + OpenAI GPT-3 + LangChain Demo application

License

Notifications You must be signed in to change notification settings

ainoya/gpt-looker

Repository files navigation

Looker Data Access with Natural Language using OpenAI and LangChain

Demo App

This repository contains a demo application that uses OpenAI and LangChain to interact with Looker and output data based on natural language questions in English and other languages.

Features

  • Retrieve data from Looker by asking questions in English and other languages
  • Utilizes OpenAI and LangChain for language understanding and translation
  • Converts natural language questions into Looker API requests using GPT-3 (text-davinci-003)
  • Supports local LookML embeddings

Getting Started

  1. Clone this repository to your local machine.

  2. Install the required dependencies using the following command:

    pip install -r requirements.txt
  3. Place the looker.ini file in the root directory of the project.

  4. Set the environment variables LOOKER_MODEL_NAME and LOOKML_DIR to the appropriate values for your Looker model and LookML directory:

    export LOOKER_MODEL_NAME=<your_looker_model_name>
    export LOOKML_DIR=<path_to_your_lookml_directory>
    export OPENAI_API_KEY=<your_openai_api_key>
  5. Run app.py to start the Streamlit application:

    streamlit run app.py
  6. Open the Streamlit application in your web browser using the provided URL.

Usage

  1. Input your question in the text box, either in English or any other natural language.
  2. Press "Send" to send the question to the application.
  3. The application will process the question using OpenAI and LangChain, converting it into a Looker API request.
  4. View the retrieved data from Looker displayed on the screen.

Future Work

  • Integrate this application with ChatGPT to enable seamless communication between the two platforms and further enhance the natural language processing capabilities.
  • Implement a smarter search indexing for Retrieval QA using lkml to improve the overall search experience.
  • Integrate with ChatGPT Plugin.

LICENSE

This project is licensed under the terms of the MIT license.