(1)本機開發模式:
P.S. 艾鍗的Linux Driver 課程是刻意準備成"本機開發模式"。為了給學員把學習重點放在"Linux Device Driver "上學習,而不要花太多時間在其他嵌式入開發的支微末節。這就好像學習"Window Device Driver"一樣,先專注Windows 作業系統驅動程式的軟體架構和流程。
FPGA Fabric 內部元件連接使用的是Avalon Bus, 而ARM SoC 內部使用 AXI Interface.
OpenAI 目前提供的API 種類有這些:
但使用這些API ,要先在 OpenAI https://platform.openai.com/ 註冊並取得API Key 才能呼叫。但取得API Key 是需要付費的。 使用 Free trial API Key 須付 5塊美金,此 Key 有效期為 3 個月。到期後,必須填寫信用卡資訊轉換成付費帳戶。
針對不同的AI模型, 如 聲音識別的 whisper-1, 文字生成影像 dall-e-2, 大型語言模型(LLM) gpt-3.5-turbo , 均有不同的使用資費。如下
1. GET API Key
1. First, create an OpenAI account or sign in. Next, navigate to the API key page and "Create new secret key", optionally naming the key
2. Install the OpenAI Python library
> pip install openai langchain
3. 程式測試
# On Windows
原本python app.py 改成用waitress 啓動web 服務
pip install waitress
waitress-serve --host=0.0.0.0 --port=5000 app:app
#On Linux
可以用 gunicorn 作為WSGI Server
References:

mimic the behavior of browser
session = requests.Session()
用sesson 送出 HTTP 請求(get/post) 會將session id 存在內部的cookie中。下次再發送session.post()或session.get() 會帶出相同的session-id . 否則會被認為這是不同的HTTP 請求。用這種方法才能將同一個請求,視為同一個對話(Session) 才能正確模仿瀏覽器的行為。