# Domain AI 應用:透過智能自動化改變行業
:crown: Speaker: <font color="#00bfff">**Leo Chu @Unition**</font>
{%hackmd 3_LMFJLvQV-rMOZRjKILnQ %}
:raised_hands: Slido: https://app.sli.do/event/62My7psHmtEaaKDXG8baBZ
###### ✦✦✦✦✦ Here we go ! ✦✦✦✦✦
## Movtivation
Traditional Customer Service - 客服
因客戶愈多, 所需要的客服愈多. 想提供線上AI客服
### Customer Service
Adv:
Problem-solving
Interpersonal interaction
Credibility - 有些客戶比較喜歡真人, 不會冷冰冰的
Dis-adv:
High Cost
Low Efficiency
Inconsistency
Limited Working Hours
--
### **AI** Customer Service
Adv:
Cost-effectiveness
Real-Time responses
Scalability
Automation
Dis-adv:
Lack of emotions and personalization
Limited responses
> 只能回應訓練的資識
---
## How to feed knowledge to GPT Model
1.Weight
2.Input
### Via model weights - fine-tuning
1. Like a lone term memory
2. High cost on prepare data
3. Fine-tuning is better suited to teaching specialized task or styles , and is less reliable for factual
### Via model inputs
1. message inputs are like short-term memory
2. open book exam
demo : ask with article
---
## Tokens
沒法一次給這麼多token , 就算是有也是挺花錢的.
What is token? : 處理文本的最小單位, 使用者輸入內容. e.g. 一個中文字2個token
Token Limit:
GPT3.5: 4,096 tokens
GPT4
GPT3.5-16k
GPT4-32K
## Embedding Data
1. Convert document/input to vector
做向量化時保持原本的特徵, 然後做比較.
2. Calculate similarity
我們怎麼做比較的呢? Consine Similarity
比對相似度的概念:
RBG model
Red : [255,0,0] , Pink [255,105, 180]
Consine = 0.77
> Consine做完的range 0 ~ 1, 0.77 算高的了. 意思是紅跟粉紅很像
---
## Embedding Search
1. Prepare search data
2. Search
3. Ask
### Prepare search data
1. Collect
2. Chunk
3. Embed
4. Store
### Search
1. Given a user question
2. Generate an embedding for the query
3. Rank the text sections
4. Insert the question and the most relevant sections
5. Return GPT's answer
Demo : Failed , Not working 來個掌聲.
在DB就2個欄 , content & 向量
---
# Prompt
需要精準的描述, 才能完成合理的任務
OpnenAI Prompt Types
1. System Role
2. Assistant Role
3. User Role
---
# Open AI
Why Azure Open AI
| |Embedding Search | Cognitive Search|
| -------- | -------- | -------- |
| Multi-lang | X | V |
| Cost for preprocessing Data | V | X |
| Support Differnt Type input | X | v |
Security
How Azure Open AI work
flow : Questoin -> Query from DB as `Knowledge` -> Prompt + `Knowledge`
Demo : Fail (請自行想像)
---
有提供API 做Embed 嗎?
yes , 且可以自己選擇等級 Ada or 達文西
可以處理一段文字.
Leo : 建議在演講前, 記得先在現場試過Demo先