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
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
// Slide 06: Messages -- HumanMessage, AIMessage, SystemMessage, ToolMessage
|
||
// Code slide: the message contract, how to build multi-turn prompts.
|
||
|
||
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: 'Messages',
|
||
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/messages.py',
|
||
code: [
|
||
'from langchain.messages import (',
|
||
' HumanMessage, AIMessage, SystemMessage, ToolMessage,',
|
||
')',
|
||
'from langchain.chat_models import init_chat_model',
|
||
'',
|
||
'model = init_chat_model("openai:gpt-4.1-mini")',
|
||
'',
|
||
'messages = [',
|
||
' SystemMessage(content="You are a concise assistant."),',
|
||
' HumanMessage(content="What is LCEL?"),',
|
||
' AIMessage(content="LCEL = pipe-based composition in LangChain."),',
|
||
' HumanMessage(content="Show a one-line example."),',
|
||
']',
|
||
'',
|
||
'response = model.invoke(messages)',
|
||
'print(response.content)',
|
||
].join('\n'),
|
||
});
|
||
|
||
ds.helpers.addCallout(slide, pres, theme, {
|
||
x: 0.5, y: 4.85, w: 9.0, h: 0.3,
|
||
kind: 'info',
|
||
text: 'С v1.0 контент -- стандартизированные content blocks: reasoning traces, citations, tool_call блоки.',
|
||
});
|
||
|
||
ds.helpers.addSourceLine(slide, pres, theme, {
|
||
source: 'python.langchain.com/docs/concepts/messages/',
|
||
});
|
||
ds.helpers.addPageNumber(slide, pres, theme, 6);
|
||
}
|
||
|
||
module.exports = { createSlide }; |