Files
langchain-evolution-deck/slides/section5-ecosystem/slide-06.js
T
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

60 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Slide 06: Auto-tracing with LangChain + how to attach metadata/tags
// Code slide with highlight on the metadata/tags block.
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 5: ECOSYSTEM',
section: 'Tracing',
title: 'Auto-tracing LangChain + метаданные',
sectionNumber: 5,
titleSize: 24,
});
ds.helpers.addCodeBlockWithHighlight(slide, pres, theme, {
x: 0.5, y: 1.45, w: 9.0, h: 3.1,
language: 'python',
fontSize: 10,
code: [
'from langchain_openai import ChatOpenAI',
'from langchain_core.prompts import ChatPromptTemplate',
'',
'prompt = ChatPromptTemplate.from_template("Tell a joke about {topic}")',
'model = ChatOpenAI(model="gpt-4o-mini")',
'chain = prompt | model',
'',
'# auto-tracing: invoke/batch/stream автоматически создают Run',
'# с input, output, token usage, latency.',
'result = chain.invoke(',
' {"topic": "databases"},',
' config={',
' "run_name": "joke_chain", # имя в UI',
' "tags": ["prod", "experiment-v3"], # фильтр в UI',
' "metadata": { # любые поля',
' "user_id": "u_123",',
' "request_id": "req_abc",',
' },',
' },',
')',
].join('\n'),
lines: [12, 13, 14, 15, 16, 17, 18],
});
ds.helpers.addCallout(slide, pres, theme, {
x: 0.5, y: 4.65, w: 9.0, h: 0.4,
kind: 'success',
text: 'tags и metadata -- способ группировать и фильтровать trace-ы в UI по user/session/feature.',
});
ds.helpers.addSourceLine(slide, pres, theme, {
source: 'docs.smith.langchain.com Observability > Add metadata and tags',
});
ds.helpers.addPageNumber(slide, pres, theme, 6);
}
module.exports = { createSlide };