17.9k Star!Langflow :LLM开源低代码工具、拖放式UI定制AI Agent,支持与LangChain协作!

部署运行你感兴趣的模型镜像

cover_image
原文链接(更好排版、视频播放、社群交流):17.9k Star!Langflow :LLM开源低代码工具、拖放式UI定制AI Agent,支持与LangChain协作!

17.9k Star!Langflow :LLM开源低代码工具、拖放式UI定制AI Agent,支持与LangChain协作!

🌟 LangChain 是一个热门的LLM开源项目,它可以更容易地将大语言模型的功能与应用程序的逻辑结合起来。
然而,如果没有用户友好的界面,设计和测试LangChain流可能是具有挑战性的。

LangFlow
是一个针对LangChain的GUI,它采用了反应流设计,提供了一种轻松的方式,通过拖放组件和聊天框来实验和原型化流程,将llm嵌入到您的应用程序中,无需代码。

LangFlow允许您探索不同的大语言模型、prompt参数、链配置和代理行为,并跟踪代理的思维过程。您还可以将流导出为JSON文件,
以便与LangChain一起使用。

⚡️Langflow构建的对话应用

Langflow构建的对话应用的一些例子

  • • 文档:https://docs.langflow.org

  • • Discord:https://discord.com/invite/EqksyE2EX9

创建流程

Langflow 提供了 一系列LangChain 组件 可供选择,包括 LLM、提示序列化器、代理和链。

创建流程的地址

https://docs.langflow.org/getting-started/creating-flows

下面是视频教程以及地址:

https://www.youtube.com/watch?v=sC9SV06gsDM

API使用方法

您可以直接在浏览器中使用Langflow,也可以使用Jina AI Cloud上的API端点与服务器进行交互。

用Python API的使用方式:

import requests  
  
BASE_API_URL = "https://langflow-e3dd8820ec.wolf.jina.ai/api/v1/predict"  
FLOW_ID = "864c4f98-2e59-468b-8e13-79cd8da07468"  
# You can tweak the flow by adding a tweaks dictionary  
# e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}}  
TWEAKS = {  
"ChatOpenAI-g4jEr": {},  
"ConversationChain-UidfJ": {}  
}  
  
def run_flow(message: str, flow_id: str, tweaks: dict = None) -> dict:  
  """  
  Run a flow with a given message and optional tweaks.  
  
  :param message: The message to send to the flow  
  :param flow_id: The ID of the flow to run  
  :param tweaks: Optional tweaks to customize the flow  
  :return: The JSON response from the flow  
  """  
  api_url = f"{BASE_API_URL}/{flow_id}"  
  
  payload = {"message": message}  
  
  if tweaks:  
      payload["tweaks"] = tweaks  
  
  response = requests.post(api_url, json=payload)  
  return response.json()  
  
# Setup any tweaks you want to apply to the flow  
print(run_flow("Your message", flow_id=FLOW_ID, tweaks=TWEAKS))

返回结果示例:

{  
  "result": "Great choice! Bangalore in the 1920s was a vibrant city with a rich cultural and political scene. Here are some suggestions for things to see and do:\n\n1. Visit the Bangalore Palace - built in 1887, this stunning palace is a perfect example of Tudor-style architecture. It was home to the Maharaja of Mysore and is now open to the public.\n\n2. Attend a performance at the Ravindra Kalakshetra - this cultural center was built in the 1920s and is still a popular venue for music and dance performances.\n\n3. Explore the neighborhoods of Basavanagudi and Malleswaram - both of these areas have retained much of their old-world charm and are great places to walk around and soak up the atmosphere.\n\n4. Check out the Bangalore Club - founded in 1868, this exclusive social club was a favorite haunt of the British expat community in the 1920s.\n\n5. Attend a meeting of the Indian National Congress - founded in 1885, the INC was a major force in the Indian independence movement and held many meetings and rallies in Bangalore in the 1920s.\n\nHope you enjoy your trip to 1920s Bangalore!"  
}

下面提供官方的 文档介绍、相关资源、部署教程 等,进一步支撑你的行动,以提升本文的帮助力。

📦 安装

您可以使用 pip 安装 Langflow:

# 确保您的系统上安装了 Python 3.10。  
# 安装预发布版本  
python -m pip install langflow --pre --force-reinstall  
  
# 或者稳定版本  
python -m pip install langflow -U

然后,运行 Langflow:

python -m langflow run

您还可以在 HuggingFace Spaces 中预览 Langflow。 使用此链接克隆空间 ,在几分钟内创建您自己的 Langflow
工作区。

🎨 创建流程

使用 Langflow 创建流程很容易。只需从侧边栏拖动组件到画布上并连接它们,即可开始构建您的应用程序。

通过编辑提示参数、将组件分组到单个高级组件中以及构建您自己的自定义组件来进行探索。

完成后,您可以将流程导出为 JSON 文件。

使用以下代码加载流程:

from langflow.load import run_flow_from_json  
  
results = run_flow_from_json("path/to/flow.json", input_value="Hello, World!")

🖥️ 命令行界面(CLI)

Langflow 提供了一个命令行界面(CLI),用于简化管理和配置。

用法

您可以使用以下命令运行 Langflow:

langflow run [OPTIONS]

环境变量

您可以使用环境变量配置许多 CLI 选项。这些可以在您的操作系统中导出,或者添加到 .env 文件中,并使用 --env-file
选项加载。

项目中包含了一个名为 .env.example 的示例 .env 文件。将此文件复制到名为 .env
的新文件中,并将示例值替换为您的实际设置。如果您同时在操作系统和 .env 文件中设置值,则 .env 设置将优先。

部署

在 Google Cloud Platform 上部署 Langflow

参考链接 :

https://github.com/langflow-ai/langflow

知音难求,自我修炼亦艰

抓住前沿技术的机遇,与我们一起成为创新的超级个体

(把握AIGC时代的个人力量)

**
**

** 点这里👇关注我,记得标星哦~ **

**
**

一键三连「分享」、「点赞」和「在看」

科技前沿进展日日相见 ~

预览时标签不可点

微信扫一扫
关注该公众号

轻触阅读原文

AI进修生



收藏

您可能感兴趣的与本文相关的镜像

LangFlow

LangFlow

AI应用
Agent编排

LangFlow 是一款低代码、可视化的 AI 应用构建工具,用于快速搭建和实验 LangChain 流水线

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Aitrainee

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值