ai-orchestration
CHAPTER 50 / 59
읽기 약 2분
FUNCTION
LangChain Expression Language (LCEL) 심화
핵심 개념
RunnableParallel · RunnableBranch · RunnablePassthrough · RunnableLambda · with_fallbacks · with_retry로 production 수준의 견고한 체인을 조립합니다.
코드 분석
LCEL 고급 패턴with_fallbacks (페일오버):primary = ChatAnthropic(model='claude-opus-4-7')fallback = ChatAnthropic(model='claude-sonnet-4-6')chain = (prompt | primary).with_fallbacks( [prompt | fallback])with_retry (자동 재시도):chain.with_retry( stop_after_attempt=3, wait_exponential_jitter=True)RunnableLambda (사이드 이펙트):def log(x): print('step:', x) return xchain = prompt | RunnableLambda(log) | llmconfigurable (런타임 모델 교체):llm.configurable_alternatives( ConfigurableField('model'), default_key='opus', sonnet=ChatAnthropic(...))AI 프롬프트
🤖 AI에게 잘 물어보는 법 — 모델·전략별 프롬프트
무료 모델
Gemini 2.5 Flash(무료) + Claude Sonnet 4.6(무료) + Grok 4.1(무료)
'LangChain Expression Language (LCEL) 심화'을 무료 도구로 익히고 싶어. Google AI Studio + Anthropic Workbench 무료 크레딧 + Dify(셀프호스팅)로 with_fallbacks/with_retry 무료 실습을 0원 안에 만드는 단계별 가이드를 짜줘.
소자본 모델
Claude Sonnet 4.6 + Vercel AI SDK 5 + Supabase — 월 10~30만원
'LangChain Expression Language (LCEL) 심화'을 월 20만원 예산으로 실서비스에 붙이고 싶어. Claude Sonnet 4.6 + Vercel AI SDK 5 + Supabase 조합으로 Sonnet 4.6 + LCEL configurable production 체인을 만드는 예제와 월 비용 분배를 짜줘.
프로덕션 모델
Claude Opus 4.7 + LangGraph + MCP + LangSmith — 월 100만원+
'LangChain Expression Language (LCEL) 심화'을 production 규모로 설계해줘. LangGraph + Claude Opus 4.7 + MCP + LangSmith로 Opus 4.7 + 다중 fallback + LangSmith production을 월 100만원+ 예산 기준으로 그려줘.
스택 프롬프트
0원 → $200/mo → $1000/mo 단계별 스택 비교
'LangChain Expression Language (LCEL) 심화' 3단계 스택 비교: Level 1($0, Dify+HF+무료 크레딧) → Level 2($200/mo, Sonnet 4.6+Vercel AI SDK+Supabase) → Level 3($1000/mo, LangGraph+Opus 4.7+MCP). 각 레벨에서 만들 수 있는 산출물과 한계 포함.
⭐ 이것만 기억하세요
LangChain Expression Language (LCEL) 심화는 이 3가지만 확실히 잡으세요
1.기본 LCEL만 알면 모델 페일오버·자동 재시도·런타임 교체 같은 production 요구를 외부에서 if/try로 감싸야 합니다
2.with_fallbacks · with_retry · configurable_alternatives 3종이면 99.9% 가용성과 비용 절감을 같은 체인 안에서 표현할 수 있습니다
3.다음 챕터에서 벡터 DB 3종(Pinecone/Chroma/Weaviate)을 비교합니다
공유하기
진행도 50 / 59