mirror of
https://github.com/magnus919/agent-skills.git
synced 2026-09-21 08:36:33 +03:00
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>
23 lines
705 B
Python
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)
|