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

使用Milvus和Llama-agents构建更强大的Agent系统

2e7c027f0fd9bbd65c5d9c4674ad42a2.png

3c827b99fefac0ce1a6d542fb21f5292.png

代理(Agent)系统能够帮助开发人员创建智能的自主系统,因此变得越来越流行。大语言模型(LLM)能够遵循各种指令,是管理 Agent 的理想选择,在许多场景中帮助我们尽可能减少人工干预、处理更多复杂任务。例如,Agent 系统解答客户咨询的问题,甚至根据客户偏好进行交叉销售。

本文将探讨如何使用 Llama-agents 和 Milvus 构建 Agent 系统。通过将 LLM 的强大功能与 Milvus 的向量相似性搜索能力相结合,我们可以创建智能且高效、可扩展的复杂 Agent 系统。

本文还将探讨如何使用不同的 LLM 来实现各种操作。对于较简单的任务,我们将使用规模较小且更价格更低的 Mistral Nemo 模型。对于更复杂的任务,如协调不同 Agent,我们将使用 Mistral Large 模型。

01.

Llama-agents、Ollama、Mistral Nemo 和 Milvus Lite 简介

  • Llama-agents:LlamaIndex 的扩展,通常与 LLM 配套使用,构建强大的 stateful、多 Actor 应用。

  • Ollama 和 Mistral Nemo: Ollama 是一个 AI 工具,允许用户在本地计算机上运行大语言模型(如 Mistral Nemo),无需持续连接互联网或依赖外部服务器。

  • Milvus Lite: Milvus 的轻量版,您可以在笔记本电脑、Jupyter Notebook 或 Google Colab 上本地运行 Milvus Lite。它能够帮助您高效存储和检索非结构化数据。

Llama-agents 原理

LlamaIndex 推出的 Llama-agents 是一个异步框架,可用于构建和迭代生产环境中的多 Agent 系统,包括多代理通信、分布式工具执行、人机协作等功能!

在 Llama-agents 中,每个 Agent 被视为一个服务,不断处理传入的任务。每个 Agent 从消息队列中提取和发布消息。

bf1dbba033a88765fdbadb312715ca0f.png

02.

安装依赖

第一步先安装所需依赖。

! pip install llama-agents pymilvus python-dotenv
! pip install llama-index-vector-stores-milvus llama-index-readers-file llama-index-embeddings-huggingface llama-index-llms-ollama llama-index-llms-mistralai
# This is needed when running the code in a Notebook
import nest_asyncio
nest_asyncio.apply()from dotenv import load_dotenv
import osload_dotenv()

03.

将数据加载到 Milvus

从 Llama-index 上下载示例数据。其中包含有关 Uber 和 Lyft 的 PDF 文件。

!mkdir -p 'data/10k/'
!wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/docs/examples/data/10k/uber_2021.pdf' -O 'data/10k/uber_2021.pdf'
!wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/docs/examples/data/10k/lyft_2021.pdf' -O 'data/10k/lyft_2021.pdf'

现在,我们可以提取数据内容,然后使用 Embedding 模型将数据转换为 Embedding 向量,最终存储在 Milvus 向量数据库中。本文使用的模型为 bge-small-en-v1.5 文本 Embedding 模型。该模型较小且资源消耗量更低。

接着,在 Milvus 中创建 Collection 用于存储和检索数据。本文使用 Milvus 轻量版—— Milvus Lite。Milvus 是一款高性能的向量向量数据库,提供向量相似性搜索能力,适用于搭建 AI 应用。仅需通过简单的 pip install pymilvus 命令即可快速安装 Milvus Lite。

PDF 文件被转换为向量,我们将向量数据库存储到 Milvus 中。

from llama_index.vector_stores.milvus import MilvusVectorStore
from llama_index.core import Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbeddingfrom llama_index.core import SimpleDirectoryReader, VectorStoreIndex, StorageContext, load_index_from_storage
from llama_index.core.tools import QueryEngineTool, ToolMetadata# Define the default Embedding model used in this Notebook.
# bge-small-en-v1.5 is a small Embedding model, it's perfect to use locally
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5"
)input_files=["./data/10k/lyft_2021.pdf", "./data/10k/uber_2021.pdf"]# Create a single Milvus vector store
vector_store = MilvusVectorStore(uri="./milvus_demo_metadata.db",collection_name="companies_docs" dim=384,overwrite=False,
)# Create a storage context with the Milvus vector store
storage_context = StorageContext.from_defaults(vector_store=vector_store)# Load data
docs = SimpleDirectoryReader(input_files=input_files).load_data()# Build index
index = VectorStoreIndex.from_documents(docs, storage_context=storage_context)# Define the query engine
company_engine = index.as_query_engine(similarity_top_k=3)

04.

定义工具

我们需要定义两个与我们数据相关的工具。第一个工具提供关于 Lyft 的信息。第二个工具提供关于 Uber 的信息。在后续的内容中,我们将进一步探讨如何定义一个更广泛的工具。

# Define the different tools that can be used by our Agent.
query_engine_tools = [QueryEngineTool(query_engine=company_engine,metadata=ToolMetadata(name="lyft_10k",description=("Provides information about Lyft financials for year 2021. ""Use a detailed plain text question as input to the tool."),),),QueryEngineTool(query_engine=company_engine,metadata=ToolMetadata(name="uber_10k",description=("Provides information about Uber financials for year 2021. ""Use a detailed plain text question as input to the tool."),),),
]

05.

使用 Mistral Nemo 设置 Agent

我们将使用 Mistral Nemo 和 Ollama 限制资源用量、降低应用成本。Mistral Nemo + Ollama 的组合能够帮助我们在本地运行模型。Mistral Nemo 是一个小型 LLM,提供高达 128k Token 的大上下文窗口,这在处理大型文档时非常有用。此外,该 LLM 还经过微调,可以遵循精确的推理指令、处理多轮对话和生成代码。

from llama_index.llms.ollama import Ollama
from llama_index.core.agent import AgentRunner, ReActAgentWorker, ReActAgent# Set up the agent
llm = Ollama(model="mistral-nemo", temperature=0.4)
agent = ReActAgent.from_tools(query_engine_tools, llm=llm, verbose=True)# Example usage
response = agent.chat("Compare the revenue of Lyft and Uber in 2021.")
print(response)

生成响应如下所示:

> Running step 7ed275f6-b0de-4fd7-b2f2-fd551e58bfe2. Step input: Compare the revenue of Lyft and Uber in 2021.
Thought: The current language of the user is: English. I need to use tools to help me answer the question.
Action: lyft_10k
Action Input: {'input': "What was Lyft's total revenue in 2021?"}
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:- Avoid using `tokenizers` before the fork if possible- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
Observation: The total revenue for Lyft in 2021 was generated primarily from its ridesharing marketplace connecting drivers and riders, with revenue recognized from fees paid by drivers for using the Lyft Platform offerings in accordance with ASC 606.
> Running step 33064fd3-3c3a-42c4-ab5a-e7ebf8a9325b. Step input: None
Thought: I need to compare the revenue of Lyft and Uber in 2021.
Action: uber_10k
Action Input: {'input': "What was Uber's total revenue in 2021?"}
Observation: $17,455
> Running step 7eacfef4-d9da-4cbf-ac07-18f2ff6a3951. Step input: None
Thought: I have obtained Uber's total revenue for 2021. Now, I need to compare it with Lyft's.
Action: lyft_10k
Action Input: {'input': "What was Lyft's total revenue in 2021?"}
Observation: The total revenue for Lyft in 2021 was generated primarily from their ridesharing marketplace connecting drivers and riders. The revenue was recognized from fees paid by drivers for using the Lyft Platform offerings in accordance with ASC 606.
> Running step 88673e15-b74c-4755-8b9c-2b7ef3acea48. Step input: None
Thought: I have obtained both Uber's and Lyft's total revenues for 2021. Now, I need to compare them.
Action: Compare
Action Input: {'Uber': '$17,455', 'Lyft': '$3.6 billion'}
Observation: Error: No such tool named `Compare`.
> Running step bed5941f-74ba-41fb-8905-88525e67b785. Step input: None
Thought: I need to compare the revenues manually since there isn't a 'Compare' tool.
Answer: In 2021, Uber's total revenue was $17.5 billion, while Lyft's total revenue was $3.6 billion. This means that Uber generated approximately four times more revenue than Lyft in the same year.
Response without metadata filtering:
In 2021, Uber's total revenue was $17.5 billion, while Lyft's total revenue was $3.6 billion. This means that Uber generated approximately four times more revenue than Lyft in the same year.

06.

使用 Milvus 进行元数据过滤

虽然为每个公司的文档定义一个工具代理非常方便,但如果需要处理的文档很多,这种方法并不具备良好的扩展性。更好的解决方案是使用 Milvus 提供的元数据过滤功能。我们可以将来自不同公司的数据存储在同一个 Collection 中,但只检索特定公司的相关数据,从而节省时间和资源。

以下代码展示了如何使用元数据过滤功能:

from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters# Example usage with metadata filtering
filters = MetadataFilters(filters=[ExactMatchFilter(key="file_name", value="lyft_2021.pdf")]
)filtered_query_engine = index.as_query_engine(filters=filters)# Define query engine tools with the filtered query engine
query_engine_tools = [QueryEngineTool(query_engine=filtered_query_engine,metadata=ToolMetadata(name="company_docs",description=("Provides information about various companies' financials for year 2021. ""Use a detailed plain text question as input to the tool."),),),
]# Set up the agent with the updated query engine tools
agent = ReActAgent.from_tools(query_engine_tools, llm=llm, verbose=True)

我们的检索器将过滤数据,仅考虑属于 lyft_2021.pdf文档的部分数据。因此,我们应该是搜索不到 Uber 相关的信息和内容的。

try:response = agent.chat("What is the revenue of uber in 2021?")print("Response with metadata filtering:")print(response)
except ValueError as err:print("we couldn't find the data, reached max iterations")

让我们测试一下。当我们针对 Uber 2021 年的公司收入进行提问时,Agent 没有检索出结果。

Thought: The user wants to know Uber's revenue for 2021.
Action: company_docs
Action Input: {'input': 'Uber Revenue 2021'}
Observation: I'm sorry, but based on the provided context information, there is no mention of Uber's revenue for the year 2021. The information primarily focuses on Lyft's revenue per active rider and critical accounting policies and estimates related to their financial statements.
> Running step c0014d6a-e6e9-46b6-af61-5a77ca857712. Step input: None

但当我们针对 Lyft 2021 年的公司收入进行提问时,Agent 能够检索出正确的答案。

try:response = agent.chat("What is the revenue of Lyft in 2021?")print("Response with metadata filtering:")print(response)
except ValueError as err:print("we couldn't find the data, reached max iterations")

返回结果如下:

> Running step 7f1eebe3-2ebd-47ff-b560-09d09cdd99bd. Step input: What is the revenue of Lyft in 2021?
Thought: The current language of the user is: English. I need to use a tool to help me answer the question.
Action: company_docs
Action Input: {'input': 'Lyft revenue 2021'}
Observation: Lyft's revenue in 2021 was primarily generated from its ridesharing marketplace connecting drivers and riders. The revenue was recognized from fees paid by drivers for using the Lyft Platform offerings in accordance with ASC 606. Additionally, revenue per Active Rider reached an all-time high in the fourth quarter of 2021 due to increased ride frequency, a shift towards higher revenue rides, and revenues from licensing and data access agreements.
> Running step 072a3253-7eee-44e3-a787-397c9cbe80d8. Step input: None
Thought: The current language of the user is English. I need to use a tool to help me answer the question.
Action: company_docs
Action Input: {'input': 'Lyft revenue 2021'}
Observation: Revenue for Lyft in 2021 was driven by an increase in ride frequency, a shift towards higher revenue rides such as airport rides, and revenues from licensing and data access agreements. This resulted in Revenue per Active Rider reaching an all-time high in the fourth quarter of 2021 compared to the previous quarter.
> Running step 6494fe6d-27ad-484f-9204-0c4683bfa1c2. Step input: None
Thought: The user is asking for Lyft's revenue in 2021.
Action: company_docs
Action Input: {'input': 'Lyft revenue 2021'}
Observation: Lyft's revenue in 2021 was primarily generated from its ridesharing marketplace connecting drivers and riders. Revenue per Active Rider reached a record high in the fourth quarter of 2021 due to increased ride frequency and a shift towards higher revenue rides, such as airport rides. Additionally, revenue was boosted by licensing and data access agreements starting in the second quarter of 2021.
> Running step 0076b6dd-e7d0-45ac-a39a-4afa5f1aaf47. Step input: None
Answer: Observation: Lyft's total revenue in 2021 was $3.4 billion.
Response with metadata filtering:
Observation: Lyft's total revenue in 2021 was $3.4 billion.

07.

使用 LLM 自动创建元数据过滤器

现在,让我们基于用户问题使用 LLM 自动创建元数据过滤器,从而提升 Agent 效率。

from llama_index.core.prompts.base import PromptTemplate# Function to create a filtered query engine
def create_query_engine(question):# Extract metadata filters from question using a language modelprompt_template = PromptTemplate("Given the following question, extract relevant metadata filters.\n""Consider company names, years, and any other relevant attributes.\n""Don't write any other text, just the MetadataFilters object""Format it by creating a MetadataFilters like shown in the following\n""MetadataFilters(filters=[ExactMatchFilter(key='file_name', value='lyft_2021.pdf')])\n""If no specific filters are mentioned, returns an empty MetadataFilters()\n""Question: {question}\n""Metadata Filters:\n")prompt = prompt_template.format(question=question)llm = Ollama(model="mistral-nemo")response = llm.complete(prompt)metadata_filters_str = response.text.strip()if metadata_filters_str:metadata_filters = eval(metadata_filters_str)return index.as_query_engine(filters=metadata_filters)return index.as_query_engine()

我们可以将上述 Function 整合到 Agent 中。

# Example usage with metadata filtering
question = "What is Uber revenue? This should be in the file_name: uber_2021.pdf"
filtered_query_engine = create_query_engine(question)# Define query engine tools with the filtered query engine
query_engine_tools = [QueryEngineTool(query_engine=filtered_query_engine,metadata=ToolMetadata(name="company_docs_filtering",description=("Provides information about various companies' financials for year 2021. ""Use a detailed plain text question as input to the tool."),),),
]# Set up the agent with the updated query engine tools
agent = ReActAgent.from_tools(query_engine_tools, llm=llm, verbose=True)response = agent.chat(question)
print("Response with metadata filtering:")
print(response)

现在,Agent 使用键值file_nameuber_2021.pdf 来创建 Metadatafilters。Prompt 越复杂,Agent 能够创建更多高级过滤器。

MetadataFilters(filters=[ExactMatchFilter(key='file_name', value='uber_2021.pdf')])
<class 'str'>
eval: filters=[MetadataFilter(key='file_name', value='uber_2021.pdf', operator=<FilterOperator.EQ: '=='>)] condition=<FilterCondition.AND: 'and'>
> Running step a2cfc7a2-95b1-4141-bc52-36d9817ee86d. Step input: What is Uber revenue? This should be in the file_name: uber_2021.pdf
Thought: The current language of the user is English. I need to use a tool to help me answer the question.
Action: company_docs
Action Input: {'input': 'Uber revenue 2021'}
Observation: $17,455 million

08.

使用 Mistral Large 作为编排系统

Mistral Large 是一款比 Mistral Nemo 更强大的模型,但它也会消耗更多资源。如果仅将其用作编排器,我们可以节省部分资源,同时享受智能 Agent 带来的便利。

为什么使用 Mistral Large?

Mistral Large是Mistral AI推出的旗舰型号,具有顶级推理能力,支持复杂的多语言推理任务,包括文本理解、转换和代码生成,非常适合需要大规模推理能力或高度专业化的复杂任务。其先进的函数调用能力正是我们协调不同 Agent 时所需的功能。

我们无需针对每个任务都使用一个重量级的模型,这会对我们的系统造成负担。我们可以使用 Mistral Large 指导其他 Agent 进行特定的任务。这种方法不仅优化了性能,还降低了运营成本,提升系统可扩展性和效率。

Mistral Large 将充当中央编排器的角色,协调由 Llama-agents 管理的多个 Agent 活动:

  • Task Delegation(分派任务):当收到复杂查询时,Mistral Large 确定最合适的 Agent 和工具来处理查询的各个部分。

  • Agent Coordination(代理协调):Llama-agents 管理这些任务的执行情况,确保每个 Agent 接收到必要的输入,且其输出被正确处理和整合。

  • Result Synthesis(综合结果):Mistral Large 然后将来自各个 Agent 的输出编译成一个连贯且全面的响应,确保最终输出大于其各部分的总和。

Llama Agents

将 Mistral Large 作为编排器,并使用 Agent 生成回答。

from llama_agents import (AgentService,ToolService,LocalLauncher,MetaServiceTool,ControlPlaneServer,SimpleMessageQueue,AgentOrchestrator,
)from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.llms.mistralai import MistralAI# create our multi-agent framework components
message_queue = SimpleMessageQueue()
control_plane = ControlPlaneServer(message_queue=message_queue,orchestrator=AgentOrchestrator(llm=MistralAI('mistral-large-latest')),
)# define Tool Service
tool_service = ToolService(message_queue=message_queue,tools=query_engine_tools,running=True,step_interval=0.5,
)# define meta-tools here
meta_tools = [await MetaServiceTool.from_tool_service(t.metadata.name,message_queue=message_queue,tool_service=tool_service,)for t in query_engine_tools
]# define Agent and agent service
worker1 = FunctionCallingAgentWorker.from_tools(meta_tools,llm=MistralAI('mistral-large-latest')
)agent1 = worker1.as_agent()
agent_server_1 = AgentService(agent=agent1,message_queue=message_queue,description="Used to answer questions over differnet companies for their Financial results",service_name="Companies_analyst_agent",
)
import logging# change logging level to enable or disable more verbose logging
logging.getLogger("llama_agents").setLevel(logging.INFO)
## Define Launcher
launcher = LocalLauncher([agent_server_1, tool_service],control_plane,message_queue,
)
query_str = "What are the risk factors for Uber?"
print(launcher.launch_single(query_str))> Some key risk factors for Uber include fluctuations in the number of drivers and merchants due to dissatisfaction with the brand, pricing models, and safety incidents. Investing in autonomous vehicles may also lead to driver dissatisfaction, as it could reduce the need for human drivers. Additionally, driver dissatisfaction has previously led to protests, causing business interruptions.

09.

总结

本文介绍了如何使用 Llama-agents 框架创建和使用代理,该框架由 Mistral Nemo 和 Mistral Large 两个不同的大语言模型驱动。我们展示了如何利用不同 LLM 的优势,有效协调资源,搭建一个智能、高效的系统。

如果您喜欢本文内容,请在 GitHub 上为我们点亮🌟https://github.com/milvus-io/milvus。欢迎在 Milvus 社区中分享您的见解!

作者介绍

1a6bf32af9cc496c7ec9365c7c614a70.jpeg

Stephen Batifol

Developer Advocate at Zilliz

推荐阅读

10445ce094f012094d7dacbacb416fc0.png

b8022e39730f4079f09060d8df82c701.png

b25d2db36f02d18d3c8956b6798ba810.png

5646cf51e6ea62503531ada3f4f52aac.png

相关文章:

使用Milvus和Llama-agents构建更强大的Agent系统

代理&#xff08;Agent&#xff09;系统能够帮助开发人员创建智能的自主系统&#xff0c;因此变得越来越流行。大语言模型&#xff08;LLM&#xff09;能够遵循各种指令&#xff0c;是管理 Agent 的理想选择&#xff0c;在许多场景中帮助我们尽可能减少人工干预、处理更多复杂任…...

Python 工具库每日推荐【Arrow】

文章目录 引言Python时间日期处理库的重要性今日推荐:Arrow工具库主要功能:使用场景:安装与配置快速上手示例代码代码解释实际应用案例案例:跨时区会议安排器案例分析高级特性时间范围和区间自定义时间格式扩展阅读与资源优缺点分析优点:缺点:总结【 已更新完 TypeScript…...

Win10 安装 Redis 数据库

一、Redis 数据库介绍 Redis 是一个开源的高性能键值对&#xff08;key-value&#xff09;的非关系型数据库。它通常用作数据结构服务器&#xff0c;支持多种类型的数据结构&#xff0c;如字符串&#xff08;strings&#xff09;、哈希&#xff08;hashes&#xff09;、列表&a…...

使用springboot生成war包

1.生成war包 1.1 更改pom包 打开一个springboot 项目 &#xff0c;右击项目名从项目管理器打开 在pom.xml文件中插入以下两个依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><…...

见微知著:OpenEuler系统启动流程

OpenEuler是一个开源的Linux发行版&#xff0c;它的启动流程涉及到多个阶段&#xff0c;包括固件初始化、引导加载程序、内核启动、初始化系统和服务管理器等。下面将详细介绍OpenEuler的启动流程。 一、启动流程 1. 固件初始化&#xff08;BIOS/UEFI&#xff09; 启动过程首…...

支持向量机-笔记

支持向量机&#xff08;Support Vector Machine, SVM&#xff09; 是一种强大的监督学习算法&#xff0c;广泛应用于分类和回归任务&#xff0c;特别是在分类问题中表现优异。SVM 的核心思想是通过寻找一个最优超平面&#xff0c;将不同类别的数据点进行分割&#xff0c;并最大…...

研发线上事故风险解读之缓存篇

专业在线打字练习平台-巧手打字通&#xff0c;只输出有价值的知识。 一 前言 本文继续基于《线上事故案例集》&#xff0c;进一步深入梳理线上事故缓存使用方面的问题点&#xff0c;重点关注缓存在使用和优化过程中可能出现的问题&#xff0c;旨在为读者提供具有实践指导意义的…...

JavaScript前端开发技术

JavaScript前端开发技术 引言 JavaScript&#xff08;简称JS&#xff09;是一种广泛使用的脚本语言&#xff0c;特别在前端开发领域&#xff0c;它几乎成为了网页开发的标配。从简单的表单验证到复杂的单页应用&#xff08;SPA&#xff09;&#xff0c;JavaScript都扮演着不可…...

H.264 编码参数优化策略

一、概述 随着数字媒体技术的发展&#xff0c;视频编码成为了多媒体领域中的重要研究方向之一。而H.264作为一种广泛应用的视频编码标准&#xff0c;具有高压缩比、优质画面和广泛兼容性等优点。为了进一步提高视频质量和压缩效率&#xff0c;对H.264编码参数进行优化成为了一个…...

C++ 游戏开发技术选型指南

C 游戏开发技术选型指南 游戏开发是一个复杂而多元化的领域&#xff0c;而C凭借其高性能和强大的控制能力&#xff0c;成为许多游戏引擎的首选编程语言。在这篇博客中&#xff0c;我们将探讨如何选择合适的C技术栈进行游戏开发&#xff0c;包括技术背景、代码示例、优化实践、…...

基于Python Django的在线考试管理系统

&#x1f34a;作者&#xff1a;计算机毕设匠心工作室 &#x1f34a;简介&#xff1a;毕业后就一直专业从事计算机软件程序开发&#xff0c;至今也有8年工作经验。擅长Java、Python、微信小程序、安卓、大数据、PHP、.NET|C#、Golang等。 擅长&#xff1a;按照需求定制化开发项目…...

《Java基础》变量和数据类型

综述 在开始学习变量之前&#xff0c;我们思考一下为什么需要使用变量。 首先我们从小开始学习加法减法的时候&#xff0c;后来我们再学更难的东西就是代数&#xff0c;其中的x和y是我们要求解的内容&#xff0c;这些内容就是变量。 变量是人的思维的提升&#xff0c;没有变量…...

FLINK内存管理解析,taskmanager、jobmanager

1、在 Flink 中设置内存的方法是配置以下两个选项之一&#xff1a; 1&#xff09;Total Flink memory&#xff1a;taskmanager.memory.flink.sizejobmanager.memory.flink.size 2&#xff09;Total process memory&#xff1a;taskmanager.memory.process.sizejobmanager.mem…...

【AI论文精读13】RAG论文综述2(微软亚研院 2409)P5-可解释推理查询L3

AI知识点总结&#xff1a;【AI知识点】 AI论文精读、项目、思考&#xff1a;【AI修炼之路】 P1&#xff0c;P2&#xff0c;P3&#xff0c;P4 五、可解释推理查询&#xff08;L3&#xff09; ps&#xff1a;P2有四种查询&#xff08;L1&#xff0c;L2&#xff0c;L3&#xff0c;…...

优达学城 Generative AI 课程3:Computer Vision and Generative AI

文章目录 1 官方课程内容自述第 1 课&#xff1a;图像生成简介第 2 课&#xff1a;计算机视觉基础第 3 课&#xff1a;图像生成与生成对抗网络&#xff08;GANs&#xff09;第 4 课&#xff1a;基于 Transformer 的计算机视觉模型第 5 课&#xff1a;扩散模型第 6 课&#xff0…...

UE5 C++ 通过绑定编辑器事件实现控制柄顶点编辑

开发中经常会遇到编辑器环境中制作工具拖拽控制柄编辑内容的需求&#xff0c;此时可以通过Editor事件拿到对应回调&#xff0c;进行相应更新&#xff1a; 1.创建Mesh编辑Actor类 创建一个Mesh编辑Actor类&#xff0c;提供Mesh顶点编辑的相关逻辑。 .h: #pragma once#inclu…...

云计算ftp 服务器实验

创建VLAN 10 划分端口 创建VLAN 10 的地址 10.1.1.1 服务器的地址是 10.1.1.2 这是服务上的配置 服务器上选择ftp 启动 &#xff0c;文件目录选择一下 在 交换机上 ftp 10.1.1.2 服务器的地址 把刚才创建的shenyq txt 文件下载下到本地交换机 我们能看到交换…...

node.js服务器基础

node.js的事件循环 node.js是基于事件驱动的&#xff0c;通常在代码中注册想要等待的事件&#xff0c;设定好回调函数&#xff0c;当事件触发的时候就会调用回调函数。如果node.js没有要处理的事件了&#xff0c;那整个就结束了;事件里面可以继续插入事件&#xff0c;如果有事…...

2-SAT 问题详解:逻辑约束与图论的结合

2-SAT 问题详解&#xff1a;逻辑约束与图论的结合 2-SAT&#xff08;Two Satisfiability Problem&#xff09;是布尔可满足性问题&#xff08;SAT&#xff09;的特殊形式&#xff0c;它解决的是含有二元子句的布尔表达式的可满足性问题。2-SAT 问题常用于分析系统中的逻辑约束…...

使用NetTopologySuite读写gpkg文件

直接上代码&#xff1a; 优势是什么&#xff1f;纯C#开发&#xff0c;不存在兼容和字符问题。 using NetTopologySuite; using NetTopologySuite.Features; using NetTopologySuite.Geometries; using CdIts.NetTopologySuite.IO; using CdIts.NetTopologySuite.IO.GeoPackag…...

多云管理“拦路虎”:深入解析网络互联、身份同步与成本可视化的技术复杂度​

一、引言&#xff1a;多云环境的技术复杂性本质​​ 企业采用多云策略已从技术选型升维至生存刚需。当业务系统分散部署在多个云平台时&#xff0c;​​基础设施的技术债呈现指数级积累​​。网络连接、身份认证、成本管理这三大核心挑战相互嵌套&#xff1a;跨云网络构建数据…...

MPNet:旋转机械轻量化故障诊断模型详解python代码复现

目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...

Java 语言特性(面试系列2)

一、SQL 基础 1. 复杂查询 &#xff08;1&#xff09;连接查询&#xff08;JOIN&#xff09; 内连接&#xff08;INNER JOIN&#xff09;&#xff1a;返回两表匹配的记录。 SELECT e.name, d.dept_name FROM employees e INNER JOIN departments d ON e.dept_id d.dept_id; 左…...

Lombok 的 @Data 注解失效,未生成 getter/setter 方法引发的HTTP 406 错误

HTTP 状态码 406 (Not Acceptable) 和 500 (Internal Server Error) 是两类完全不同的错误&#xff0c;它们的含义、原因和解决方法都有显著区别。以下是详细对比&#xff1a; 1. HTTP 406 (Not Acceptable) 含义&#xff1a; 客户端请求的内容类型与服务器支持的内容类型不匹…...

Linux相关概念和易错知识点(42)(TCP的连接管理、可靠性、面临复杂网络的处理)

目录 1.TCP的连接管理机制&#xff08;1&#xff09;三次握手①握手过程②对握手过程的理解 &#xff08;2&#xff09;四次挥手&#xff08;3&#xff09;握手和挥手的触发&#xff08;4&#xff09;状态切换①挥手过程中状态的切换②握手过程中状态的切换 2.TCP的可靠性&…...

【论文笔记】若干矿井粉尘检测算法概述

总的来说&#xff0c;传统机器学习、传统机器学习与深度学习的结合、LSTM等算法所需要的数据集来源于矿井传感器测量的粉尘浓度&#xff0c;通过建立回归模型来预测未来矿井的粉尘浓度。传统机器学习算法性能易受数据中极端值的影响。YOLO等计算机视觉算法所需要的数据集来源于…...

C++中string流知识详解和示例

一、概览与类体系 C 提供三种基于内存字符串的流&#xff0c;定义在 <sstream> 中&#xff1a; std::istringstream&#xff1a;输入流&#xff0c;从已有字符串中读取并解析。std::ostringstream&#xff1a;输出流&#xff0c;向内部缓冲区写入内容&#xff0c;最终取…...

DeepSeek 技术赋能无人农场协同作业:用 AI 重构农田管理 “神经网”

目录 一、引言二、DeepSeek 技术大揭秘2.1 核心架构解析2.2 关键技术剖析 三、智能农业无人农场协同作业现状3.1 发展现状概述3.2 协同作业模式介绍 四、DeepSeek 的 “农场奇妙游”4.1 数据处理与分析4.2 作物生长监测与预测4.3 病虫害防治4.4 农机协同作业调度 五、实际案例大…...

视觉slam十四讲实践部分记录——ch2、ch3

ch2 一、使用g++编译.cpp为可执行文件并运行(P30) g++ helloSLAM.cpp ./a.out运行 二、使用cmake编译 mkdir build cd build cmake .. makeCMakeCache.txt 文件仍然指向旧的目录。这表明在源代码目录中可能还存在旧的 CMakeCache.txt 文件,或者在构建过程中仍然引用了旧的路…...

省略号和可变参数模板

本文主要介绍如何展开可变参数的参数包 1.C语言的va_list展开可变参数 #include <iostream> #include <cstdarg>void printNumbers(int count, ...) {// 声明va_list类型的变量va_list args;// 使用va_start将可变参数写入变量argsva_start(args, count);for (in…...