Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/fastapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: FastAPI LangChain CI/CD Pipeline

on:
push:
branches:
- main # main 브랜치에 푸시될 때마다 이 워크플로우가 실행됩니다.
pull_request:
branches:
- main # main 브랜치에 PR을 만들 때마다 실행

jobs:
build:
runs-on: ubuntu-latest

steps:
# 1. Checkout repository
- name: Checkout code
uses: actions/checkout@v2

# 2. Set up Python environment
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11' # 사용하고 있는 Python 버전

# 3. Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

# 4. Run tests
- name: Run tests
run: |
pytest # pytest를 사용해 테스트 실행, 다른 테스트 도구를 사용할 수 있음

dockerize:
runs-on: ubuntu-latest
needs: build # build job이 성공적으로 완료된 후에 실행됨

steps:
- name: Checkout code
uses: actions/checkout@v2

# 1. Build Docker image
- name: Build Docker image
run: |
docker build -t fastapi-langchain .

# 2. Push Docker image to Docker Hub (옵션)
- name: Push Docker image to Docker Hub
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push fastapi-langchain

deploy:
runs-on: ubuntu-latest
needs: dockerize # dockerize job이 완료된 후 실행

steps:
- name: Deploy to Server
run: |
# 배포 스크립트를 추가하거나, 서버에 SSH로 접속해 FastAPI 앱을 배포하는 명령어 추가
ssh user@your-server "docker pull fastapi-langchain && docker run -d -p 80:80 fastapi-langchain"
18 changes: 0 additions & 18 deletions .github/workflows/github-actions-demo.yml

This file was deleted.

8 changes: 4 additions & 4 deletions chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def format_docs(docs):
general_chain = (
PromptTemplate.from_template(
"""Respond to the following question concisely:

Question: {question}
Answer:
If the question is not about expert knowledge or recent events, reply:

"도와드리지 못해서 죄송합니다. 저는 비트코인 관련 전문지식과 최신소식만 답변드릴 수 있습니다."

Only respond with factual, concise answers supported by the context when applicable."""
Only respond with factual, concise answers supported by the context when applicable.
Question: {question}
Answer:
"""
)
# OpenAI의 LLM을 사용합니다.
| ChatOpenAI(model="gpt-4o-mini")
Expand Down
69 changes: 69 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
aiohappyeyeballs==2.6.1
aiohttp==3.11.18
aiosignal==1.3.2
annotated-types==0.7.0
anyio==4.9.0
attrs==25.3.0
certifi==2025.4.26
charset-normalizer==3.4.2
click==8.2.0
dataclasses-json==0.6.7
distro==1.9.0
dotenv==0.9.9
fastapi==0.115.12
frozenlist==1.6.0
grpcio==1.67.1
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
httpx-sse==0.4.0
idna==3.10
jiter==0.9.0
jsonpatch==1.33
jsonpointer==3.0.0
langchain==0.3.25
langchain-community==0.3.24
langchain-core==0.3.59
langchain-milvus==0.1.10
langchain-openai==0.3.16
langchain-text-splitters==0.3.8
langsmith==0.3.42
marshmallow==3.26.1
milvus-lite==2.4.12
multidict==6.4.3
mypy_extensions==1.1.0
numpy==2.2.5
openai==1.78.1
orjson==3.10.18
packaging==24.2
pandas==2.2.3
propcache==0.3.1
protobuf==6.30.2
pydantic==2.11.4
pydantic-settings==2.9.1
pydantic_core==2.33.2
pymilvus==2.5.8
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
pytz==2025.2
PyYAML==6.0.2
regex==2024.11.6
requests==2.32.3
requests-toolbelt==1.0.0
six==1.17.0
sniffio==1.3.1
SQLAlchemy==2.0.40
starlette==0.46.2
tavily-python==0.7.2
tenacity==9.1.2
tiktoken==0.9.0
tqdm==4.67.1
typing-inspect==0.9.0
typing-inspection==0.4.0
typing_extensions==4.13.2
tzdata==2025.2
ujson==5.10.0
urllib3==2.4.0
uvicorn==0.34.2
yarl==1.20.0
zstandard==0.23.0
Loading