Langchain + Streamlit + Azure Cosmos DB for MongoDB(vCore) + Docker를 기반으로 하는 GenAI 도우미입니다.
저자:
Linux Ubuntu 20.04에서 테스트되었습니다(다른 시스템에서는 조정이 필요할 수 있음).
AI Assistant 앱 배포 및 벡터 데이터베이스 생성을 위한 최소 하드웨어 요구 사항(PanKB DB, ETL 및 AI Assistant 앱 제외):
시스템 요구 사항:
DB 채우기 프로세스는 최대 90~150분 정도 걸릴 수 있습니다. DEV 서버 및 Cosmos DB 분할된 클러스터 구성에 따라 다릅니다. 채워진 컬렉션이 포함된 MongoDB 스토리지 크기는 ~ 1.0 GiB입니다. 인덱스.
다음 제한 사항 및 고려 사항에 유의하세요.
다음 형식으로 .env 파일을 만듭니다.
## Do not put this file under version control!
OPENAI_API_KEY=<insert the API key here without quotes>
COHERE_API_KEY=<insert the API key here without quotes>
TOGETHER_API_KEY=<insert the API key here without quotes>
GOOGLE_API_KEY=<insert the API key here without quotes>
ANTHROPIC_API_KEY=<insert the API key here without quotes>
REPLICATE_API_TOKEN=<insert the API key here without quotes>
VOYAGE_API_KEY=<insert the API key here without quotes>
## MongoDB-PROD (Azure Cosmos DB for MongoDB) Connection String
# Had to multiply maxIdleTimeMS by 10 to handle
# urllib3.exceptions.ProtocolError:
# ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
MONGODB_CONN_STRING = "<insert the connection string here with quotes>"
DB 채우기 스크립트는 Docker 컨테이너에서 실행될 필요가 없습니다. 다음 명령을 사용하여 수행할 수 있습니다.
# install all the requirements and dependencies
pip3 install -r requirements.txt
# Run the script with two command line arguments:
# the name of the folder containing the documents to feed to the LLM
# and
# the name of the MongoDB collection that will contain the vector DB
python3 make_vectordb.py ./Paper_all pankb_vector_store
Docker 이미지를 빌드하고 내부 Streamlit 앱을 사용하여 Docker 컨테이너를 다시 생성하는 명령은 다음과 같습니다.
docker compose up -d --build --force-recreate
dockerized streamlit 앱은 tmux 에서 실행될 필요가 없습니다. VM이 재부팅된 후에도 항상 실행됩니다( restart: always
docker compose 파일에서).
Docker 컨테이너의 상태는 다음 명령으로 확인할 수 있습니다.
docker ps
명령은 대략적인 결과를 생성해야 합니다. 성공적인 배포의 경우 다음과 같은 출력이 표시됩니다.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54d89d7c4fad pankb_llm:latest "streamlit run strea…" 10 minutes ago Up 10 minutes 0.0.0.0:8501->8501/tcp, :::8501->8501/tcp pankb-llm