游侠网云服务,免实名免备案服务器 游侠云域名,免实名免备案域名

统一声明:

1.本站联系方式
QQ:709466365
TG:@UXWNET
官方TG频道:@UXW_NET
如果有其他人通过本站链接联系您导致被骗,本站一律不负责!

2.需要付费搭建请联系站长QQ:709466365 TG:@UXWNET
3.免实名域名注册购买- 游侠云域名
4.免实名国外服务器购买- 游侠网云服务

Search Powered by Algolia Search Log in Create account DEV Community Close Add reaction Like Unicorn Exploding Head Raised Hands Fire Jump to Comments Save Boost More… Copy link Copy link Copied to Clipboard Share to X Share to LinkedIn Share to Facebook Share to Mastodon Share Post via… Report Abuse kanta13jp1 Posted on Apr 28

When you decide to build an AI agent, the first question is “what do I use?” I’ve run all three in production. Here’s the honest breakdown.

Dify: No-code/low-code / prototypes / non-engineer teams LangChain: Python / complex chains / OSS ecosystem needed Raw API: Production / full control / Flutter + Supabase integration Enter fullscreen mode Exit fullscreen mode My project landed on raw API (Anthropic SDK + Deno Edge Function).

# Dify workflow design view [Input] → [LLM Node] → [Condition Branch] → [Tool Node] → [Output] Enter fullscreen mode Exit fullscreen mode Dify lets you build flows in a GUI. Its biggest strength: working prototype in 3 days.

✅ Use Dify when: – Non-engineers need to edit workflows – You want to test a RAG pipeline fast – You don’t want to manage hosting/infra ❌ Not Dify when: – You need tight integration with existing code – Custom logic is complex – Dify’s execution cost is climbing Enter fullscreen mode Exit fullscreen mode When LangChain Wins from langchain.agents import initialize_agent, Tool from langchain.chat_models import ChatAnthropic tools = [ Tool(name=”search”, func=search_fn, description=”Web search”), Tool(name=”calculator”, func=calc_fn, description=”Math”), ] agent = initialize_agent(tools, ChatAnthropic(model=”claude-haiku-4-5″), …) result = agent.run(“What’s the weather in Tokyo today?”) Enter fullscreen mode Exit fullscreen mode LangChain’s Python ecosystem is powerful. Rich integrations for Vector Store / Retriever / Memory.

✅ Use LangChain when: – Building a serious RAG pipeline – Need to swap between multiple LLMs – Python-based data pipelines already exist ❌ Not LangChain when: – Flutter/Dart/Deno is your main stack — bindings are thin – Simple API calls — overhead is disproportionate Enter fullscreen mode Exit fullscreen mode When Raw API Wins (My Choice) // Deno Edge Function implementation const response = await fetch(‘https://api.anthropic.com/v1/messages’, { method: ‘POST’, headers: { ‘x-api-key’: Deno.env.get(‘ANTHROPIC_API_KEY’)!, ‘anthropic-version’: ‘2023-06-01’, ‘content-type’: ‘application/json’, }, body: JSON.stringify({ model: ‘claude-haiku-4-5-20251001’, max_tokens: 1024, messages: [{ role: ‘user’, content: userMessage }], }), }); const data = await response.json(); return data.content[0].text; Enter fullscreen mode Exit fullscreen mode Why I chose raw API:

Want to build an AI agent? ↓ Non-engineers editing workflows? Yes → Dify No ↓ Python is your main stack? Yes → LangChain No ↓ Tight integration with existing stack needed? Yes → Raw API No → Dify (as prototype) Enter fullscreen mode Exit fullscreen mode Tool Use (Function Calling) Pattern Using Tool Use with raw API:

const tools = [ { name: “get_race_data”, description: “Fetch horse racing data”, input_schema: { type: “object”, properties: { race_id: { type: “string”, description: “Race ID” }, date: { type: “string”, description: “Date in YYYY-MM-DD” }, }, required: [“race_id”], }, }, ]; const response = await fetch(‘https://api.anthropic.com/v1/messages’, { method: ‘POST’, headers: { ‘x-api-key’: API_KEY, ‘anthropic-version’: ‘2023-06-01’, ‘content-type’: ‘application/json’ }, body: JSON.stringify({ model: ‘claude-sonnet-4-6’, max_tokens: 2048, tools, messages: [{ role: ‘user’, content: ‘Predict tomorrow\’s Nakayama races’ }], }), }); Enter fullscreen mode Exit fullscreen mode When Claude decides it should call get_race_data, it returns a tool_use block. Your code handles the dispatch.

function selectModel(taskType: string): string { switch (taskType) { case ‘simple_qa’: return ‘claude-haiku-4-5-20251001’; // $0.00025/1K case ‘analysis’: return ‘claude-sonnet-4-6’; // $0.003/


📌 本文来源:dev.to
🔗 原文链接:点击查看原文全文