Skip to Content
엔터프라이즈 Java 개발을 위한 응용 AI (Korean Edition)
book

엔터프라이즈 Java 개발을 위한 응용 AI (Korean Edition)

by Alex Soto Bueno, Markus Eisele, Natale Vinto
November 2025
Beginner to intermediate
430 pages
6h 48m
Korean
O'Reilly Media, Inc.
Content preview from 엔터프라이즈 Java 개발을 위한 응용 AI (Korean Edition)

제12장. AI Java 개발의고급 주제

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

이전 장들에서 살펴본 바와 같이, LangChain4j 및 LangGraph4j와 같은 도구 덕분에 Java를 활용한 AI 애플리케이션 개발 환경은 크게 진화했습니다. 지금까지 여러분은 지능형 챗봇을 구축하고, 벡터 저장소를 탐색하며, AI 워크플로를 조정하고, 심지어 애플리케이션에 이미지 인식 기능을 통합해 보았습니다. 그러나 이제 생산 환경에 적합하고 안전하며 확장 가능한 AI 시스템으로 나아가기 위해 몇 가지 고급 주제를 더 탐구해야 합니다.

이 장에서는 기능성 프로토타입에서 견고한 엔터프라이즈급 솔루션으로 AI 애플리케이션을 한 단계 끌어올리는 마지막 핵심 도구들을 제공합니다. 앞으로의 내용에서는 세 가지 강력한 기능을 살펴보겠습니다:

스트림

애플리케이션은 모델이 완전한 응답을 생성할 때까지 기다리지 않고, 모델이 생성하는 대로 응답을 점진적으로 수신합니다.

가드레일

이러한 안전 장치를 사용하여 LLM의 입력/출력이 요구 사항에 부합하는지 확인할 수 있습니다.

모델 컨텍스트 프로토콜

이 개방형 표준은 애플리케이션이 언어 모델과 상호 작용하는 방법, 특히 컨텍스트, 도구 및 메모리 관리에 관한 방법을 정의합니다.

각 기능은 현대 AI 애플리케이션의 핵심 기둥인 품질, 복원력, 유지 보수성을 강화합니다. LangChain4j를 활용하여 이러한 기능을 어떻게 활용하여 Java AI 솔루션을 미래에 대비할 수 있는지 살펴보겠습니다.

스트리밍

LLMs 은 텍스트를 점진적으로(토큰 단위로) 생성합니다. 이러한 이유로 많은 모델 제공업체는 사용자가 전체 완료를 기다릴 필요 없이 실시간 스트리밍 응답을 지원합니다.

이를 통해 사용자는 예측할 수 없는 지연에 직면하지 않고 거의 즉시 출력을 읽기 시작할 수 있으므로 더 원활한 경험을 할 수 있습니다. 이는 챗봇을 구현하고 사용자에게 빠른 피드백을 제공하는 매우 편리한 방법입니다.

LangChain4j 저수준 API를 사용하여 응답 스트리밍의 첫 번째 예제를 구현해 보겠습니다.

저수준 API를 통한 스트리밍

에서 가장 먼저 눈에 띄는 변경점 은 ChatModel 인터페이스 대신 dev.langchain4j.model.chat​.Stream⁠ingChatModel 인터페이스의 사용입니다. 모델 종속성을 추가하고 구체적인 빌더를 사용하여 StreamingChatModelChatModel 인스턴스와 유사한 코드로 인스턴스를 생성합니다. 모델 종속성을 추가하고 구체적인 빌더를 사용하면 됩니다. 예를 들어 OpenAI의 경우 dev.langchain4j.model.openai.OpenAiStreamingChatModel 클래스를 사용합니다:

StreamingChatModel model = OpenAiStreamingChatModel.builder() 
 .apiKey("demo")
 .baseUrl("http://langchain4j.dev/demo/openai/v1 ...
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

AI 시스템 성능 엔지니어링 (Korean Edition)

AI 시스템 성능 엔지니어링 (Korean Edition)

Chris Fregly
생성형 AI를 위한 프롬프트 엔지니어링

생성형 AI를 위한 프롬프트 엔지니어링

제임스 피닉스, 마이크 테일러
AI 에이전트를 위한 메모리 관리

AI 에이전트를 위한 메모리 관리

Benjamin Labaschin, Jim Allen Wallace, Andrew Brookins, Manvinder Singh

Publisher Resources

ISBN: 0642572279882