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

网站建设方案是什么意思怎么制作网站?

网站建设方案是什么意思,怎么制作网站?,淄博做网站推广哪家好,四川建设网和四川省公共资源交易信息网人工智能-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/252840.html

相关文章:

  • 做网站更赚钱吗建设网站推广
  • 梅州建站联系方式如何创建自己的小程序
  • 邵东网站建设成人大专
  • 淮北公司做网站互联网营销顾问
  • 陕西做网站公司有哪些网络宣传
  • cms代码做网站视频广告联盟平台
  • 网站建设思路方案建立网站的详细步骤
  • wordpress网站如何引流郑州做网络优化的公司
  • 电子商务网站建设的简要任务执行书小红书信息流广告
  • 郑州营销网站公司地址app推广有哪些渠道
  • 企业vi设计需求企业seo网络推广
  • 西安app开发公司排名seo优化推广工程师
  • 杨浦手机网站建设友情链接
  • 做效果图去哪个网站接活关键词挖掘网站
  • 深圳国内设计网站app投放推广
  • h5网站开发框架百度 营销怎么收费
  • 嘉兴网站建设托管网站seo分析工具
  • html+css网站模板免费网络推广软件有哪些
  • 网站开发如何处理兼容性问题在线网站流量查询
  • 网易免费企业邮箱登录入口杭州新站整站seo
  • 淘客网站是怎么做的互联网推广方案
  • 昆山高端网站建设机构江门百度seo公司
  • 东莞微信网站建设怎样免费的域名和网站
  • 建旅游网站多少钱网址查询ip地址
  • 如何自己制作公众号网站优化关键词公司
  • flask做的网站项目怎样做平台推广
  • 呼和浩特建设网站优化营商环境发言稿
  • 网络服务提供者知道或者应当知道网络用户利用其网络seo关键词排名软件流量词
  • 南京模板建站哪家好哈尔滨seo网络推广
  • 成都定制网站建设服务公司网站seo谷歌