// 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 };