RAG API
์ด ํ๋ก์ ํธ๋ ๋ฌธ์ ๊ธฐ๋ฐ ์ง์์๋ต ์์คํ ์ ๊ตฌํํ FastAPI ๊ธฐ๋ฐ์ API ์๋ฒ์ ๋๋ค.
๊ธฐ๋ฅ
๋ฌธ์ ์ ๋ก๋ ๋ฐ ๋ฒกํฐ ์คํ ์ด ์ ์ฅ
- PDF ๋ฐ CSV ํ์ผ ์ง์
- ๋ฌธ์ ์๋ ๋ถํ ๋ฐ ์๋ฒ ๋ฉ
- Chroma ๋ฒกํฐ ์คํ ์ด์ ์ ์ฅ
๋ฌธ์ ๊ฒ์
- ์์ฐ์ด ์ฟผ๋ฆฌ ๊ธฐ๋ฐ ๊ฒ์
- ์ ์ฌ๋ ๊ธฐ๋ฐ ๋ฌธ์ ๊ฒ์
์ค์น ๋ฐฉ๋ฒ
- ํ์ํ ํจํค์ง ์ค์น:
pip install -r requirements.txt
- ํ๊ฒฝ ๋ณ์ ์ค์ :
export OPENAI_API_KEY="your-api-key"
์คํ ๋ฐฉ๋ฒ
python main.py
์๋ฒ๊ฐ http://localhost:8000 ์์ ์คํ๋ฉ๋๋ค.
API ์๋ํฌ์ธํธ
๋ฌธ์ ์ ๋ก๋
- POST /upload
- multipart/form-data ํ์์ผ๋ก ํ์ผ ์ ๋ก๋
- ์ง์ ํ์: PDF, CSV
- ํ๋ผ๋ฏธํฐ:
files: ์ ๋ก๋ํ ํ์ผ ๋ชฉ๋ก (ํ์)vector_store_dir: ๋ฒกํฐ ์คํ ์ด๋ฅผ ์ ์ฅํ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก (์ ํ, ๊ธฐ๋ณธ๊ฐ: โvector_storeโ)
๋ฌธ์ ๊ฒ์
- POST /query
- form-data ํ์์ผ๋ก ํ๋ผ๋ฏธํฐ ์ ๋ฌ
- ํ๋ผ๋ฏธํฐ:
query: ๊ฒ์ ์ฟผ๋ฆฌ (ํ์)vector_store_dir: ๋ฒกํฐ ์คํ ์ด ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก (์ ํ, ๊ธฐ๋ณธ๊ฐ: โvector_storeโ)k: ๊ฒ์ํ ๋ฌธ์ ์ (์ ํ, ๊ธฐ๋ณธ๊ฐ: 2)
API ๋ฌธ์
FastAPI์ ์๋ ์์ฑ ๋ฌธ์๋ ๋ค์ URL์์ ํ์ธํ ์ ์์ต๋๋ค:
- http://localhost:8000/docs
- http://localhost:8000/redoc
๋ฒกํฐ ์คํ ์ด ์ด์
๋ฒกํฐ ์คํ ์ด์ ์ ์ฅ๋ ํ์ผ์ ๋ค๋ฅธ ํ๋ก์ ํธ์์ ์ฌ์ฌ์ฉํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ๋ฉด ๋ฉ๋๋ค:
- ์ํ๋ ๋ฒกํฐ ์คํ ์ด ๋๋ ํ ๋ฆฌ๋ฅผ ๋ค๋ฅธ ํ๋ก์ ํธ์ ๋์ผํ ๊ฒฝ๋ก๋ก ๋ณต์ฌํฉ๋๋ค.
- ๋ค๋ฅธ ํ๋ก์ ํธ์์๋ ๋ค์ ํจํค์ง๋ค์ด ์ค์น๋์ด ์์ด์ผ ํฉ๋๋ค:
- langchain-chroma
- langchain-openai
- ๊ธฐํ ํ์ํ ์์กด์ฑ ํจํค์ง๋ค
- ๋์ผํ ์๋ฒ ๋ฉ ๋ชจ๋ธ(OpenAIEmbeddings)์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
- ํ์ํ ํ๊ฒฝ ๋ณ์(์: OpenAI API ํค)๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ๋์ด ์์ด์ผ ํฉ๋๋ค.
๋ฒกํฐ ์คํ ์ด๋ฅผ ๋ค๋ฅธ ํ๋ก์ ํธ๋ก ์ด์ ํ ๋๋ ๋จ์ํ ํด๋น ๋๋ ํ ๋ฆฌ๋ฅผ ๋ณต์ฌํ๋ ๊ฒ๋ง์ผ๋ก๋ ์ถฉ๋ถํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ฌธ์์ ์๋ฒ ๋ฉ๊ณผ ๋ฉํ๋ฐ์ดํฐ๊ฐ ๋ชจ๋ ๋ณด์กด๋์ด ์๋ก์ด ํ๋ก์ ํธ์์๋ ๋์ผํ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์ฌ๋ฌ ๋ฒกํฐ ์คํ ์ด ์ฌ์ฉํ๊ธฐ
์ด ํ๋ก์ ํธ๋ ์ฌ๋ฌ ๊ฐ์ ๋ฒกํฐ ์คํ ์ด๋ฅผ ๋์์ ์ฌ์ฉํ ์ ์๋๋ก ์ค๊ณ๋์์ต๋๋ค. ๊ฐ ๋ฒกํฐ ์คํ ์ด๋ ์๋ก ๋ค๋ฅธ ๋๋ ํ ๋ฆฌ์ ์ ์ฅ๋๋ฉฐ, API ํธ์ถ ์ vector_store_dir ํ๋ผ๋ฏธํฐ๋ฅผ ํตํด ์ํ๋ ๋ฒกํฐ ์คํ ์ด๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
์๋ฅผ ๋ค์ด, ์๋ก ๋ค๋ฅธ ํ๋ก์ ํธ๋ ๋ฌธ์ ์ธํธ์ ๋ํด ๋ณ๋์ ๋ฒกํฐ ์คํ ์ด๋ฅผ ๋ง๋ค๊ณ ๊ด๋ฆฌํ ์ ์์ต๋๋ค:
project1_docs -> vector_store_project1
project2_docs -> vector_store_project2
research_papers -> vector_store_research
์ด๋ ๊ฒ ํ๋ฉด ๊ฐ ๋ฌธ์ ์ธํธ๋ฅผ ๋ ๋ฆฝ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ๊ฒ์ํ ์ ์์ต๋๋ค.
RAG Document Tools
Project Details
- bettehub/laas-rag-mcp
- Last Updated: 5/9/2025
Recomended MCP Servers
This read-only MCP Server allows you to connect to SharePoint Excel Services data from Claude Desktop through CData...
MCP server for Cursor that leverages Gemini's much larger context window to enhance the capabilities of the AI...
A Model Context Protocol server for Confluence.
MCP
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
CloudStream iรงin Tรผrkรงe yayฤฑn yapan sitelere ait eklentiler
A Claude MCP server providing secure access to Android project files for AI-assisted code navigation and analysis.
AgentCraft MCP Server
An MCP server that powers AI agents with indexed blockchain data from The Graph.





