Files
petya 75601988c2 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
2026-06-22 11:29:03 +03:00

56 lines
1.9 KiB
JavaScript

// Slide 20: create_agent -- the unified agent entry point (v1.0)
// Code slide: a working agent in 10 lines.
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: 'Agents',
title: 'create_agent -- один вход для всех агентов',
sectionNumber: 1,
});
ds.helpers.addCodeBlock(slide, pres, theme, {
x: 0.5, y: 1.5, w: 9.0, h: 3.25,
language: 'python',
filePath: 'examples/agent_basic.py',
code: [
'from langchain.agents import create_agent',
'from langchain.tools import tool',
'',
'@tool',
'def get_weather(city: str) -> str:',
' """Get weather for a city."""',
' return f"Sunny, 22C in {city}"',
'',
'# Один вызов вместо create_react_agent / create_openai_functions_agent / ...',
'agent = create_agent(',
' model="openai:gpt-4.1",',
' tools=[get_weather],',
' system_prompt="You are a weather assistant.",',
')',
'',
'# invoke -> dict {"messages": [...]}; последнее сообщение = ответ',
'result = agent.invoke({"messages": [{"role": "user",',
' "content": "weather in Paris?"}]})',
'print(result["messages"][-1].content)',
].join('\n'),
});
ds.helpers.addCallout(slide, pres, theme, {
x: 0.5, y: 4.85, w: 9.0, h: 0.3,
kind: 'info',
text: 'Под капотом LangGraph-runtime: durable execution, checkpointing, human-in-the-loop доступны через middleware.',
});
ds.helpers.addSourceLine(slide, pres, theme, {
source: 'docs.langchain.com/oss/python/langchain/agents',
});
ds.helpers.addPageNumber(slide, pres, theme, 20);
}
module.exports = { createSlide };