Files
magnus919_agent-skills/langchain/templates/production-deploy.py
T
Magnus Hedemark fe3be63800 feat: add langchain — expert LangChain framework skill
Greenfield SkillOpt: 3 epochs optimizing discoverability, decision
guidance, and troubleshooting for a brand-new LangChain skill.

Epoch 1 — Prominence:
- Added critical AgentExecutor deprecation callout at top
- Framework Routing Guide for cross-portfolio decisions

Epoch 2 — Decision Guidance:
- Where to Start table with AgentExecutor migration row
- Pipeline Mode table (Quick/RAG/Agent/Production)

Epoch 3 — Pattern Expansion:
- Troubleshooting table with reference file links
- FAQ section covering installation, migration, performance

13 files: SKILL.md, 7 references, 4 templates, 1 script.
v1.0.0 -> v1.0.3 across 3 SkillOpt epochs.

Signed-off-by: Magnus Hedemark <magnus919@pm.me>
2026-07-09 14:13:34 -04:00

23 lines
705 B
Python

#!/usr/bin/env python3
"""Deploy a LangChain chain via LangServe."""
import os
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_PROJECT"] = "my-rag-app"
from fastapi import FastAPI
from langserve import add_routes
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
prompt = ChatPromptTemplate.from_template("Answer: {question}")
model = ChatOpenAI(model="gpt-4o-mini")
chain = prompt | model | StrOutputParser()
app = FastAPI(title="LangChain RAG API")
add_routes(app, chain, path="/rag")
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8080)