langchain based gpt & agent service
- [demo] https://fullstack-gpt-crewai.streamlit.app (TBD)
- install python 3.11.6 and add system path on python & pip
$ python --version
Python 3.11.6
$ pip --version
pip 23.2.1 from D:\setup\Python311\Lib\site-packages\pip (python 3.11)
- install required packages
$ pip install -r requirements.txt
- set runtime environment
$ cat .env
OPENAI_API_KEY="..."
- load runtime environment
from dotenv import dotenv_values
from langchain.chat_models import ChatOpenAI
config = dotenv_values(".env")
llm = ChatOpenAI(
openai_api_key=config['OPENAI_API_KEY'],
...
)
- run normal app in virtual environment
$ python -m venv ./env
$ source env/Scripts/activate or source env/bin/activate
$ vi main.py
$ python main.py
$ deactivate
- run jupyter app in virtual environment
$ source env/Scripts/activate or source env/bin/activate
$ touch main.ipynb
! select runtime kernel as venv - python 3.11.6
! run code & debug for testing
$ deactivate
- run streamlit app in root environment
$ streamlit run challenge-06.py
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
$ source env/Scripts/activate or source env/bin/activate
$ playwright install
Downloading Chromium 119.0.6045.9 (playwright build v1084) from https://playwright.azureedge.net/builds/chromium/1084/chromium-win64.zip
...
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 120.8 Mb
Chromium 119.0.6045.9 (playwright build v1084) downloaded to ...
Downloading FFMPEG playwright build v1009 from https://playwright.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
...
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 1.4 Mb
FFMPEG playwright build v1009 downloaded to ...
Downloading Firefox 118.0.1 (playwright build v1425) from https://playwright.azureedge.net/builds/firefox/1425/firefox-win64.zip
...
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 80 Mb
Firefox 118.0.1 (playwright build v1425) downloaded to ...
Downloading Webkit 17.4 (playwright build v1921) from https://playwright.azureedge.net/builds/webkit/1921/webkit-win64.zip
...
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 44.5 Mb
Webkit 17.4 (playwright build v1921) downloaded to ...