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

langchain 结构化输出

主要流程

1. 使用 Pydantic 定义结构化输出:

定义 AnswerWithJustification 类,用于描述输出的结构,包含以下字段:

  • answer:答案内容(字符串类型)。
  • justification:答案的理由或解释(字符串类型,部分场景为可选)。
    这种方法保证了 LLM 的输出符合预期的结构化格式。

2. with_structured_output 方法:

通过调用 with_structured_output 配置 LLM 以生成结构化的输出。
主要参数包括:

  • strict=True:严格模式,确保输出必须符合定义的结构。
  • include_raw=True:在返回的结果中同时包含模型的原始响应(未解析的JSON)以及解析后的对象。

3. 不同的输出结构实现方式:

基于 Pydantic:

  • 使用 AnswerWithJustification 类定义结构。
  • 输出严格符合类定义,模型会返回符合 BaseModel 结构的内容。

基于 JSON Schema:

  • 使用一个 oai_schema 字典直接定义输出的 JSON 格式(包括字段名称、描述及类型)。
  • JSON Schema 更灵活,适用于无需定义 Python 类的场景。

启用 json_mode:

  • 指定输出为纯 JSON 格式,并返回包含字段 answer 和 justification 的 JSON 数据。
  • 模型调用逻辑:

4. 配置一个名为 GLM-4-flash 的模型,使用指定的 API 密钥和自定义 API 地址。
使用 invoke 方法对问题生成答案,返回值包括:

  • raw:LLM 的原始 JSON 格式响应。
  • parsed:基于结构化输出模式解析后的对象(如符合 Pydantic 定义的实例)。
  • parsing_error:解析错误信息(若有)。

具体代码

1. strict=True

from typing import Optionalfrom langchain_openai import ChatOpenAI
from pydantic import BaseModel, Fieldclass AnswerWithJustification(BaseModel):'''An answer to the user question along with justification for the answer.'''answer: strjustification: Optional[str] = Field(default=..., description="A justification for the answer.")from langchain_openai import ChatOpenAI
llm = ChatOpenAI(temperature=0,model="GLM-4-flash",openai_api_key="your api key",openai_api_base="https://open.bigmodel.cn/api/paas/v4/"
)
structured_llm = llm.with_structured_output(AnswerWithJustification, strict=True
)structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers"
)
AnswerWithJustification(answer='a pound of bricks', justification="The weight of an object is measured in pounds, and a pound of bricks and a pound of feathers both weigh the same amount, one pound. The phrase 'a pound of bricks or a pound of feathers' is often used to illustrate the concept of weight versus volume, as bricks are denser and have less volume compared to feathers, making them heavier per unit volume.")

2. include_raw=True

from langchain_openai import ChatOpenAI
from pydantic import BaseModelclass AnswerWithJustification(BaseModel):'''An answer to the user question along with justification for the answer.'''answer: strjustification: strstructured_llm = llm.with_structured_output(AnswerWithJustification, include_raw=True
)structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers"
)
{'raw': AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_-9158287991605179419', 'function': {'arguments': '{"answer": "a pound of bricks", "justification": "The weight of an object is measured in pounds, and a pound of bricks and a pound of feathers both weigh the same amount, one pound. The phrase \'a pound of bricks or a pound of feathers\' is often used to illustrate the concept of weight versus volume, as bricks are denser and take up less volume than feathers for the same weight."}', 'name': 'AnswerWithJustification'}, 'type': 'function', 'index': 0}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 92, 'prompt_tokens': 187, 'total_tokens': 279, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'GLM-4-flash', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-b26e455f-34b1-46bf-92b5-9a6be1aa4379-0', tool_calls=[{'name': 'AnswerWithJustification', 'args': {'answer': 'a pound of bricks', 'justification': "The weight of an object is measured in pounds, and a pound of bricks and a pound of feathers both weigh the same amount, one pound. The phrase 'a pound of bricks or a pound of feathers' is often used to illustrate the concept of weight versus volume, as bricks are denser and take up less volume than feathers for the same weight."}, 'id': 'call_-9158287991605179419', 'type': 'tool_call'}], usage_metadata={'input_tokens': 187, 'output_tokens': 92, 'total_tokens': 279, 'input_token_details': {}, 'output_token_details': {}}),'parsed': AnswerWithJustification(answer='a pound of bricks', justification="The weight of an object is measured in pounds, and a pound of bricks and a pound of feathers both weigh the same amount, one pound. The phrase 'a pound of bricks or a pound of feathers' is often used to illustrate the concept of weight versus volume, as bricks are denser and take up less volume than feathers for the same weight."),'parsing_error': None}

3. schema

from langchain_openai import ChatOpenAIoai_schema = {'name': 'AnswerWithJustification','description': 'An answer to the user question along with justification for the answer.','parameters': {'type': 'object','properties': {'answer': {'type': 'string'},'justification': {'description': 'A justification for the answer.', 'type': 'string'}},'required': ['answer']}
}structured_llm = llm.with_structured_output(oai_schema)structured_llm.invoke("What weighs more a pound of bricks or a pound of feathers"
)
{'answer': 'a pound of bricks','justification': "The weight of an object is measured in pounds, and a pound of bricks and a pound of feathers both weigh the same amount, one pound. The phrase 'a pound of bricks or a pound of feathers' is a riddle that plays on the fact that both weigh the same, but bricks are denser and heavier in volume compared to feathers. However, in terms of actual weight, they are equal."}

4. method=“json_mode”, include_raw=True

from langchain_openai import ChatOpenAI
from pydantic import BaseModelclass AnswerWithJustification(BaseModel):answer: strjustification: strstructured_llm = llm.with_structured_output(AnswerWithJustification,method="json_mode",include_raw=True
)structured_llm.invoke("Answer the following question. ""Make sure to return a JSON blob with keys 'answer' and 'justification'.\\n\\n""What's heavier a pound of bricks or a pound of feathers?"
)
{'raw': AIMessage(content='{"answer":"a pound of bricks","justification":"The question is a classic riddle. The answer is \\u0027a pound of bricks\\u0027 because both the bricks and the feathers weigh one pound, but bricks are denser and thus heavier in terms of mass. The riddle plays on the word \\u0027heavier,\\u0027 which can refer to mass rather than weight."}', additional_kwargs={'parsed': None, 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 85, 'prompt_tokens': 97, 'total_tokens': 182, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'GLM-4-flash', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-5532c43c-45ad-4ae3-8a4f-ea2eea980778-0', usage_metadata={'input_tokens': 97, 'output_tokens': 85, 'total_tokens': 182, 'input_token_details': {}, 'output_token_details': {}}),'parsed': AnswerWithJustification(answer='a pound of bricks', justification="The question is a classic riddle. The answer is 'a pound of bricks' because both the bricks and the feathers weigh one pound, but bricks are denser and thus heavier in terms of mass. The riddle plays on the word 'heavier,' which can refer to mass rather than weight."),'parsing_error': None}

相关文章:

langchain 结构化输出

主要流程 1. 使用 Pydantic 定义结构化输出: 定义 AnswerWithJustification 类,用于描述输出的结构,包含以下字段: answer:答案内容(字符串类型)。justification:答案的理由或解释…...

开源Java快速自测工具,可以调用系统内任意一个方法

java快速测试框架,可以调到系统内任意一个方法,告别写单测和controller的困扰。 开源地址:https://gitee.com/missyouch/Easy-JTest 我们在开发时很多时候想要测试下自己的代码,特别是service层或者是更底层的代码,就…...

挺详细的记录electron【V 33.2.0】打包vue3项目为可执行程序

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言 一、直接看效果 二、具体步骤 1.安装配置electron 1.将 electron 包安装到应用的开发依赖中。 2.安装electron-packager依赖(打包可执行文件&#…...

相比普通LED显示屏,强力巨彩软模组有哪些优势?

在科技技术的加持下,LED显示屏市场各类创新产品层出不穷,为市场带来了无限可能。其中,强力巨彩R系列H版(软模组)凭借其独特的技术优势,在行业内脱颖而出。那么,相比常规LED显示屏,强…...

操作系统(7)处理机调度

前言 操作系统中的处理机调度是一个核心概念,它涉及如何从就绪队列中选择进程并将处理机分配给它以运行,从而实现进程的并发执行。 一、调度的层次 高级调度(作业调度): 调度对象:作业(包含程序…...

【Spark】Spark的两种核心Shuffle工作原理详解

如果觉得这篇文章对您有帮助,别忘了点赞、分享或关注哦!您的一点小小支持,不仅能帮助更多人找到有价值的内容,还能鼓励我持续分享更多精彩的技术文章。感谢您的支持,让我们一起在技术的世界中不断进步! Sp…...

10.qml使用 shadereffect 实现高斯模糊

目录 高斯模糊sigma获取加权均值获取 高斯二维公式实现高斯一维公式实现使用总结 高斯模糊 高斯模糊应用领域我就不过多讲解,想了解自己去了解 高斯模糊有 一维公式 二维公式 当然我们图像是二维的 但是实际上二维公式用于计算那是消耗大量的算力的&#xff0c…...

2024年12月GESPC++一级真题解析

一、单选题(每题2分,共30分) 题目123456789101112131415答案 C C D B B D B C C C D C D B D 1.2024 年 10 月 8 日,诺贝尔物理学奖 “ 意外地 ” 颁给了两位计算机科学家约翰 霍普菲尔德( John J. H…...

Nmap脚本参数详解

免责声明:使用本教程或工具,用户必须遵守所有适用的法律和法规,并且用户应自行承担所有风险和责任。 文章目录 一、 按脚本分类1. 检查身份验证机制2. 探测广播行为3. 登录爆破4. 默认脚本运行5. 网络资产发现6. Dos漏洞检测7. 漏洞利用8. 检…...

Rstudio-server的安装、配置、维护

一、安装Rstudio-server (1)安装R语言: sudo apt install r-base # 如果没有管理员权限无法操作 # 这样装上R默认在/usr/bin/R其实基本上的流程都可以参考posit的官网(也就是Rstudio的官网): https://posit.co/download/rstudio…...

2024ECCV|DiffBIR: 基于生成扩散先验进行盲图像恢复

文章标题:《DiffBIR: Towards Blind Image Restoration with Generative Diffusion Prior》 DiffBIR收录于2024ECCV,是中科院深圳先进技术研究院(董超等人)、上海AI Lab和香港中文大学联合发布的一项研究。 原文链接:h…...

前端报错npm ERR cb() never called问题

环境使用node版本v14.21.3&#xff0c;npm版本6.14.18 1.问题描述 1.1使用npm install后报错 npm ERR! cb() never called!npm ERR! This is an error with npm itself. Please report this error at: npm ERR! ? ? <https://npm.community>npm ERR! A complete log…...

SLM510A系列——24V,15到150mA单通道可调电流线性恒流LED驱动芯片

SLM510A 系列产品是单通道、高精度、可调电流线性恒流源的 LED 驱动芯片&#xff0c;在各种 LED 照明产品中非常简单易用。其在宽电压输入范围内&#xff0c;能保证极高的输出电流精度&#xff0c;从而在大面积的光源照明中&#xff0c;都能让 LED 照明亮度保持均匀一致。 由于…...

VBA API 概述 / 声明 / 宏编程

注&#xff1a;本文为 “VBA API 概述 | 宏编程 | 执行速度慢” 相关文章合辑。 未整理去重。 VBA API 详解 Office 二次开发于 2020-12-17 22:27:10 发布 Office 版本变动 在 Office 2010 之前&#xff0c;微软仅提供 32-bit 版本的 Office。而自 Office 2010 起&#xff0…...

Python 开源项目精彩荟萃

一、Web 开发框架 Django 高效路由系统&#xff1a; 支持基于正则表达式的复杂 URL 模式匹配&#xff0c;精准定位视图函数&#xff0c;例如可通过r^articles/(?P<year>\d{4})/$这样的正则表达式来匹配特定年份的文章列表页面 URL&#xff0c;并将年份参数传递给视图函数…...

Debezium系列之:使用Debezium采集oceanbase数据库

Debezium系列之:使用Debezium采集oceanbase数据库 一、oceanbase数据库二、安装OceanBase三、安装oblogproxy四、基于Docker的简单采集案例五、生产实际应用案例Debezium 是一个开源的分布式平台,用于监控数据库变化和捕捉数据变动事件,并以事件流的形式导出到各种消费者。D…...

AI初创企业的未来趋势和潜在挑战

AI初创企业的未来趋势和潜在挑战 AI初创企业的未来趋势和潜在挑战可以从多个方面进行分析&#xff1a; 未来趋势 AI监管: 随着AI技术的快速发展&#xff0c;各国政府开始制定相关法规&#xff0c;以确保AI的安全和伦理使用。这将影响初创企业的运营模式和市场准入。 日常生活…...

Grafana配置告警规则推送企微机器人服务器资源告警

前提 已经部署Grafana&#xff0c;并且dashboard接入数据 大屏编号地址&#xff1a;Node Exporter Full | Grafana Labs 创建企微机器人 备注&#xff1a;群里若有第三方外部人员不能创建 机器人创建完成&#xff0c;记录下来Webhook地址 Grafana配置告警消息模板 {{ define &…...

RFDiffusion xyz_to_c6d函数解读

函数 xyz_to_c6d将给定的蛋白质主链坐标 (N,Cα,C)转换为 6D矩阵表示,即用以下几何特征描述两两残基之间的关系: 距离 dist:残基间 Cβ 原子的欧几里得距离。二面角 omega:两个残基的 Cα−Cβ 向量之间的二面角。二面角 theta:由 N−Cα−Cβ和 Cβ间向量定义的二面角。平…...

#渗透测试#漏洞挖掘#红蓝攻防#护网#sql注入介绍01

免责声明 本教程仅为合法的教学目的而准备&#xff0c;严禁用于任何形式的违法犯罪活动及其他商业行为&#xff0c;在使用本教程前&#xff0c;您应确保该行为符合当地的法律法规&#xff0c;继续阅读即表示您需自行承担所有操作的后果&#xff0c;如有异议&#xff0c;请立即停…...

VSCode 报错:rust-analyzer requires glibc >= 2.28 in latest build

报错信息 /home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.953/server/rust-analyzer: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.29 not found (required by /home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.9…...

x2go远程控制

X2Go 优点&#xff1a;专为远程桌面和图形界面优化。性能优越&#xff0c;特别是在网络带宽较低的情况下&#xff0c;采用了高效的压缩和缓存技术。支持多用户、会话恢复功能&#xff0c;适合企业使用。使用 SSH 连接&#xff0c;具有较好的安全性。 安装与配置&#xff1a;需…...

SQL 单表查询练习题(一)

在 SQL 的学习过程中&#xff0c;单表查询是非常重要的基础部分&#xff0c;下面为大家分享一些单表查询的练习题以及对应的正确答案&#xff0c;希望能帮助大家更好地掌握相关知识。 一、题目及答案详情 1. 查询课程表中&#xff0c;没有前序课程的课程信息&#xff0c;查询…...

Ubuntu 安装texstudio sty与texlive

手动安装需要的包 访问CTAN网站&#xff08;Comprehensive TeX Archive Network&#xff09;并下载enumitem宏包&#xff1a; enumitem CTAN页面下载后&#xff0c;将宏包解压到/usr/share/texmf/tex/latex/下。 可打开texstudio/帮助/宏包帮助下载。 如果不想手动安装一个个…...

DevExpress WPF中文教程:Grid - 如何移动和调整列大小?(一)

DevExpress WPF拥有120个控件和库&#xff0c;将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpress WPF能创建有着强大互动功能的XAML基础应用程序&#xff0c;这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。 无论是Office办公软件…...

【现代服务端架构】传统服务器 对比 Serverless

在现代开发中&#xff0c;选择合适的架构是至关重要的。两种非常常见的架构模式分别是 传统服务器架构 和 Serverless。它们各有优缺点&#xff0c;适合不同的应用场景。今天&#xff0c;我就带大家一起对比这两种架构&#xff0c;看看它们的差异&#xff0c;并且帮助你选择最适…...

SecureCRT/FX使用[无限试用SecureCRT][新版本SecureFX双击站点总是自动跳到SecureCRT]

无限试用SecureCRT 本文摘录于&#xff1a;https://blog.csdn.net/qq_52162404/article/details/139703993#:~:textSecureCRT只是做学习备份之用&#xff0c;绝无抄袭之意&#xff0c;有疑惑请联系本人&#xff01; 我这里修改BAT如下,同时删除CRT和FX的license: echo off re…...

c++ CMakeLists.txt详解

基本结构 CMake 最低版本声明 用于指定需要的最低 CMake 版本&#xff0c;确保兼容性。 cmake_minimum_required(VERSION 3.10)指定 CMake 的最低版本。确保用户的 CMake 版本符合项目需求&#xff0c;否则报错。版本选择建议根据项目使用的功能决定。例如&#xff0c;3.10 引…...

树状数组详解

概述 树状数组&#xff08;Binary Indexed Tree&#xff0c;简称BIT&#xff09;&#xff0c;是一种数据结构&#xff0c;用于处理区间查询和更新问题。它是一种可以高效地在对数级别时间复杂度内进行单点更新和区间查询的数据结构。树状数组通常用于解决以下两类问题&#xf…...

photoshop的2个形状-箭头

有时候用ps画一些教程类图文&#xff0c;需要用到箭头. 另外自己画了一个镂空的长方形和正方形 形状的路径一般在Custom Shapes文件夹内 例如 E:\photoshopCS4\Adobe Photoshop CS4\Presets\Custom Shapes...

docker 部署 redis

docker 部署 redis 1. 下载 redis 镜像 # docker images | grep redis bitnami/redis 7.2.4-debian-11-r5 45de196aef7e 10 months ago 95.2MB2. docker-compose 部署 version: "3" services:redis:image: bitnami/redis:7.2.4-debian-11-…...

如何持续优化呼叫中心大模型呼入机器人的性能?

如何持续优化呼叫中心大模型呼入机器人的性能&#xff1f; 原作者&#xff1a;开源呼叫中心FreeIPCC&#xff0c;其Github&#xff1a;https://github.com/lihaiya/freeipcc 持续优化呼叫中心大模型呼入机器人的性能是一个复杂而细致的过程&#xff0c;它涉及到数据、模型结构…...

【01】mysql安装后MySQL Configurator无法启动的问题

安装完Mysql之后打开MySql Configurator提示MySQL Configurator Internal error.(值不能为null.参数名:input) The Configurator will now close. mysql安装后MySQL Configurator无法启动的问题 文章目录 mysql安装后MySQL Configurator无法启动的问题1.MySQL Configurator无法…...

基于单片机的血氧心率检测与报警系统(论文+源码)

1系统的功能及方案设计 本次课题为基于单片机的血氧心率检测与报警系统研制&#xff0c;在此设计了如图2.1所示的系统结构框图&#xff0c;整个系统包括了MAX30102心率血氧检测模块&#xff0c;DS18B20体温检测模块&#xff0c;液晶显示模块&#xff0c;按键以及主控制器stm32…...

科技潮头浪接天,一桥飞架两界连。EthernetIP转Profinet互译连

本案例介绍的是西门子1200PLC通过稳联技术PROFINET转EtherNetIP网关&#xff08;WL-ABC2006&#xff09;连接HCS-6100系统配置案例。 打开稳联技术Ethernetip转profient网关(WL-ABC2006)配置软件&#xff0c;因为网关作为EtherNetIP从站&#xff0c;所以选择PN2EIP。设置网关Pr…...

day11 性能测试(4)——Jmeter使用(黑马的完结,课程不全)直连数据库+逻辑控制器+定时器

【没有所谓的运气&#x1f36c;&#xff0c;只有绝对的努力✊】 目录 1、复习 1.1 断言&#xff08;3种&#xff09; 1.2 关联&#xff08;3种&#xff09; 1.3 录制脚本 2、Jmeter直连数据库 2.1 直连数据库——使用场景 2.2 直连数据库——操作步骤 2.2.1 案例1&…...

如何使用 Python 读取文本文件?

在Python编程中&#xff0c;读取文本文件是一项基本且重要的操作。 无论是处理日志文件、配置文件&#xff0c;还是进行数据分析&#xff0c;都需要用到这一技能。 下面&#xff0c;我将详细介绍如何使用Python读取文本文件&#xff0c;并提供一些实际开发中的建议和注意事项…...

11. qml ShaderEffect实现阴影效果

目录 MDropShadow.qml使用 MDropShadow.qml 基于上一章所制作的MGaussianBlur.qml 开发 MDropShadow阴影效果 import QtQuick 2.12Item {id: controlproperty var source;property real radius: 4property bool cached: falseproperty int offsetX: 0property int offsetY: 0…...

故障013:易忘的NULL表达式

故障013&#xff1a;易忘的NULL表达式 一、问题引入二、探索之路2.1 数据准备2.2 回顾NULL表达式2.3 重现问题2.3.1 分析原因2.3.2 如何化解预期&#xff1f; 三、知识总结 一、问题引入 某单位开发人员理直气壮抛出一张截图&#xff0c;以红色醒目地标记问题&#xff0c;好似…...

基于nginx和ffmpeg搭建HTTP FLV流媒体服务器

一、简介 整体是使用nginx搭建HTTP FLV流媒体服务器&#xff1a; 流程&#xff1a;音视频->rtmp->http-flv 音视频转为rtmp需要借助ffmpeg转化。 rtmp转为http-flv需要借助nginx转化。 nginx-http-flv-module是基于nginx-rtmp-module开发的&#xff0c;包含nginx-rt…...

【人工智能】用Python构建高效的自动化数据标注工具:从理论到实现

《Python OpenCV从菜鸟到高手》带你进入图像处理与计算机视觉的大门&#xff01; 数据标注是构建高质量机器学习模型的关键环节&#xff0c;但其耗时耗力常成为制约因素。本篇文章将介绍如何用Python构建一个自动化数据标注工具&#xff0c;结合机器学习和NLP技术&#xff0c;…...

MVC基础——市场管理系统(四)

文章目录 项目地址六、EF CORE6.1 配置ef core环境6.2 code first6.2.1 创建Database context1. 添加navigation property2. 添加MarketContext上下文七、Authentication7.1 添加Identity7.2 Run DB migration for Identity7.3 使用Identity7.3.1 设置认证中间件7.3.2 设置权限…...

多模块应用、发布使用第三方库(持续更新中)

目录: 1、多模块概述&#xff08;HAP、HSP、HAR&#xff09; HAR与HSP两种共享包的主要区别体现在&#xff1a; 2、三类模块&#xff1a; 3、创建项目&#xff1a;项目名&#xff1a;meituan &#xff08;1&#xff09;创建Ability类型的Module&#xff0c;编译后为HAP文件…...

MVP模式的理解和实践

MVP&#xff08;Model-View-Presenter&#xff09;模式是一种用于组织代码的架构模式&#xff0c;主要用于用户界面的开发。它通过将应用程序的三个主要组件分开&#xff0c;提高了应用的可维护性和可测试性。本文将详细介绍MVP模式的理解和实践&#xff0c;并通过Java语言提供…...

开启第二阶段---蓝桥杯

一、12.10--数据类型的范围及转化 今天是刚开始&#xff0c;一天一道题 对于这道题我想要记录的是Java中的整数默认是 int 类型&#xff0c;如果数值超出了 int 的范围&#xff0c;就会发生溢出错误。为了避免这个问题&#xff0c;可以将数字表示为 long 类型&#xff0c;方法…...

Linux 网络流量控制 - 实现概述

摘要 Linux 提供了一整套丰富的流量控制(traffic control)功能。本文档概述了相应的内核代码设计&#xff0c;描述了其结构&#xff0c;并通过描述一种新的排队策略来说明新元素的添加。 1 引言 最近的Linux内核提供了多种流量控制功能。Alexey Kuznetsov&#xff08;kuznet…...

分布式 Raft算法 总结

前言 相关系列 《分布式 & 目录》《分布式 & Raft算法 & 总结》《分布式 & Raft算法 & 问题》 参考文献 《Raft一致性算法论文译文》《深入剖析共识性算法 Raft》 简介 Raft 木筏是一种基于日志复制实现的分布式容错&一致性算法。在Raft算法…...

【前端面试题】变量提升、闭包、promise

飞书面试 题目1&#xff1a; async function foo() {console.log(foo start);await bar();console.log(foo end); }async function bar() {console.log(bar start);return new Promise((resolve, reject) > {setTimeout(() > {console.log(bar promise);resolve();}, 1…...

UE5安装Fab插件

今天才知道原来Fab也有类似Quixel Bridge的插件&#xff0c;于是立马就安装上了&#xff0c;这里分享一下安装方法 在Epic客户端 - 库 - Fab Library 搜索 Fab 即可安装Fab插件 然后重启引擎&#xff0c;在插件面板勾选即可 然后在窗口这就有了 引擎左下角也会多出一个Fab图标…...

数据分析思维(一):业务指标(数据分析并非只是简单三板斧)

个人认为&#xff0c;数据分析并非只是简单的数据分析工具三板斧——Excel、SQL、Python&#xff0c;更重要的是数据分析思维。没有数据分析思维和业务知识&#xff0c;就算拿到一堆数据&#xff0c;也不知道如何下手。 推荐书本《数据分析思维——分析方法和业务知识》&#x…...