Skip to Content
RAG with Python 쿡북 (Korean Edition)
book

RAG with Python 쿡북 (Korean Edition)

by Dominik Polzer
May 2026
Intermediate
378 pages
5h 49m
Korean
O'Reilly Media, Inc.
Content preview from RAG with Python 쿡북 (Korean Edition)

11장. RAG 웹 앱

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

대부분의 생성형 AI 프로젝트는 실험 단계에서 시작되며, 그중 대부분은 실제 운영 단계까지 이르지 못합니다. 특히 팀에 풀스택 엔지니어링 지원이 부족한 경우, 신속한 프로토타이핑이 중요합니다. 데이터 과학자가 RAG 기반 앱을 구축하고, 실제 사용자가 운영 인프라에 적용하기 전에 테스트해 볼 수 있는 환경이 필요합니다.

Streamlit은 신속한 웹 앱 개발을 위한 Python 프레임워크입니다. 이 프레임워크를 사용하면 프론트엔드와 백엔드를 아우르는 단일 스크립트로 기능적인 인터페이스를 구축할 수 있습니다. 또한 저수준 웹 개발 없이도 조립할 수 있는 사전 구축된 컴포넌트를 제공하지만, Streamlit이 현재 제공하는 기능으로만 제한됩니다.

Streamlit은 사용자의 모든 상호작용 시 전체 스크립트를 다시 실행합니다. 이는 개발을 단순화하지만, 수십 명의 동시 사용자 이상으로는 확장되지 않는 오버헤드를 발생시킵니다. GenAI 앱이 가치를 제공하는지 검증하는 데 있어서는 이러한 장단점이 오히려 유리하게 작용합니다.

수천 명 또는 수백만 명의 사용자를 수용하는 프로덕션 애플리케이션의 경우, 다른 프레임워크가 더 나은 확장성과 성능을 제공합니다. Django는 인증 및 복잡한 워크플로우를 포함한 모든 기능을 제공합니다. Flask 는 가볍고 유연한 기반을 제공합니다. FastAPI 는 API 엔드포인트에 최적화되어 있습니다.

이 장의 실습 예제는 단계적으로 구성됩니다. 먼저 프레임워크의 핵심 메커니즘을 이해하기 위해 기본적인 Streamlit 앱을 만든 다음, 작동하는 RAG 챗봇을 구축하고, 마지막으로 문서 업로드 및 쿼리를 처리하도록 확장해 나갈 것입니다.

RAG이 등장한 초기에는 더 간단한 인터페이스가 더 효과적일 수 있는 경우에도 많은 애플리케이션이 챗봇을 기본으로 채택했습니다. 대시보드나 검색 인터페이스가 종종 더 빠르고 직관적입니다. 챗 인터페이스를 선택하기 전에, 사용 사례에 대화형 상호작용이 실제로 도움이 되는지 고려해 보십시오.

이 장의 모든 코드 예제는 책의 GitHub 저장소에서 확인할 수 있습니다.

11.1 첫 번째 Streamlit 앱 만들기

문제

웹 개발자는 아니지만, 아이디어를 빠르게 웹 앱으로 구현하여 배포하고 싶습니다.

해결책

Streamlit은 단 하나의 스크립트와 몇 줄의 코드만으로 완벽하게 작동하는 웹 앱을 구축할 수 있게 해주는 Python 웹 프레임워크입니다. 이 레시피를 따라 하려면 Streamlit을 설치하세요:

pip install streamlit

제목, 텍스트 입력란, 그리고 사용자의 입력을 화면에 출력하는 섹션을 표시하는 기본적인 Streamlit 앱을 만들어 봅시다:

import streamlit as st

st.title("Simple Chatbot")
user_input = st.text_input("You:" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Tips for Designing Effective Presentation Slide Decks

Tips for Designing Effective Presentation Slide Decks

Curtis Newbold
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
Three Essentials for Agentic AI Security

Three Essentials for Agentic AI Security

Paolo Dal Cin, Daniel Kendzior, Yusof Seedat, Renato Marinho
How to Overcome a Power Deficit

How to Overcome a Power Deficit

Cyril Bouquet, Jean-Louis Barsoux

Publisher Resources

ISBN: 0642572383596