
目录

Dify 是一个开源 LLM 应用程序开发平台。 Dify 的直观界面结合了 AI 工作流程、RAG 管道、代理功能、模型管理、可观察性功能等,让您快速从原型转向生产。

Dify 是一个开源大语言模型 (LLM) 应用程序开发平台。它结合了后端即服务和 LLMOps 的概念,使开发人员能够快速构建生产级的生成式 AI 应用程序。即使非技术人员也可以参与人工智能应用的定义和数据操作。
通过集成构建 LLM 应用所需的关键技术栈,包括对数百种模型的支持、直观的 Prompt 编排界面、高质量的 RAG 引擎和灵活的 Agent 框架,同时提供一组易于使用的接口和 API ,Dify 为开发人员节省了大量重新发明轮子的时间,让他们能够专注于创新和业务需求。
你可以把像 LangChain 这样的库想象成一个带有锤子、钉子等的工具箱。相比之下,Dify 提供了一个更适合生产的、完整的解决方案——把 Dify 想象成一个具有精细工程设计和软件测试的脚手架系统。
重要的是,Dify 是开源的,由专业的全职团队和社区共同创建。您可以基于任何模型自行部署类似于 Assistants API 和 GPT 的功能,以灵活的安全性保持对数据的完全控制,所有这些都在易于使用的界面上进行。

#下载
git clone https://github.com/langgenius/dify.git
cd dify/docker
#基本配置
cp .env.example .env
#启动
docker compose up -d
#查看容器
docker compose ps
#查看日志
docker compose logs
























Nvidia: 代理是一个具有复杂推理能力、记忆和执行任务手段的系统。 langchain: 代理的核心思想是使用语言模型来选择要采取的一系列操作。在代理中,语言模型被用作推理引擎来确定要采取哪些操作以及按什么顺序 百度 智能体(Agent)是人工智能领域中的一个核心概念。它能够在其所处的环境中自主地感知信息,并根据这些信息做出决策,以实现特定的目标或任务。









from fastapi import FastAPI, Body, HTTPException, Header
from pydantic import BaseModel
app = FastAPI()
class InputData(BaseModel):
point: str
params: dict = {}
@app.post("/api/dify/receive")
async def dify_receive(data: InputData = Body(...), authorization: str = Header(None)):
"""
Receive API query data from Dify.
"""
expected_api_key = "123456"# TODO Your API key of this API
auth_scheme, _, api_key = authorization.partition(' ')
if auth_scheme.lower() != "bearer" or api_key != expected_api_key:
raise HTTPException(status_code=401, detail="Unauthorized")
point = data.point
# for debug
print(f"point: {point}")
if point == "ping":
return {
"result": "pong"
}
if point == "app.external_data_tool.query":
return handle_app_external_data_tool_query(params=data.params)
# elif point == "{point name}":
# TODO other point implementation here
raise HTTPException(status_code=400, detail="Not implemented")
def handle_app_external_data_tool_query(params: dict):
app_id = params.get("app_id")
tool_variable = params.get("tool_variable")
inputs = params.get("inputs")
query = params.get("query")
# for debug
print(f"app_id: {app_id}")
print(f"tool_variable: {tool_variable}")
print(f"inputs: {inputs}")
print(f"query: {query}")
# TODO your external data tool query implementation here,
# return must be a dict with key "result", and the value is the query result
if inputs.get("location") == "London":
return {
"result": "City: London\nTemperature: 10°C\nRealFeel®: 8°C\nAir Quality: Poor\nWind Direction: ENE\nWind "
"Speed: 8 km/h\nWind Gusts: 14 km/h\nPrecipitation: Light rain"
}
else:
return {"result": "Unknown city"}面向自动化和批处理场景,适用于高质量翻译、数据分析、内容生成、电子邮件自动化等。




将复杂的工作流发布为工具,可以为其他的 agent 提供服务




原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。