OpenAI
, LangChain
and Chainlit
[AI Seminar] College of Intelligent Computing, CGU2024-02-20 @ Taoyuan City, Taiwan By Jazz Yao-Tsung Wang Director of Engineering, Innova Solutions Chairman, Taiwan Data Engineering Association |
|
|
Effective on 2021-01-01
Civil monetary penalty (CMP) = 民事罰款
Source: https://www.cms.gov/hospital-price-transparency/enforcement-actions
Shop site
developed by Taipei DXP SBP
team Procedure Price
based on Payer Name
and Medical Network
Source: https://shop.baconcountyhospital.com/pt-machinereadable.html
|
|
Did you call Help Desk before?
Image Source: "Telework Guy",by j4p4n, OpenClipArt, 2020-06-05
Source: "Three ChatOps examples demonstrate DevOps efficiency", 2018-02-05
Source: "LINE Bot Designer"
Source: "How ChatGPT Works: The Model Behind The Bot", 2023-01-31
( Note: I removed confidential diagram shown here )
Source: Reverse Engineering PlantUML diagram by Jazz Wang
Source: "List of languages supported by ChatGPT",
Botpress Community, 2023-03-23
|
|
PS. I tried to leverage local GPT4All-J LLM instead of OpenAI GPT-3.5-Turbo LLM
|
|
|
|
Most poeple use ChatGPT (free) / ChatGPT Plus (paid).
By subscribing OpenAI API, you can create application programatically.
Source: https://platform.openai.com/apps
When you don't want to do experiment for a long term,
you canCancel Plan
to reduce cost.
LangChain
is a framework for developing applications
powered bylanguage models
.
LangChain
enables applications that are:
LangChain
are:
Source: LangChain Document - Model I/O
Chain
= a sequence of calls to components, which can include other chains.
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(
input_variables=["product"],
template="What is a good name for a company that makes {product}?",
)
Source: LangChain Document - Chains
By default,
Chains
andAgents
are stateless
LangChain provides memory components in two forms:
Source: LangChain Document - Memory
The core idea of agents is to use an LLM to choose a sequence of actions to take.
In
chains
, a sequence of actions is hardcoded (in code).
Inagents
, a language model is used as a reasoning engine.
Source: LangChain Document - Agents
Source: LangChain Document - Agent types
Chainlit is an open-source Python package
to build production ready Conversational AI.
There are reference example code to integrate Chainlit with LangChain
|
|
with Chainlit, you can see the
prompt
created by LangChain
and theresponse
from OpenAI GPT-3.5/4 LLM
GPT4All-J
can't code like GPT-3.5-Turbo
Question: which is better?
Multimodal LLM
vsCode LLM
?
Meta's Code Llama-2
LLMSource: https://huggingface.co/codellama
What if LLM can't understand the meaning of Schema?
Chainlit can store user's question into SQLite.
It helps to reduce the cost of OpenAI API usages.
You can also use it to analyze user's question and answers saved.
|
|
Source: How to Create a FREE Custom Domain Name for Your Lambda URL - A Step by Step Tutorial
Retrieval-Augmented Generation (RAG)
Source: RAG Cheatsheet V2.0 🚀, Steve Nouri, 2024-02-18
sharing
Interface
instead ofData
Learn by
Doing
Building Hospital Price Transparency Chatbot |