Giter Site home page Giter Site logo

tomoyukiorita / llm-langchain-sql-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garystafford/llm-langchain-sql-demo

0.0 0.0 0.0 507 KB

Using LangChain's SQL Database Chain and Agent with various LLMs to perform Natural Language Queries (NLQ) of an Amazon RDS for PostgreSQL database.

License: MIT License

Jupyter Notebook 100.00%

llm-langchain-sql-demo's Introduction

NLQ on Amazon RDS using Amazon SageMaker, LangChain, and LLMs

Source code for the upcoming blog post, Generative AI for Analytics: Performing Natural Language Queries on Amazon RDS using SageMaker, LangChain, and LLMs. Learn to use LangChain's SQL Database Chain and Agent with large language models to perform natural language queries (NLQ) of Amazon RDS for PostgreSQL.

Architecture

Using dotenv

Your .env files should look as follows:

# API Keys
OPENAI_API_KEY=<your_value_here>

# Demo 1: Amazon RDS Connection 
RDS_ENDPOINT=<your_value_here>
RDS_PORT=<your_value_here>
RDS_USERNAME=<your_value_here>
RDS_PASSWORD=<your_value_here>
RDS_DB_NAME=<your_value_here>

# Demo 2: Amazon Redshift Connection 
REDSHIFT_HOST=<your_value_here>
REDSHIFT_PORT=<your_value_here>
REDSHIFT_USERNAME=<your_value_here>
REDSHIFT_PASSWORD=<your_value_here>
REDSHIFT_DATABASE=<your_value_here>

Checking RDS Connection from SageMaker Notebook

# Get your SageMaker Notebook environment IP
dig +short txt ch whoami.cloudflare @1.0.0.1

# Curl RDS database instance to check connectivity
curl -v ******.******.us-east-1.rds.amazonaws.com:5432

Notebook Formatting

jupyter-black was used to format notebooks.

pip install "black[jupyter]"

black *.ipynb

The contents of this repository represent my viewpoints and not of my past or current employers, including Amazon Web Services (AWS). All third-party libraries, modules, plugins, and SDKs are the property of their respective owners.

llm-langchain-sql-demo's People

Contributors

garystafford 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.