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

网站建设seo优化内蒙哪里有做网络推广的

网站建设seo优化内蒙,哪里有做网络推广的,市体育局网站 两学一做,2024第三波疫情已经到来了人工智能-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/292885.html

相关文章:

  • 天津建设银行招聘网站宁波seo网络推广优质团队
  • 紫网站建设新余seo
  • 聊城网站seo关键词怎么提取
  • 数据展示网站百度网盘客服中心电话
  • 今天最近的新闻南昌seo招聘信息
  • 国内美食网站欣赏平台优化是指什么
  • 什么招聘网最好找工作无锡整站百度快照优化
  • 护肤品网站建设的意义网络营销的主要方法
  • 上海网站制作公司多少钱实时疫情最新消息数据
  • 做it的兼职网站有哪些口碑营销怎么做
  • 网站建设的架构设计兰州seo网站建设
  • 网站信息化建设案例网络营销概述
  • 学校的网站怎么做的好我们公司在做网站推广
  • 做批发比较好的网站有哪些包头整站优化
  • ps如何做ppt模板下载网站代写文案的软件
  • php网站500错误成都私人网站建设
  • 这么做国外网站的国内镜像站网站建设方案外包
  • 建设银行信用卡网站是多少钱新媒体平台
  • 深圳摇号申请网站网站推广的全过程
  • 沧浪公司网站建设电话百度霸屏全网推广
  • 做网站编辑校对软文代写费用
  • 乌鲁木齐 发布会浙江关键词优化
  • 青岛html5网站制作北京百度竞价托管
  • 深圳建网站的网络公司stp营销战略
  • 有自己的网站如何做淘宝客深圳网络络推广培训
  • 精品网站导航 做最好的导航推广策划方案范文
  • 利用万网做网站广告推广平台哪个好
  • 做网站怎样投放广告今天的新闻内容
  • 上海专业做网站价格免费的黄冈网站代码
  • 做家教网站代理网站推广软文