Initial commit: LangChain evolution tutorial deck (132 slides)
- Cover, TOC, 5 dividers, 3 recap slides - 5 sections (chains, langgraph, deepagents, openswe, ecosystem) - design-system.js with theme tokens + 9 helper functions - research/: timeline + sources + per-tech notes - final-compile.js + merge.js for rebuild pipeline - output/: langchain-evolution.pptx (2.3 MB) + langchain-evolution.pdf (1.1 MB) + 7 sample previews
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// Slide 05: ChatModels -- provider routing through init_chat_model
|
||||
// Code slide: how to switch providers without changing call sites.
|
||||
|
||||
const ds = require('./design-system');
|
||||
|
||||
function createSlide(pres, theme) {
|
||||
const slide = pres.addSlide();
|
||||
ds.helpers.slideBase(slide, pres, theme);
|
||||
|
||||
ds.helpers.addHeader(slide, pres, theme, {
|
||||
eyebrow: 'STAGE 1: CHAINS',
|
||||
section: 'ChatModels',
|
||||
title: 'Переключение провайдера -- одна строка',
|
||||
sectionNumber: 1,
|
||||
});
|
||||
|
||||
ds.helpers.addCodeBlock(slide, pres, theme, {
|
||||
x: 0.5, y: 1.5, w: 9.0, h: 3.25,
|
||||
language: 'python',
|
||||
filePath: 'examples/multi_provider.py',
|
||||
code: [
|
||||
'from langchain.chat_models import init_chat_model',
|
||||
'',
|
||||
'# OpenAI',
|
||||
'm_openai = init_chat_model("openai:gpt-4.1-mini")',
|
||||
'',
|
||||
'# Anthropic',
|
||||
'm_anthropic = init_chat_model("anthropic:claude-3-7-sonnet-latest")',
|
||||
'',
|
||||
'# Google Vertex AI',
|
||||
'm_google = init_chat_model("google_vertexai:gemini-2.0-flash")',
|
||||
'',
|
||||
'# Все три -- объекты BaseChatModel. Один и тот же .invoke()',
|
||||
'for m in [m_openai, m_anthropic, m_google]:',
|
||||
' print(type(m).__name__, ":", m.invoke("ping").content[:30])',
|
||||
].join('\n'),
|
||||
});
|
||||
|
||||
// Bottom callout -- env vars
|
||||
ds.helpers.addCallout(slide, pres, theme, {
|
||||
x: 0.5, y: 4.85, w: 9.0, h: 0.3,
|
||||
kind: 'warning',
|
||||
text: 'Нужны API-ключи в env: OPENAI_API_KEY / ANTHROPIC_API_KEY / GOOGLE_API_KEY -- провайдер-пакет сам их подхватит.',
|
||||
});
|
||||
|
||||
ds.helpers.addSourceLine(slide, pres, theme, {
|
||||
source: 'python.langchain.com/docs/concepts/chat_models/',
|
||||
});
|
||||
ds.helpers.addPageNumber(slide, pres, theme, 5);
|
||||
}
|
||||
|
||||
module.exports = { createSlide };
|
||||
Reference in New Issue
Block a user