langgraph实现无观测推理 (Reasoning without Observation)

news2025/1/11 2:56:45

图例
在这里插入图片描述

1. 图状态

在 LangGraph 中,每个节点都会更新一个共享的图状态。当任何节点被调用时,状态就是该节点的输入。

下面,我们将定义一个状态字典,用以包含任务、计划、步骤和其他变量。

from typing import List
from typing_extensions import TypedDict

class ReWOO(TypedDict):
    task: str
    plan_string: str
    steps: List
    results: dict
    result: str

2. Plan 计划节点

from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    temperature=0,
    model="GLM-4-plus",
    openai_api_key="your api key",
    openai_api_base="https://open.bigmodel.cn/api/paas/v4/"
)
prompt = """For the following task, make plans that can solve the problem step by step. For each plan, indicate \
which external tool together with tool input to retrieve evidence. You can store the evidence into a \
variable #E that can be called by later tools. (Plan, #E1, Plan, #E2, Plan, ...)

Tools can be one of the following:
(1) Google[input]: Worker that searches results from Google. Useful when you need to find short
and succinct answers about a specific topic. The input should be a search query.
(2) LLM[input]: A pretrained LLM like yourself. Useful when you need to act with general
world knowledge and common sense. Prioritize it when you are confident in solving the problem
yourself. Input can be any instruction.

For example,
Task: Thomas, Toby, and Rebecca worked a total of 157 hours in one week. Thomas worked x
hours. Toby worked 10 hours less than twice what Thomas worked, and Rebecca worked 8 hours
less than Toby. How many hours did Rebecca work?
Plan: Given Thomas worked x hours, translate the problem into algebraic expressions and solve
with Wolfram Alpha. #E1 = WolframAlpha[Solve x + (2x − 10) + ((2x − 10) − 8) = 157]
Plan: Find out the number of hours Thomas worked. #E2 = LLM[What is x, given #E1]
Plan: Calculate the number of hours Rebecca worked. #E3 = Calculator[(2 ∗ #E2 − 10) − 8]

Begin! 
Describe your plans with rich details. Each Plan should be followed by only one #E, follow th example format strictly.

Task: {task}"""
task = "what is the exact hometown of the 2024 mens australian open winner"
result = model.invoke(prompt.format(task=task))
print(result.content)
Plan: Search for the winner of the 2024 Men's Australian Open. #E1 = Google["2024 Men's Australian Open winner"]
Plan: Once the winner's name is known, search for his exact hometown. #E2 = Google["[Winner's Name] hometown"]
Plan: Verify the accuracy of the hometown information using a reliable source. #E3 = Google["[Winner's Name] biography site:ausopen.com"]
import re

from langchain_core.prompts import ChatPromptTemplate

# Regex to match expressions of the form E#... = ...[...]
regex_pattern = r"Plan:\s*(.+)\s*(#E\d+)\s*=\s*(\w+)\s*\[([^\]]+)\]"
prompt_template = ChatPromptTemplate.from_messages([("user", prompt)])
planner = prompt_template | model


def get_plan(state: ReWOO):
    task = state["task"]
    result = planner.invoke({"task": task})
    # Find all matches in the sample text
    matches = re.findall(regex_pattern, result.content)
    return {"steps": matches, "plan_string": result.content}
result = get_plan(ReWOO(task=task))
print(result)
{'steps': [("Search for the winner of the 2024 Men's Australian Open tennis tournament. ", '#E1', 'Google', '"2024 Men\'s Australian Open winner"'), ("Once the winner's name is known, search for his exact hometown. ", '#E2', 'Google', '"[Winner\'s Name'), ('Verify the accuracy of the hometown information using a reliable source. ', '#E3', 'Google', '"[Winner\'s Name')], 'plan_string': 'Plan: Search for the winner of the 2024 Men\'s Australian Open tennis tournament. #E1 = Google["2024 Men\'s Australian Open winner"]\nPlan: Once the winner\'s name is known, search for his exact hometown. #E2 = Google["[Winner\'s Name] hometown"]\nPlan: Verify the accuracy of the hometown information using a reliable source. #E3 = Google["[Winner\'s Name] biography site:officialtournamentwebsite.com"]'}

3. execution 计划执行节点

import os
os.environ["TAVILY_API_KEY"] = "your api key"

from langchain_community.tools.tavily_search import TavilySearchResults

search = TavilySearchResults()
def _get_current_task(state: ReWOO):
    if "results" not in state or state["results"] is None:
        return 1
    if len(state["results"]) == len(state["steps"]):
        return None
    else:
        return len(state["results"]) + 1


def tool_execution(state: ReWOO):
    """Worker node that executes the tools of a given plan."""
    _step = _get_current_task(state)
    _, step_name, tool, tool_input = state["steps"][_step - 1]
    _results = (state["results"] or {}) if "results" in state else {}
    for k, v in _results.items():
        tool_input = tool_input.replace(k, v)
    if tool == "Google":
        result = search.invoke(tool_input)
    elif tool == "LLM":
        result = model.invoke(tool_input)
    else:
        raise ValueError
    _results[step_name] = str(result)
    return {"results": _results}

4. solve 问题解决节点

solve_prompt = """Solve the following task or problem. To solve the problem, we have made step-by-step Plan and \
retrieved corresponding Evidence to each Plan. Use them with caution since long evidence might \
contain irrelevant information.

{plan}

Now solve the question or task according to provided Evidence above. Respond with the answer
directly with no extra words.

Task: {task}
Response:"""


def solve(state: ReWOO):
    plan = ""
    for _plan, step_name, tool, tool_input in state["steps"]:
        _results = (state["results"] or {}) if "results" in state else {}
        for k, v in _results.items():
            tool_input = tool_input.replace(k, v)
            step_name = step_name.replace(k, v)
        plan += f"Plan: {_plan}\n{step_name} = {tool}[{tool_input}]"
    prompt = solve_prompt.format(plan=plan, task=state["task"])
    result = model.invoke(prompt)
    return {"result": result.content}

5. graph 各个节点连接

def _route(state):
    _step = _get_current_task(state)
    if _step is None:
        # We have executed all tasks
        return "solve"
    else:
        # We are still executing tasks, loop back to the "tool" node
        return "tool"
from langgraph.graph import END, StateGraph, START

graph = StateGraph(ReWOO)
graph.add_node("plan", get_plan)
graph.add_node("tool", tool_execution)
graph.add_node("solve", solve)
graph.add_edge("plan", "tool")
graph.add_edge("solve", END)
graph.add_conditional_edges("tool", _route)
graph.add_edge(START, "plan")

app = graph.compile()

graph 可视化

from IPython.display import Image, display

try:
    display(Image(app.get_graph(xray=True).draw_mermaid_png()))
except Exception:
    # This requires some extra dependencies and is optional
    pass

在这里插入图片描述

6. 示例

for s in app.stream({"task": task}):
    print(s)
    print("---")
{'plan': {'plan_string': 'Plan: Search for the winner of the 2024 Men\'s Australian Open. #E1 = Google["2024 Men\'s Australian Open winner"]\nPlan: Once the winner\'s name is known, search for his exact hometown. #E2 = Google["[Winner\'s Name] hometown"]\nPlan: Verify the information to ensure accuracy. #E3 = LLM["Verify the hometown of [Winner\'s Name]"]', 'steps': [("Search for the winner of the 2024 Men's Australian Open. ", '#E1', 'Google', '"2024 Men\'s Australian Open winner"'), ("Once the winner's name is known, search for his exact hometown. ", '#E2', 'Google', '"[Winner\'s Name'), ('Verify the information to ensure accuracy. ', '#E3', 'LLM', '"Verify the hometown of [Winner\'s Name')]}}
---
{'tool': {'results': {'#E1': '[{\'url\': \'https://vsin.com/wp-content/uploads/2024/01/Circa-Betting-Sheets-1-18-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER VS FIELD ODDS. FIELD. PLAYER. EV 42202 -130 JANNIK SINNER. 42203 +365 42204 -470 DANIIL MEDVEDEV."}, {\'url\': \'https://langchain-ai.github.io/langgraph/tutorials/rewoo/rewoo/\', \'content\': "... 2024 Men\'s Australian Open winner. #E1 = Google[2024 Men\'s Australian Open winner]\\\\nPlan: Once the winner is identified, search for their exact hometown"}, {\'url\': \'https://vsin.com/wp-content/uploads/2024/01/circa-betting-sheets-1-22-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER. 42201. 42203. PLAYER VS FIELD ODDS. FIELD. EV 42202 -130 JANNIK SINNER. +365 42204 -470 DANIIL"}, {\'url\': \'https://www.bets.com.au/tennis/australian-open/2024-mens-australian-open-winner-betting-odds-20230206-0009/\', \'content\': "2024 Men\'s Australian Open Winner Betting Odds - Who will win the 2024 Australian Open? Randwick Betting Tips for September 21, 2024 - Race-By-Race preview for 7 Stakes day Caulfield Betting Tips for September 21, 2024 - Race-By-Race preview for Underwood Stakes day Belmont Betting Tips for September 21, 2024 - Vast to claim feature Underwood Stakes 2024 Betting Tips - Place vs Pericles Geelong vs Brisbane Tips - Cats to play second Grand Final in three years Melbourne Victory vs Adelaide United Tips, Predictions & Live Stream - Victory backed to make Australia Cup final South Melbourne vs Macarthur FC Tips, Predictions & Live Stream - Macarthur to reach Australia Cup final"}, {\'url\': \'https://www.happi.com/spf-365/\', \'content\': "This long-term collaboration with the 2024 men\'s Australian Open winner will leverage La Roche-Posay\'s Anthelios brand. On the Daily. Live"}]'}}}
---
{'tool': {'results': {'#E1': '[{\'url\': \'https://vsin.com/wp-content/uploads/2024/01/Circa-Betting-Sheets-1-18-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER VS FIELD ODDS. FIELD. PLAYER. EV 42202 -130 JANNIK SINNER. 42203 +365 42204 -470 DANIIL MEDVEDEV."}, {\'url\': \'https://langchain-ai.github.io/langgraph/tutorials/rewoo/rewoo/\', \'content\': "... 2024 Men\'s Australian Open winner. #E1 = Google[2024 Men\'s Australian Open winner]\\\\nPlan: Once the winner is identified, search for their exact hometown"}, {\'url\': \'https://vsin.com/wp-content/uploads/2024/01/circa-betting-sheets-1-22-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER. 42201. 42203. PLAYER VS FIELD ODDS. FIELD. EV 42202 -130 JANNIK SINNER. +365 42204 -470 DANIIL"}, {\'url\': \'https://www.bets.com.au/tennis/australian-open/2024-mens-australian-open-winner-betting-odds-20230206-0009/\', \'content\': "2024 Men\'s Australian Open Winner Betting Odds - Who will win the 2024 Australian Open? Randwick Betting Tips for September 21, 2024 - Race-By-Race preview for 7 Stakes day Caulfield Betting Tips for September 21, 2024 - Race-By-Race preview for Underwood Stakes day Belmont Betting Tips for September 21, 2024 - Vast to claim feature Underwood Stakes 2024 Betting Tips - Place vs Pericles Geelong vs Brisbane Tips - Cats to play second Grand Final in three years Melbourne Victory vs Adelaide United Tips, Predictions & Live Stream - Victory backed to make Australia Cup final South Melbourne vs Macarthur FC Tips, Predictions & Live Stream - Macarthur to reach Australia Cup final"}, {\'url\': \'https://www.happi.com/spf-365/\', \'content\': "This long-term collaboration with the 2024 men\'s Australian Open winner will leverage La Roche-Posay\'s Anthelios brand. On the Daily. Live"}]', '#E2': '[{\'url\': \'https://www.randompicker.com/blog/how-to-announce-winners/\', \'content\': \'The winner announcement is not just a formality; it is a key part of the contest lifecycle that can influence the participant experience and brand perception. Include RandomPicker.com’s public record link to announce the giveaway winner. Your entry in our [contest name] has been selected as the winner. Before you publicly announce the winner of a contest, wait for the winner to respond and accept the prize. Winner Announcement Write a detailed post highlighting the contest, the winner, and the prize. Instagram Contest Winner Announcement We are happy to announce that [winner’s name] is the winner of our [contest name]! Keep your contest landing page updated with the winner’s information, drawing information, a link to the public record, and a thank you message to all participants.\'}, {\'url\': \'https://pickerwheel.com/\', \'content\': "It will decide 1 winner among the list of candidates\' names from a contest after spinning the wheel. You can also use the wheel together with a countdown timer to carry out more interactive activities. 12.2. Elimination Mode. It picks a random name alternately by eliminating the inputs one by one. The result will be temporarily removed from"}, {\'url\': \'https://namepicker.net/\', \'content\': \'Name Picker is the free website with giveaways tools for Facebook, Instagram, YouTube and useful online tools. Name Picker is an easy-to-use online tool to quickly select a name from a list of names at random. You can add an unlimited number of entries and draw multiple random winners.\'}, {\'url\': \'https://www.random-name-generator.com/random-name-picker\', \'content\': \'Random Name Picker - Submit a list and draw a winner - Random-Name-Generator.Com Random Name Picker Random Name Picker - Submit a list and draw a winner Fill in the names and draw a winner Picked by: https://www.random-name-generator.com/random-name-picker   WHAT CAN I USE THIS RANDOM NAME PICKER FOR? Prize drawings: If you’re running a contest or giveaway, a random name picker can help you choose the winners fairly and efficiently. Whether you’re a teacher, event planner, or just looking for a way to add some excitement to your day, a random name picker is a useful tool to have on hand. Random Name Picker instantly draws one or multiple random winners from your submitted list. IS THIS NAME PICKER REALLY RANDOM?\'}, {\'url\': \'https://www.vancopayments.com/non-profit/blog/raffle-winner-announcement\', \'content\': \'Download eBook](https://www.vancopayments.com/education/the-comprehensive-guide-to-school-budget-planning?utm_campaign=Feature_Resource_CTA&utm_source=Website-CTA&utm_medium=organic&utm_content=Budget-Planning)            [![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传](https://img-home.csdnimg.cn/images/20230724024159.png?origin_url=https%3A%2F%2Fwww.vancopayments.com%2Fhs-fs%2Fhubfs%2FMJTW-assets%2Fchild-care%2FChild-CareK12-Pro.jpg%3Fwidth%3D400%26height%3D246%26name%3DChild-CareK12-Pro.jpg&pos_id=img-QyL7FaKF-1733735530387) A Guide to Before and After Care Management Establish strong policies, simplify billing, manage difficult parents, promote student well-being and more with this comprehensive guide. Download eBook](https://www.vancopayments.com/child-care/resource/how-to-manage-before-and-after-school-child-care-for-k12-schools?utm_campaign=Feature_Resource_CTA&utm_source=Website-CTA&utm_medium=organic&utm_content=After-School-eBook)            [![Image 5: Nonprofit-Kit_featured_image](https://i-blog.csdnimg.cn/img_convert/fe0a1c232215124dcf928724fde80773.jpeg) 100+ Fundraising Tools to Make Donations Skyrocket Struggling with fundraising? Use our free raffle winner announcement templates and examples to effectively notify participants and celebrate your giveaway success! Email announcements: Use a fun subject line like “You’re a Winner!” Personalize the message by addressing the recipient directly, and include the prize announcement, raffle results and winner notification. We’ve created several vibrant, eye-catching social media announcement images that you can use to highlight raffle or contest winners for your nonprofit.\'}]'}}}
---
{'tool': {'results': {'#E1': '[{\'url\': \'https://vsin.com/wp-content/uploads/2024/01/Circa-Betting-Sheets-1-18-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER VS FIELD ODDS. FIELD. PLAYER. EV 42202 -130 JANNIK SINNER. 42203 +365 42204 -470 DANIIL MEDVEDEV."}, {\'url\': \'https://langchain-ai.github.io/langgraph/tutorials/rewoo/rewoo/\', \'content\': "... 2024 Men\'s Australian Open winner. #E1 = Google[2024 Men\'s Australian Open winner]\\\\nPlan: Once the winner is identified, search for their exact hometown"}, {\'url\': \'https://vsin.com/wp-content/uploads/2024/01/circa-betting-sheets-1-22-24.pdf\', \'content\': "2024 MEN\'S AUSTRALIAN OPEN WINNER. PLAYER. 42201. 42203. PLAYER VS FIELD ODDS. FIELD. EV 42202 -130 JANNIK SINNER. +365 42204 -470 DANIIL"}, {\'url\': \'https://www.bets.com.au/tennis/australian-open/2024-mens-australian-open-winner-betting-odds-20230206-0009/\', \'content\': "2024 Men\'s Australian Open Winner Betting Odds - Who will win the 2024 Australian Open? Randwick Betting Tips for September 21, 2024 - Race-By-Race preview for 7 Stakes day Caulfield Betting Tips for September 21, 2024 - Race-By-Race preview for Underwood Stakes day Belmont Betting Tips for September 21, 2024 - Vast to claim feature Underwood Stakes 2024 Betting Tips - Place vs Pericles Geelong vs Brisbane Tips - Cats to play second Grand Final in three years Melbourne Victory vs Adelaide United Tips, Predictions & Live Stream - Victory backed to make Australia Cup final South Melbourne vs Macarthur FC Tips, Predictions & Live Stream - Macarthur to reach Australia Cup final"}, {\'url\': \'https://www.happi.com/spf-365/\', \'content\': "This long-term collaboration with the 2024 men\'s Australian Open winner will leverage La Roche-Posay\'s Anthelios brand. On the Daily. Live"}]', '#E2': '[{\'url\': \'https://www.randompicker.com/blog/how-to-announce-winners/\', \'content\': \'The winner announcement is not just a formality; it is a key part of the contest lifecycle that can influence the participant experience and brand perception. Include RandomPicker.com’s public record link to announce the giveaway winner. Your entry in our [contest name] has been selected as the winner. Before you publicly announce the winner of a contest, wait for the winner to respond and accept the prize. Winner Announcement Write a detailed post highlighting the contest, the winner, and the prize. Instagram Contest Winner Announcement We are happy to announce that [winner’s name] is the winner of our [contest name]! Keep your contest landing page updated with the winner’s information, drawing information, a link to the public record, and a thank you message to all participants.\'}, {\'url\': \'https://pickerwheel.com/\', \'content\': "It will decide 1 winner among the list of candidates\' names from a contest after spinning the wheel. You can also use the wheel together with a countdown timer to carry out more interactive activities. 12.2. Elimination Mode. It picks a random name alternately by eliminating the inputs one by one. The result will be temporarily removed from"}, {\'url\': \'https://namepicker.net/\', \'content\': \'Name Picker is the free website with giveaways tools for Facebook, Instagram, YouTube and useful online tools. Name Picker is an easy-to-use online tool to quickly select a name from a list of names at random. You can add an unlimited number of entries and draw multiple random winners.\'}, {\'url\': \'https://www.random-name-generator.com/random-name-picker\', \'content\': \'Random Name Picker - Submit a list and draw a winner - Random-Name-Generator.Com Random Name Picker Random Name Picker - Submit a list and draw a winner Fill in the names and draw a winner Picked by: https://www.random-name-generator.com/random-name-picker   WHAT CAN I USE THIS RANDOM NAME PICKER FOR? Prize drawings: If you’re running a contest or giveaway, a random name picker can help you choose the winners fairly and efficiently. Whether you’re a teacher, event planner, or just looking for a way to add some excitement to your day, a random name picker is a useful tool to have on hand. Random Name Picker instantly draws one or multiple random winners from your submitted list. IS THIS NAME PICKER REALLY RANDOM?\'}, {\'url\': \'https://www.vancopayments.com/non-profit/blog/raffle-winner-announcement\', \'content\': \'Download eBook](https://www.vancopayments.com/education/the-comprehensive-guide-to-school-budget-planning?utm_campaign=Feature_Resource_CTA&utm_source=Website-CTA&utm_medium=organic&utm_content=Budget-Planning)            [![Image 4: Child Care K12 Pro](https://i-blog.csdnimg.cn/img_convert/27723b77025c8446e833e14f071f9f0d.jpeg) A Guide to Before and After Care Management Establish strong policies, simplify billing, manage difficult parents, promote student well-being and more with this comprehensive guide. Download eBook](https://www.vancopayments.com/child-care/resource/how-to-manage-before-and-after-school-child-care-for-k12-schools?utm_campaign=Feature_Resource_CTA&utm_source=Website-CTA&utm_medium=organic&utm_content=After-School-eBook)            [![Image 5: Nonprofit-Kit_featured_image](https://i-blog.csdnimg.cn/img_convert/fe0a1c232215124dcf928724fde80773.jpeg) 100+ Fundraising Tools to Make Donations Skyrocket Struggling with fundraising? Use our free raffle winner announcement templates and examples to effectively notify participants and celebrate your giveaway success! Email announcements: Use a fun subject line like “You’re a Winner!” Personalize the message by addressing the recipient directly, and include the prize announcement, raffle results and winner notification. We’ve created several vibrant, eye-catching social media announcement images that you can use to highlight raffle or contest winners for your nonprofit.\'}]', '#E3': 'content="It seems like your request is incomplete. To verify the hometown of a specific individual, such as a winner of a competition, award, or any other context, I would need the full name of the person you are referring to. Additionally, if there are any specific details or context you can provide, such as the event they won or the field they are known for, it would help in providing a more accurate response.\\n\\nPlease provide the full name and any relevant details, and I\'ll do my best to assist you!" additional_kwargs={\'refusal\': None} response_metadata={\'token_usage\': {\'completion_tokens\': 106, \'prompt_tokens\': 14, \'total_tokens\': 120, \'completion_tokens_details\': None, \'prompt_tokens_details\': None}, \'model_name\': \'GLM-4-plus\', \'system_fingerprint\': None, \'finish_reason\': \'stop\', \'logprobs\': None} id=\'run-860033fb-04db-40b9-9cf5-041c3b14f470-0\' usage_metadata={\'input_tokens\': 14, \'output_tokens\': 106, \'total_tokens\': 120, \'input_token_details\': {}, \'output_token_details\': {}}'}}}
---
{'solve': {'result': "Jannik Sinner's hometown is San Candido, Italy."}}
---
# Print out the final result
print(s["solve"]["result"])
Jannik Sinner's hometown is San Candido, Italy.

用chatglm模型运行时有时候会出错。。。

参考连接:https://langchain-ai.github.io/langgraph/tutorials/rewoo/rewoo/
如果有任何问题,欢迎在评论区提问。

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

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

相关文章

2024企业数据资产入表合规指引——解读

更多数据资产资讯关注公众:数字化转型home 本报告旨在为企业数据资产入表提供合规保障。随着数字经济的发展,数据资产已成为重要战略资源和新生产要素。财政部发布的《企业数据资源相关会计处理暂行规定》明确,自2024年1月1日起,数…

19,[极客大挑战 2019]PHP1

这个好玩 看到备份网站字眼&#xff0c;用dirsearch扫描 在kali里打开 找出一个www.zip文件 访问一下 解压后是这个页面 class.php <?php include flag.php; error_reporting(0); class Name{ private $username nonono; private $password yesyes; public …

计算机键盘简史 | 键盘按键功能和指法

注&#xff1a;本篇为 “计算机键盘简史 | 键盘按键功能和指法” 相关文章合辑。 英文部分机翻未校。 The Evolution of Keyboards: From Typewriters to Tech Marvels 键盘的演变&#xff1a;从打字机到技术奇迹 Introduction 介绍 The keyboard has journeyed from a humb…

《Clustering Propagation for Universal Medical Image Segmentation》CVPR2024

摘要 这篇论文介绍了S2VNet&#xff0c;这是一个用于医学图像分割的通用框架&#xff0c;它通过切片到体积的传播&#xff08;Slice-to-Volume propagation&#xff09;来统一自动&#xff08;AMIS&#xff09;和交互式&#xff08;IMIS&#xff09;医学图像分割任务。S2VNet利…

HarmonyOS(65) ArkUI FrameNode详解

Node 1、Node简介2、FrameNode2.1、创建和删除节点2.2、对FrameNode的增删改2.3、 FramNode的查询功能3、demo源码4、总结5、参考资料1、Node简介 在HarmonyOS(63) ArkUI 自定义占位组件NodeContainer介绍了自定义节点复用的原理(阅读本本篇博文之前,建议先读读这个),在No…

Elasticsearch使用(2):docker安装es、基础操作、mapping映射

1 安装es 1.1 拉取镜像 docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/elasticsearch:7.17.3 1.2 运行容器 运行elasticsearch容器&#xff0c;挂载的目录给更高的权限&#xff0c;否则可能会因为目录权限问题导致启动失败&#xff1a; docker r…

java实现SpringBoot项目分页查询和消费的方法

简介 why&#xff1a; 最近在项目中&#xff0c;有一个sql需要查询100多万的数据&#xff0c;且需要在代码中遍历处理。面临两个问题 一次性查询出太多数据&#xff0c;速度较慢当前服务器内存支持以上操作&#xff0c;但是随着数据量的增多&#xff0c;以后可能会出现内存溢出…

专为高性能汽车设计的Armv9架构的Neoverse V3AE CPU基础知识与软件编码特性解析

一、ARMv9以及V3AE处理器架构 Armv9架构的Arm Neoverse V系列处理器是专为高性能计算设计的产品线&#xff0c;其中V3AE&#xff08;Advanced Efficiency&#xff09;特别强调了性能与效率之间的平衡。以下是关于Armv9架构下Neoverse V3AE处理器结构和指令集的一些详细解读&am…

Python数据清洗之重复数据处理

大家好&#xff0c;在数据处理和分析的过程中&#xff0c;重复数据是一个常见的问题。重复的数据不仅会影响数据的准确性&#xff0c;还可能导致模型训练中的偏差。因此&#xff0c;检测并清理重复数据是数据清洗中的重要步骤。Python 的 Pandas 提供了强大的功能来检测、标记和…

【实战教程】使用YOLO和EasyOCR实现视频车牌检测与识别【附源码】

《------往期经典推荐------》 一、AI应用软件开发实战专栏【链接】 项目名称项目名称1.【人脸识别与管理系统开发】2.【车牌识别与自动收费管理系统开发】3.【手势识别系统开发】4.【人脸面部活体检测系统开发】5.【图片风格快速迁移软件开发】6.【人脸表表情识别系统】7.【…

【项目实战】基于python+爬虫的电影数据分析及可视化系统

注意&#xff1a;该项目只展示部分功能&#xff0c;如需了解&#xff0c;文末咨询即可。 本文目录 1.开发环境2 系统设计 2.1 设计背景2.2 设计内容 3 系统页面展示 3.1 用户页面3.2 后台页面3.3 功能展示视频 4 更多推荐5 部分功能代码 5.1 爬虫代码5.2 电影信息代码 1.开发环…

SDXL的优化工作

本文详细介绍SDXL在SD系列的基础上做了什么优化&#xff0c;包括模型架构优化和训练过程数据的相关优化策略。 目录 Stable Diffusion XL核心基础内容 SDXL整体架构初识 Base模型 Refiner模型 Base——VAE Base——U-Net Base——Text Encoder Refiner GPT补充【TODO】 SDXL官方…

计算机网络 —— HTTPS 协议

前一篇文章&#xff1a;计算机网络 —— HTTP 协议&#xff08;详解&#xff09;-CSDN博客 目录 前言 一、HTTPS 协议简介 二、HTTPS 工作过程 1.对称加密 2.非对称加密 3.中间人攻击 4.引入证书 三、HTTPS 常见问题 1.中间人能否篡改证书&#xff1f; 2.中间人能否调…

YonBuilder移动开发——调用手机系统的浏览器打开网页

概述 在YonBuilder移动开发中&#xff0c;可以通过使用引擎提供的 api.openWin 或者 api.openFrame 函数方法通过内置的浏览器引擎在App内部打开相关的远程H5网站的网页。但是在实际项目开发中&#xff0c;可能会有一种需求&#xff0c;调用手机操作系统提供的系统浏览器去打开…

美畅物联丨视频接入网关如何配置 HTTPS 证书

在安防领域&#xff0c;视频接入网关&#xff08;Video Access Gateway&#xff0c;VAG&#xff09;是视频监控系统的重要组成部分&#xff0c;其职责是把视频数据从前端设备传输至后端服务器。配置HTTPS证书后&#xff0c;可对视频流进行加密传输&#xff0c;避免数据在网络传…

Redis原理—2.单机数据库的实现

大纲 1.Redis数据库的结构 2.读写Redis数据库键值时的处理 3.Redis数据库的构成 4.Redis过期键的删除策略 5.Redis的RDB持久化 6.Redis的AOF持久化 7.Redis的AOF重写机制 8.Redis持久化是影响其性能的高发地 9.Redis基于子进程实现持久化的使用建议 10.Redis持久化的…

Android平台GB28181设备接入模块动态文字图片水印技术探究

技术背景 前几年&#xff0c;我们发布的了Android平台GB28181设备接入模块&#xff0c;实现了不具备国标音视频能力的 Android终端&#xff0c;通过平台注册接入到现有的GB/T28181—2016或GB/T28181—2022服务。 Android终端除支持常规的音视频数据接入外&#xff0c;还可以支…

TaskBuilder SQL执行工具

为了方便开发者连接当前任擎服务器上配置的各个数据源对应的数据库进行相关操作&#xff0c;TaskBuilder提供了一个SQL执行工具&#xff0c;点击系统侧边栏里的执行SQL图标 &#xff0c;即可打开该工具&#xff0c;界面如下图所示&#xff1a; 该工具从上至下分为三个区域&a…

Redis中pipeline(管道)详解

redis管道pipeline 举个例子&#xff1a; 小卖铺免费让你拿50瓶饮料&#xff0c;你是一次拿一瓶拿回家&#xff0c;还是打包一次或者多次拿回家&#xff1f; 概念 Redis管道(pipelining)是一种在客户端向服务端发送多个请求而不等待响应的技术。它可以显著提高Redis应用程序…

01-Chromedriver下载与配置(mac)

下载地址&#xff1a; 这里我用的最后一个&#xff0c;根据自己chrome浏览器选择相应的版本号即可 ChromeDriver官网下载地址&#xff1a;https://sites.google.com/chromium.org/driver/downloads ChromeDriver官网最新版下载地址&#xff1a;https://googlechromelabs.git…