75601988c2
- 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
85 lines
3.0 KiB
JavaScript
85 lines
3.0 KiB
JavaScript
// Slide 25: TypeScript status -- what is and isn't there in JS land
|
|
// Content slide: parity matrix and code sketch.
|
|
|
|
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: 'TypeScript',
|
|
title: 'JS-аналог: что есть, чего нет',
|
|
sectionNumber: 1,
|
|
});
|
|
|
|
// Code block: TS sample
|
|
ds.helpers.addCodeBlock(slide, pres, theme, {
|
|
x: 0.5, y: 1.5, w: 5.5, h: 3.25,
|
|
language: 'typescript',
|
|
filePath: 'examples/ts_basic.ts',
|
|
code: [
|
|
'import { initChatModel } from "langchain/chat_models/universal";',
|
|
'import { createAgent } from "langchain/agents";',
|
|
'import { tool } from "@langchain/core/tools";',
|
|
'import { z } from "zod";',
|
|
'',
|
|
'const getWeather = tool(',
|
|
' async ({ city }) => `Sunny, 22C in ${city}`,',
|
|
' { name: "get_weather", description: "Get weather",',
|
|
' schema: z.object({ city: z.string() }) },',
|
|
');',
|
|
'',
|
|
'const model = await initChatModel("openai:gpt-4.1");',
|
|
'const agent = createAgent({ model, tools: [getWeather] });',
|
|
'const result = await agent.invoke({',
|
|
' messages: [{ role: "user", content: "weather in Paris?" }],',
|
|
'});',
|
|
].join('\n'),
|
|
});
|
|
|
|
// Right column: parity list
|
|
slide.addText('Что есть в @langchain/langchain:', {
|
|
x: 6.2, y: 1.5, w: 3.3, h: 0.35,
|
|
fontFace: ds.helpers.withFallback(theme.fonts.ui),
|
|
fontSize: 13, bold: true,
|
|
color: theme.palette.accent.primary, margin: 0,
|
|
});
|
|
|
|
const have = [
|
|
'+ initChatModel',
|
|
'+ createAgent',
|
|
'+ @langchain/core (tools, prompts, parsers)',
|
|
'+ LCEL и Runnable-протокол',
|
|
'+ Стандартизированные Messages',
|
|
'+ Vector store интеграции',
|
|
].map((t) => ({ text: t + '\n', options: { fontFace: ds.helpers.withFallback(theme.fonts.ui), fontSize: 11, color: theme.palette.text.primary } }));
|
|
slide.addText(have, {
|
|
x: 6.2, y: 1.9, w: 3.3, h: 1.3,
|
|
valign: 'top', paraSpaceAfter: 3, margin: 0,
|
|
});
|
|
|
|
slide.addText('Чего нет или слабее:', {
|
|
x: 6.2, y: 3.3, w: 3.3, h: 0.35,
|
|
fontFace: ds.helpers.withFallback(theme.fonts.ui),
|
|
fontSize: 13, bold: true,
|
|
color: theme.palette.state.warning, margin: 0,
|
|
});
|
|
const miss = [
|
|
'- langchain-classic покрытие уже',
|
|
'- Часть community-интеграций',
|
|
'- Tracing middleware меньше',
|
|
].map((t) => ({ text: t + '\n', options: { fontFace: ds.helpers.withFallback(theme.fonts.ui), fontSize: 11, color: theme.palette.text.primary } }));
|
|
slide.addText(miss, {
|
|
x: 6.2, y: 3.7, w: 3.3, h: 1.0,
|
|
valign: 'top', paraSpaceAfter: 3, margin: 0,
|
|
});
|
|
|
|
ds.helpers.addSourceLine(slide, pres, theme, {
|
|
source: 'js.langchain.com/docs/how_to/chat_models_universal_init',
|
|
});
|
|
ds.helpers.addPageNumber(slide, pres, theme, 25);
|
|
}
|
|
|
|
module.exports = { createSlide }; |