当前位置: 首页 > wzjs >正文

网络代理加盟如何百度seo算法

网络代理加盟如何,百度seo算法,高端网站制作服务,合肥庐江刚刚通告人工智能-LangGraphChatUIDeepSeek API搭建本地智能助手 0 环境说明1 LangGraph2 Agent Chat UI 0 环境说明 环境项环境说明操作系统Windows11 专业版硬件信息联想拯救者Y9000PcondaAnancondaPython版本3.12NodeJs18.20.0 # 使用conda创建python环境 conda create -n langgra…

人工智能-LangGraph+ChatUI+DeepSeek API搭建本地智能助手

    • 0 环境说明
    • 1 LangGraph
    • 2 Agent Chat UI

0 环境说明

环境项环境说明
操作系统Windows11 专业版
硬件信息联想拯救者Y9000P
condaAnanconda
Python版本3.12
NodeJs18.20.0
# 使用conda创建python环境
conda create -n langgraph python=3.12# 激活环境
conda activate langgraph# 下载依赖
pip install langchain-core langgraph -i https://pypi.tuna.tsinghua.edu.cn/simplepip install "langgraph-cli[inmem]" --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple

1 LangGraph

下载一个LangGraph Template项目

git clone https://github.com/langchain-ai/new-langgraph-project.git

修改配置文件

cd new-langgraph-project
cp .env.example .env

因为我使用的是DeepSeek API,所以需要配置 DEEPSEEK_API_KEY(上一步创建的DeepSeek API Key)

# To separate your traces from other application
LANGSMITH_PROJECT=new-agent# The following depend on your selected configuration## LLM choice:
# ANTHROPIC_API_KEY=....
# FIREWORKS_API_KEY=...
# OPENAI_API_KEY=...DEEPSEEK_API_KEY=your-deepseek-api-key

修改代码
src/agent/state.py

from __future__ import annotationsfrom typing_extensions import TypedDictfrom dataclasses import dataclass
from langchain_core.messages import AnyMessage
from langgraph.graph.message import add_messages
from typing import Annotated@dataclass
class State(TypedDict):messages: Annotated[list[AnyMessage], add_messages]

src/agent/configuration.py

"""Define the configurable parameters for the agent."""from __future__ import annotationsfrom dataclasses import dataclass, fields
from typing import Optionalfrom langchain_core.runnables import RunnableConfig@dataclass(kw_only=True)
class Configuration:model_name: str = "deepseek-chat"@classmethoddef from_runnable_config(cls, config: Optional[RunnableConfig] = None) -> Configuration:"""Create a Configuration instance from a RunnableConfig object."""configurable = (config.get("configurable") or {}) if config else {}_fields = {f.name for f in fields(cls) if f.init}return cls(**{k: v for k, v in configurable.items() if k in _fields})

src/agent/graph.py

from typing import Any, Dictfrom langchain_core.runnables import RunnableConfig
from langgraph.graph import StateGraph
from langchain_deepseek import ChatDeepSeek
from agent.configuration import Configuration
from agent.state import Statemodel = ChatDeepSeek(model="deepseek-chat",temperature=0,max_tokens=None,timeout=None,max_retries=2,
)def call_model(state, config):response = model.invoke(state["messages"])# We return a list, because this will get added to the existing listreturn {"messages": [response]}# Define a new graph
workflow = StateGraph(State, config_schema=Configuration)# Add the node to the graph
workflow.add_node("call_model", call_model)# Set the entrypoint as `call_model`
workflow.add_edge("__start__", "call_model")# Compile the workflow into an executable graph
graph = workflow.compile()
graph.name = "New Graph"  # This defines the custom name in LangSmith

接下来就可以启动项目了:

# 安装依赖
pip install -qU langchain-deepseek -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple# 启动项目
langgraph dev

启动的运行日志如下图:
在这里插入图片描述
启动完毕后,会自动弹出浏览器打开langsmith跟踪页面,如下图:
在这里插入图片描述

API文档地址(http://127.0.0.1:2024/docs)访问如下图:
在这里插入图片描述

2 Agent Chat UI

前端项目基于NodeJS。

  • NodeJs版本 ≥ 18.12 我用的版本是 18.20.0

下载agent-chat-ui项目

git clone https://github.com/langchain-ai/agent-chat-ui.gitcd agent-chat-ui# 先安装pnpm
npm install -g pnpm# 安装项目依赖
pnpm install# 启动项目
pnpm dev

安装项目依赖过程如下图:
在这里插入图片描述
在这里插入图片描述

项目启动日志如下:
在这里插入图片描述
启动后可以通过浏览器输入: http://localhost:5173访问,如下图:
在这里插入图片描述

点击 Continue 进入对话界面,如下图:
在这里插入图片描述
在这里插入图片描述

http://www.dtcms.com/wzjs/493653.html

相关文章:

  • 微信开发小程序需要多少钱银徽seo
  • 天元建设集团有限公司办公室电话西安做推广优化的公司
  • 相关文章wordpress网站关键词优化排名软件
  • 可以做百度百科参考资料的网站seo标题优化分析范文
  • 想建个图片网站今天疫情最新消息
  • 技校计算机专业主要学什么无锡百度关键词优化
  • 做网站用phpcms还是免费的建站平台
  • asp网站发布ftp今日的新闻
  • 在线学做衣服 的网站百度竞价排名怎么做
  • 德兴市网站建设服务公司google网页搜索
  • 注册深圳公司流程及费用郑州seo全网营销
  • 查询系统网站模板成都网络推广哪家好
  • 课程网站建设特色谷歌浏览器网页版进入
  • 1920网站banner背景网络推广和网站推广平台
  • 文昌市住房和城乡建设局网站百度文库官网入口
  • 网站用什么软件做网络营销代运营外包公司
  • 网站打开速度优化seo排名的公司
  • 网上最好的网站模块seo根据什么具体优化
  • 站长工具seo综合查询隐私查询seo高级优化技巧
  • 怎么查网站的关键词seo排名优化培训网站
  • 绍兴网站建设houqiweb深圳网站seo哪家快
  • 北京网站设计精选柚v米科技seo整站优化什么价格
  • 训做网站的心得体会范文百度快照功能
  • 现在网站开发用什么语言超级外链发布工具
  • wordpress怎么重新配置文件seo诊断书
  • 临朐网站建设价格100%能上热门的文案
  • 装修平台自己做网站有几个口碑营销策略
  • 关于网站建设毕业论文8000字临沂seo公司
  • 网站开发立项百度关键词排名优化工具
  • 代办公司注册价格百度seo点击工具