Elasticsearch:基于 Langchain 的 Elasticsearch Agent 对文档的搜索

news2024/9/19 19:51:58

在今天的文章中,我们将重点介绍如何使用 LangChain 提供的基础设施在 Python 中构建 Elasticsearch agent。 该 agent 应允许用户以自然语言询问有关 Elasticsearch 集群中数据的问题。

Elasticsearch 是一个强大的搜索引擎,支持词法和向量搜索。 ElasticSearch 可以在 RAG(检索增强生成)的上下文中使用,但这不是我们在本故事中的主题。 因此,我们不会使用 Elasticsearch 检索文档来创建注入提示中的上下文。 相反,我们在 agent 的上下文中使用 Elasticsearch,即我们正在构建一个 agent,它以自然语言与 Elasticsearch 进行通信,并执行搜索和聚合查询并解释这些查询。

为了方便大家学习,我们需要克隆如下的两个代码仓库:

  • GitHub - liu-xiao-guo/elasticsearch-agent: ElasticSearch agent based on ElasticSearch, LangChain and ChatGPT 4
  • GitHub - liu-xiao-guo/elasticsearch-agent-chainlit: Provides a simple UI for the ElasticSearch LangChain Agent

安装

安装 Elasticsearch 及 Kibana

如果你还没有安装好自己的 Elasticsearch 及 Kibana,那么请参考一下的文章来进行安装:

  • 如何在 Linux,MacOS 及 Windows 上进行安装 Elasticsearch

  • Kibana:如何在 Linux,MacOS 及 Windows 上安装 Elastic 栈中的 Kibana

在安装的时候,请选择 Elastic Stack 8.x 进行安装。在安装的时候,我们可以看到如下的安装信息:

  

我们记下上面的 elastic 用户密码以及 fingerprint 的值。它们将在下面的配置中进行使用。

构建代理的秘诀

Elasticsearch agent

如果我们从如何编译 agent 的角度来看,我们将拥有以下成分:

  • LLM(大型语言模型):你可以使用使用 ChatGPT 4 8K 模型。 我们也尝试过ChatGPT 3.5 16K模型,但结果不是很好。
  • 4 个 自制 agent 工具
    • elastic list indices:获取所有可用 Elasticsearch 索引的工具
    • elastic index show details:获取单个Elasticsearch索引信息的工具
    • elastic index show data:用于从 Elasticsearch 索引获取条目列表的工具,有助于找出可用的数据。
    • elastic search tool:该工具对 Elastisearch 索引执行特定查询并返回所有命中或聚合结果 
  • Specialised prompting:我们使用了一些特殊的指令来让 agent 正常工作。 提示指示代理首先获取索引的名称,然后获取索引字段名称。 没有内存相关指令的主要 prompt 是:
f"""

Make sure that you query first the indices in the ElasticSearch database.

Make sure that after querying the indices you query the field names.                    

Then answer this question:

{question}

"""

我们首先使用如下的命令来克隆 elasticsearch-agent 的代码:

git clone https://github.com/liu-xiao-guo/elasticsearch-agent

然后我们在当前的目录下创建一个叫做 .env 的文件:

.env

OPENAI_API_KEY=YourOpenAiKey
OPENAI_MODEL=gpt-4-0613
# OPENAI_MODEL=gpt-3.5-turbo-16k-0613
REQUEST_TIMEOUT=300
LANGCHAIN_CACHE=false
CHATGPT_STREAMING=false
LLM_VERBOSE=true

# Elastic Search related
ELASTIC_SERVER=https://127.0.0.1:9200
ELASTIC_USER=elastic
ELASTIC_PASSWORD=q2rqAIphl-fx9ndQ36CO
CERT_FINGERPRINT=bce66ed55097f255fc8e4420bdadafc8d609cc8027038c2dd09d805668f3459e
ELASTIC_VERIFY_CERTIFICATES=true

ELASTIC_INDEX_DATA_FROM=0
ELASTIC_INDEX_DATA_SIZE=5
ELASTIC_INDEX_DATA_MAX_SIZE=50

LANGCHAIN_VERBOSE=true
AGGS_LIMIT=200
TOKEN_LIMIT=6000
MAX_SEARCH_RETRIES = 100

在上面,你需要根据自己的 Elasticsearch 配置来配置:

  • OPENAI_API_KEY:你需要申请自己的 OpenAI key
  • ELASTIC_SERVER:Elasticsearch 的终端地址
  • ELASTIC_USER:超级用户的账号名称。你也可以使用自己创建的其它账号
  • ELASTIC_PASSWORD:超级用户 elastic 的密码
  • CERT_FINGERPRINT:这个是 Elasticsearch 的证书的 fingerprint。可以在 Elasticsearch 启动的画面中找到

在当前的目录下,我们使用如下的命令来进行打包及安装:

python3 -m venv .venv
source .venv/bin/activate
$ pwd
/Users/liuxg/python/elasticsearch-agent
$ python3 -m venv .venv
$ source .venv/bin/activate

我们然后安装 peorty:

pip3 install poetry

接下来,我们使用如下的命令来进行打包并安装:

rm poetry.lock 
poetry install
(.venv) $ rm poetry.lock
(.venv) $ poetry install
Updating dependencies
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/a7/94/ace0fdea5241a27d13543ee117cbc65868e82213fb31a8eb7fe9ff23f313/numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.wResolving dependencies... Downloading https://files.pythonhosted.org/packages/12/f6/0232cc0c617Resolving dependencies... (22.7s)

Package operations: 0 installs, 23 updates, 0 removals

  • Updating typing-extensions (4.8.0 -> 4.9.0)
  • Updating certifi (2023.7.22 -> 2024.2.2)
  • Updating charset-normalizer (3.3.0 -> 3.3.2)
  • Updating frozenlist (1.4.0 -> 1.4.1)
  • Updating idna (3.4 -> 3.6)
  • Updating multidict (6.0.4 -> 6.0.5)
  • Updating pydantic-core (2.10.1 -> 2.16.2)
  • Updating urllib3 (1.26.17 -> 2.2.1)
  • Updating attrs (23.1.0 -> 23.2.0)
  • Updating marshmallow (3.20.1 -> 3.20.2)
  • Updating pydantic (2.4.2 -> 2.6.1)
  • Updating yarl (1.9.2 -> 1.9.4)
  • Updating aiohttp (3.8.6 -> 3.9.3)
  • Updating dataclasses-json (0.6.1 -> 0.6.4)
  • Updating elastic-transport (8.4.1 -> 8.12.0)
  • Updating langsmith (0.0.43 -> 0.0.92)
  • Updating numpy (1.25.2 -> 1.26.4)
  • Updating regex (2023.10.3 -> 2023.12.25)
  • Updating sqlalchemy (2.0.21 -> 2.0.27)
  • Updating tqdm (4.66.1 -> 4.66.2)
  • Updating elasticsearch (8.10.0 -> 8.12.1)
  • Updating python-dotenv (1.0.0 -> 1.0.1)
  • Updating tiktoken (0.5.1 -> 0.5.2)

Writing lock file

Installing the current project: elasticsearch-agent (0.1.7)

我们使用如下的命令来进行构建:

poetry build
(.venv) $ poetry build
Building elasticsearch-agent (0.1.7)
  - Building sdist
  - Built elasticsearch_agent-0.1.7.tar.gz
  - Building wheel
  - Built elasticsearch_agent-0.1.7-py3-none-any.whl
(.venv) $ ls 

我们可以通过如下的命令来进行检查是否已经生成安装文件:

(.venv) $ pwd
/Users/liuxg/python/elasticsearch-agent
(.venv) $ ls
README.md           dist                elasticsearch_agent pyproject.toml
datasets            docs                poetry.lock
(.venv) $ ls dist/
elasticsearch_agent-0.1.7-py3-none-any.whl elasticsearch_agent-0.1.7.tar.gz

elasticsearch-agent-chainlit

我们在另外一个 terminal 中使用如下的命令来克隆代码:

git clone https://github.com/liu-xiao-guo/elasticsearch-agent-chainlit

此功能中使用的 prompt 最多包含用户之前的 5 个问题。 这是一种仅通过问题来记忆的简单尝试。 它还包含从 Elasticsearch 获取每个问题的索引和详细信息的说明。

我们使用同样的方法来创建虚拟环境:

python3 -m venv .venv
source .venv/bin/activate

我们在当前的目录下创建一个和上面 elasticsearch-agent 项目中一样的 .env 文件:

.env

OPENAI_API_KEY=YourOpenAIkey
OPENAI_MODEL=gpt-4-0613
# OPENAI_MODEL=gpt-3.5-turbo-16k-0613
REQUEST_TIMEOUT=300
LANGCHAIN_CACHE=false
CHATGPT_STREAMING=false
LLM_VERBOSE=true

# Elastic Search related
ELASTIC_SERVER=https://127.0.0.1:9200
ELASTIC_USER=elastic
ELASTIC_PASSWORD=q2rqAIphl-fx9ndQ36CO
CERT_FINGERPRINT=bce66ed55097f255fc8e4420bdadafc8d609cc8027038c2dd09d805668f3459e
ELASTIC_VERIFY_CERTIFICATES=true

ELASTIC_INDEX_DATA_FROM=0
ELASTIC_INDEX_DATA_SIZE=5
ELASTIC_INDEX_DATA_MAX_SIZE=50

LANGCHAIN_VERBOSE=true
AGGS_LIMIT=200
TOKEN_LIMIT=6000
MAX_SEARCH_RETRIES = 100
QUESTIONS_TO_KEEP=5

但是我们需要额外添加 QUESTIONS_TO_KEEP=5

在进行安装之前,我们需要根据上一步所生成的安装包的位置来修改 pyproject.toml 文件:

pyproject.toml

[tool.poetry]
name = "elasticsearch-chainlit"
version = "0.1.0"
description = "Provides a simple UI for the ElasticSearch LangChain Agent."
authors = ["Gil Fernandes <gil.fernandes@onepointltd.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
chainlit = "^0.7.2"
elasticsearch-agent = {path = "../elasticsearch-agent/dist/elasticsearch_agent-0.1.7-py3-none-any.whl", develop = true}

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

我们需要修改 elasticsearch-agent 的值。

我们使用如下的命令来运行上面的代码:

poetry install
(.venv) $ pwd
/Users/liuxg/python/elasticsearch-agent-chainlit
(.venv) $ poetry install
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: elasticsearch-chainlit (0.1.0)

我们可以通过如下的命令来查看所安装的包:

(.venv) $ pip3 list | grep elasticsearch
elasticsearch                            8.12.1
elasticsearch-agent                      0.1.7
elasticsearch-chainlit                   0.1.0      /Users/liuxg/python/elasticsearch-agent-chainlit

接下来,我们使用如下的命令来运行:

chainlit run ./elasticsearch_chainlit/ui/agent_chainlit.py

    

上面是我们能看到的界面。在运行代码时,一定要确保 chainlit 出于最新的版本。在早期的版本中,question 是一个 dict 类型的数据而不是 str:

elasticsearch_chainlit/ui/agent_chainlit.py

  

Agent 工作流程

Elasticsearch agent 工作流程

工作流程有两部分:

设置 — 执行三个步骤:

  • 初始化工具
  • 设置 LLM 模型
  • 设置 agent,包括提示


执行流程 — 以下是工作流程步骤:

  • 用户提出问题
  • LLM 分析问题
  • 网关:决定使用哪个工具。 在某些情况下,可能没有任何工具可以完成该任务。
  • 网关案例 1:找到工具 — 执行工具并接收其观察结果。 在我们的例子中,这是一个 JSON 响应。
  • 网关案例 2:未找到工具 — 工作流程以错误消息结束。
  • 如果找到工具:该工具的观察结果将发送回 LLM。
  • 网关:决定使用哪个工具,或者是否找不到工具并且流程终止,或者我们是否有最终答案。 如果决定使用该工具,我们将再次循环执行相同的步骤。

执行流程是循环的,直到找到最终答案。 这意味着对于一个问题,agent 可以访问多个工具,甚至多次访问同一个工具。

通常,工作流程会在与 LLM 交互 15 次并出现错误后停止。

工具列表:

  • 列表索引工具:此工具列出 Elasticsearch 索引,通常在 agent 每次回答任何问题时调用。 该工具接收分隔符作为输入,并输出由它分隔的索引列表。
  • 索引详细信息工具:该工具列出特定索引的别名、映射和设置。 它接收 Elasticsearch 索引名称作为输入。
  • 索引数据工具:该工具用于从 Elasticsearch 索引中获取条目列表,有助于找出可用的数据。 根据我的测试,这是 ChatGPT 使用最少的工具。
  • 索引搜索工具:此工具是搜索工具,需要输入索引、查询以及查询的起始位置和长度。 它解析查询并尝试确定查询是搜索还是聚合查询,并根据返回结果(如果是搜索)或聚合(如果是聚合查询)。 但它也试图避免响应的 token 大小超过某个阈值,因此可能会重试查询。 这是这个工具的主要方法。在此文件中,你可以找到输入模型(SearchToolInput)和该工具的运行方法(elastic_search):

展示

首先,我们使用 ChatGPT 来生成一个样本文档。

  

PUT /people
{
  "mappings": {
    "properties": {
      "name": {
        "type": "text"
      },
      "description": {
        "type": "text"
      },
      "sex": {
        "type": "keyword"
      },
      "age": {
        "type": "integer"
      },
      "address": {
        "type": "text"
      }
    }
  }
}
POST /_bulk
{ "index" : { "_index" : "people", "_id" : "1" } }
{ "name" : "John Doe", "description" : "A software developer", "sex" : "Male", "age" : 30, "address" : "123 Elm Street, Springfield" }
{ "index" : { "_index" : "people", "_id" : "2" } }
{ "name" : "Jane Smith", "description" : "A project manager", "sex" : "Female", "age" : 28, "address" : "456 Maple Avenue, Anytown" }
{ "index" : { "_index" : "people", "_id" : "3" } }
{ "name" : "Alice Johnson", "description" : "A graphic designer", "sex" : "Female", "age" : 26, "address" : "789 Oak Lane, Metropolis" }
{ "index" : { "_index" : "people", "_id" : "4" } }
{ "name" : "Bob Brown", "description" : "A marketing specialist", "sex" : "Male", "age" : 32, "address" : "321 Pine Street, Gotham" }
{ "index" : { "_index" : "people", "_id" : "5" } }
{ "name" : "Charlie Davis", "description" : "An IT analyst", "sex" : "Male", "age" : 29, "address" : "654 Cedar Blvd, Star City" }
{ "index" : { "_index" : "people", "_id" : "6" } }
{ "name" : "Diana Prince", "description" : "A diplomat", "sex" : "Female", "age" : 35, "address" : "987 Birch Road, Themyscira" }
{ "index" : { "_index" : "people", "_id" : "7" } }
{ "name" : "Evan Wright", "description" : "A journalist", "sex" : "Male", "age" : 27, "address" : "213 Willow Lane, Central City" }
{ "index" : { "_index" : "people", "_id" : "8" } }
{ "name" : "Fiona Gallagher", "description" : "A nurse", "sex" : "Female", "age" : 31, "address" : "546 Spruce Street, South Side" }
{ "index" : { "_index" : "people", "_id" : "9" } }
{ "name" : "George King", "description" : "A teacher", "sex" : "Male", "age" : 34, "address" : "879 Elm St, Smallville" }
{ "index" : { "_index" : "people", "_id" : "10" } }
{ "name" : "Helen Parr", "description" : "A full-time superhero", "sex" : "Female", "age" : 37, "address" : "123 Metro Avenue, Metroville" }

  

这样我们就创建了一个叫做 people 的索引。我们现在以这个索引为例来进行展示:

what are the indices in the cluster?

  

What is the mapping for people?

  

How many documents are there in the index people?

  

Which document has the biggest age?

  

让我们针对索引 people 做一个聚合:

  

很显然我们的结果是非常正确的。

How many males and females in the index people?

  

  

很显然它是对的。

who is a software developer?

  

  

who lives in Metropolis?

  

  

最后,让我们试一下中文的搜索:

哪一个文档的年龄最大?

  

我们还可以做任何其他的尝试。它可以充分了解我的需求,并做出正确的搜索。

Happy exploration :)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1465530.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

人工智能 — 数字图像

目录 一、图像1、像素2、图像分辨率3、RGB 模型4、灰度5、通道6、对比度7、RGB 转化为 Gray8、RGB 值转化为浮点数9、二值化10、常用视觉库11、频率12、幅值 二、图像的取样与量化1、数字图像2、取样3、量化 三、上采样与下采样1、上采样&#xff08;upsampling&#xff09;2、…

NOIP2018-J-4-对称二叉树的题解

原题描述&#xff1a; 题目描述 时间&#xff1a;1s 空间&#xff1a;256M 一棵有点权的有根树如果满足以下条件&#xff0c;则被轩轩称为对称二叉树&#xff1a; 1. 二叉树&#xff1b; 2. 将这棵树所有节点的左右子树交换&#xff0c;新树和原树对应位置的结构相同且…

【机器学习的基本术语和概念】

曾梦想执剑走天涯&#xff0c;我是程序猿【AK】 目录 简述概要知识图谱 简述概要 提示&#xff1a;简要描述文章内容&#xff0c;适合哪些人观看 知识图谱 样本&#xff08;Sample&#xff09;/实例&#xff08;Instance&#xff09;&#xff1a;在机器学习中&#xff0c;我…

vue-利用属性(v-if)控制表单(el-form-item)显示/隐藏

表单控制属性 v-if 示例&#xff1a; 通过switch组件作为开关&#xff0c;控制表单的显示与隐藏 <el-form-item label"创建数据集"><el-switch v-model"selectFormVisible"></el-switch></el-form-item><el-form-item label&…

AndroidStudio 2024-2-21 Win10/11最新安装配置(Kotlin快速构建配置,gradle镜像源)

AndroidStudio 2024 Win10/11最新安装配置 教程目的&#xff1a; (从安装到卸载) &#xff0c;针对Kotlin开发配置&#xff0c;gradle-8.2-src/bin下载慢&#xff0c;以及Kotlin构建慢的解决 好久没玩AS了,下载发现装个AS很麻烦,就觉得有必要出个教程了(就是记录一下:嘻嘻) 因…

❤ hexo主题+Gitee搭建个人博客

Hexo的基本使用 ​官网 官网地址&#xff1a;https://hexo.io/zh-cn/ Hexo是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown&#xff08;或其他渲染引擎&#xff09;解析文章&#xff0c;在几秒内&#xff0c;即可利用靓丽的主题生成静态网页。即把用户的markdown文件…

开源LLMs导览:工作原理、顶级LLM列表对比

目录 一、开源 LLM 是什么意思&#xff1f;二、开源LLM如何工作&#xff1f;2.1 预训练2.2 代币化2.3 开源LLM的微调2.4 输入编码2.5 训练与优化2.6 推理 三、开源LLM对组织的好处3.1 增强的数据安全和隐私3.2 节约成本3.3 减少供应商依赖性3.4 代码透明度 四、哪种LLM模式最好…

AcrelEMS-HIM高速公路综合能效系统在高速公路的案例

摘 要&#xff1a;我国新型工业化、信息化、城镇化和农业现代化加快发展&#xff0c;经济结构加快转型&#xff0c;交通运输总量将保持较快增长态势&#xff0c;各项事业发展要求提高国家公路网的服务能力和水平。高速公路沿线的收费站、互通枢纽、服务区、隧道等配置的供配电、…

白令海峡的题解

目录 原题描述&#xff1a; 题目描述 输入格式 输出格式 样例输入 样例输出 样例解释 数据规模 主要思路&#xff1a; 小细节&#xff1a; 代码code: 原题描述&#xff1a; 时间限制: 1000ms 空间限制: 524288kB 题目描述 很久很久以前&#xff0c;一座大陆桥横…

云图极速版限时免费活动

产品介绍 云图极速版是针对拥有攻击面管理需求的用户打造的 SaaS 应用&#xff0c;致力于协助用户发现并管理互联网资产攻击面。 实战数据 (2023.11.6 - 2024.2.23) 云图极速版上线 3 个月以来&#xff0c;接入用户 3,563 家&#xff0c;扫描主体 19,961 个&#xff0c;累计发…

Atcoder ABC341 A-D题解

比赛链接:ABC341 Problem A: 先签个到。 #include <bits/stdc.h> using namespace std; int main() {int n;cin>>n;for(int i0;i<n;i)cout<<"10"<<endl;cout<<"1"<<endl;return 0; } Problem B: 继续签。 #i…

3D模型可视化引擎HOOPS Visualize V2024版全新发布:增强了大量点云数据集的处理,与HOOPS系列产品集合实现照片级渲染!

HOOPS Visualize是一款工业级3D渲染引擎&#xff0c;可以用于打造移动端和PC端工程应用程序&#xff0c;其灵活、分层的场景管理引擎&#xff0c;支持处理各种3D模型实体&#xff0c;其高性能图形和交互处理算法&#xff0c;支持大型模型可视化&#xff0c;现已帮助达索 SOLIDW…

这两招,让你轻松俘获客户心

面向政府的数字化解决方案作为睿鸿数字应用的一个分支&#xff0c;在充分借鉴政府项目中积累的丰富经验的基础上&#xff0c;积极开发更多领域通用的标准化产品。 2023年&#xff0c;睿鸿推出了一系列创新的数字应用产品&#xff0c;包括动态表单系统、统一集成门户、统一通信中…

你听说过柔性数组吗?

目录 1. 柔性数组的概念 2. 柔性数组的特点 3. 柔性数组的使用 4. 柔性数组的优势 5.完结散花 悟已往之不谏&#xff0c;知来者犹可追 创作不易&#xff0c;宝子们&#xff01;如果这篇文章对你们有帮助的话&#…

动态SLAM:基于ORB-SLAM2与YOLOv8剔除动态特征点(三种方法)

基于ORB-SLAM2与YOLOv8剔除动态特征点(三种方法) 写上篇文章时测试过程比较乱&#xff0c;写的时候有些地方有点失误&#xff0c;所以重新写了这篇 本文内容均在RGB-D环境下进行程序测试 本文涉及到的动态特征点剔除速度均是以https://cvg.cit.tum.de/data/datasets/rgbd-dat…

RF 框架实现企业级 UI 自动化测试

RobotFramework 框架可以作为公司要做自动化 但是又不会代码的一种临时和紧急情况的替代方案&#xff0c;上手简单。 前言 现在大家去找工作&#xff0c;反馈回来的基本上自动化测试都是刚需&#xff01;没有自动化测试技能&#xff0c;纯手工测试基本没有什么市场。 但是很多…

【动态规划】【回文】【字符串】1147. 段式回文

作者推荐 【广度优先搜索】【网格】【割点】【 推荐】1263. 推箱子 本文涉及知识点 动态规划汇总 LeetCode1147段式回文 你会得到一个字符串 text 。你应该把它分成 k 个子字符串 (subtext1, subtext2&#xff0c;…&#xff0c; subtextk) &#xff0c;要求满足: subtext…

如何将QQ音乐的歌单导出到excel

一、提前准备 1.选择你需要导出的音乐歌单 2.得到你的歌单ID 1、首先打开QQ音乐&#xff0c;找到想要查看的歌单&#xff0c;点击歌单右上角的更多按钮。 2、其次在弹出的菜单中选择分享&#xff0c;在分享页面中&#xff0c;选择歌单分享。 3、最后在分享页面中&#xff0c…

kafka和ZK的关系

zk相当于是kafka的一个基础设施 Kafka是一种高吞吐量、可扩展的分布式发布订阅消息系统&#xff0c;ZooKeeper是一个分布式协调服务&#xff0c;用于管理和协调分布式系统中的各种资源 Zookeeper&#xff1a;管理broker&#xff0c;consumer 创建broker后&#xff0c;向zk注册…

Leetcoder Day18| 二叉树 part07

语言&#xff1a;Java/Go 今天做了一个小决定&#xff0c;如果时间不够的话&#xff0c;可以先看go去找实习&#xff0c;所以现在加上用go去刷题 530.二叉搜索树的最小绝对差 给你一棵所有节点为非负值的二叉搜索树&#xff0c;请你计算树中任意两节点的差的绝对值的最小值。…