如何实现LLM的通用function-calling能力?

news2024/9/20 11:04:45

众所周知,LLM的函数function-calling能力很强悍,解决了大模型与实际业务系统的交互问题。其本质就是函数调用。

从openai官网摘图:

简而言之:

  1. LLM起到决策的作用,告知业务系统应该调用什么函数,以及入参是什么。

  2. 业务系统负责实现对应的函数(比如本地实现,或者调用其他系统提供的服务),并且将函数的响应结果再次抛给LLM。

  3. LLM根据响应结果,组织自然语言,继续与业务系统进行交互。

在这里,有很多小伙伴会有一个误区:误以为函数调用是有LLM本身执行的。其实,LLM仅仅做决策,而实际的调用是由业务系统完成的。

现阶段,function-calling能力的实现有两种主流方式:

  1. LLM本身支持。

  2. 利用Prompt模板实现,典型如ReAct模板。

在实际的应用过程中,我们还要解决另一个重要问题:

function-calling触发机制是怎样的?也即:何时要使用function-calling能力,何时不应该使用?

这个问题的处理方式,对于整体流程的运行至关重要。

此时,我们可以使用特定Prompt来解决该问题:

You have access to the following tools:  
{json.dumps(tools)}  
You can select one of the above tools or just response user's content and respond with only a JSON object matching the following schema:  
{{  
  "tool": <name of the selected tool>,  
  "tool_input": <parameters for the selected tool, matching the tool'  
s JSON schema>,  
  "message": <direct response users content>}

该Prompt告知了LLM:如果需要使用function-calling能力,那么就从tools(tools是预定义的functions)中选取一个最匹配的函数;如果不需要,就用自然语言与用户交互,此时与正常的对话流程无异。输出的格式固定为json,方便解析。

由此,我们受到启发:只要LLM基座够强(能够严格遵循Prompt响应诉求),即使LLM本身不支持function-calling,我们也可以自己实现function-calling,脱离对特定LLM的依赖!

拿到function-calling的结果后,若要用自然语言的形式输出结果,还要再调用一次LLM,对结果进行整合。此时可以使用另一个Prompt:

Please generate a natural language description based on the following question and answer.  
Question: [Content of the question]  
Answer: [Content of the answer]  
Generated Description: The result of [key phrase from the question] is [answer].  
If necessary, you can polish the description.Only output the Description, with Chinese language.

该Prompt的作用就是告诉LLM,你要根据我的问题和答案,用自然语言重新描述一遍。这里指定了中文输出,可根据实际需要进行调整。

以下是一个可运行的完整Python脚本:

import requests  
import json  
import random  
  
# 预置函数定义  
tools = [  
    {  
        "name": "get_current_weather",  
        "description": "Get the current weather in a given location",  
        "parameters": {  
            "type": "object",  
            "properties": {  
                "location": {  
                    "type": "string",  
                    "description": "The city e.g. Beijing"  
                },  
                "unit": {  
                    "type": "string",  
                    "enum": [  
                        "celsius"  
                    ]  
                }  
            },  
            "required": [  
                "location"  
            ]  
        }  
    },  
    {  
        "name": "calculator",  
        "description": "计算器",  
        "parameters": {  
            "type": "int",  
            "properties": {  
                "a": {  
                    "type": "int",  
                    "description": "the first number"  
                },  
                "b": {  
                    "type": "int",  
                    "description": "the second number"  
                }  
            },  
            "required": [  
                "a",  
                "b"  
            ]  
        }  
    }  
]  
  
# 获取天气(随机返回,实际使用可以替换为api调用)  
def get_current_weather(*args):  
    # 定义可能的天气状态  
    weather_conditions = ["sunny", "cloudy", "rainy", "snowy"]  
    # 定义可能的温度范围  
    temperature_min = -10  # 最低温度,摄氏度  
    temperature_max = 35  # 最高温度,摄氏度  
    # 随机选择一个天气状态  
    condition = random.choice(weather_conditions)  
    # 随机生成一个温度  
    temperature = random.randint(temperature_min, temperature_max)  
    # 返回一个描述当前天气的字符串  
    return f"The weather of {args[0].get('location')} is {condition}, and the temperature is {temperature}°C."  
  
def calculator(args):  
    return sum(value for value in args.values() if isinstance(value, int))  
  
# 函数映射集合  
functions = {  
    "get_current_weather": get_current_weather,  
    "calculator": calculator,  
}  
  
# 驱动整体流程的入口prompt  
entrance_prompt = f"""You have access to the following tools:  
{json.dumps(tools)}  
You can select one of the above tools or just response user's content and respond with only a JSON object matching the following schema:  
{{  
  "tool": <name of the selected tool>,  
  "tool_input": <parameters for the selected tool, matching the tool's JSON schema>,  
  "message": <direct response users content>  
}}"""  
  
# 请以自然语言的形式对结果进行描述  
conformity_prompt = f"""  
Please generate a natural language description based on the following question and answer.  
Question: [Content of the question]  
Answer: [Content of the answer]  
Generated Description: The result of [key phrase from the question] is [answer].  
If necessary, you can polish the description.  
Only output the Description, with Chinese language.  
"""  
  
def extract_json(s):  
    stack = 0  
    start = s.find('{')  
    if start == -1:  
        return None  
  
    for i in range(start, len(s)):  
        if s[i] == '{':  
            stack += 1  
        elif s[i] == '}':  
            stack -= 1  
            if stack == 0:  
                return s[start:i + 1]  
    return None  
  
# 结果包装器,type为func表示是函数调用返回的结果,default表示是自然语言结果。对于func返回的结果,会用LLM再次总结  
class ResultWrapper:  
    def __init__(self, type, result):  
        self.type = type  
        self.result = result  
  
# 解析LLM返回的结果,如果有json则去解析json  
def parse_result(res):  
    json_str = extract_json(res["message"]["content"])  
    if json_str is not None:  
        obj = json.loads(json_str)  
        if "tool" in obj:  
            if obj["tool"] in functions:  
                fun = functions[obj["tool"]]  
                return ResultWrapper("func", fun(obj["tool_input"]))  
            else:  
                return ResultWrapper("default", obj["message"])  
        else:  
            return ResultWrapper("default", res["message"]["content"])  
    else:  
        return ResultWrapper("default", res["message"]["content"])  
  
def invokeLLM(messages):  
    url = "${domain}/v1/chat/completions" #需替换域名  
    model = ""  
    payload = {  
        "model": model,  
        "messages": messages,  
    }  
    payload = json.dumps(payload)  
    headers = {  
        'Content-Type': 'application/json'  
    }  
    print("PAYLOAD: ", payload)  
    response = requests.request("POST", url, headers=headers, data=payload)  
    print("RESPONSE: ", response.text)  
    print("=======================================================================")  
    resp = json.loads(response.text)  
    return resp["choices"][0]  
  
  
if __name__ == '__main__':  
    while True:  
        messages = [  
            {  
                "role": "system",  
                "content": entrance_prompt  
            }  
        ]  
        user_input = input('Enter a string: ')  
        messages.append({  
            "role": "user",  
            "content": user_input  
        })  
        result_wrapper = parse_result(invokeLLM(messages))  
        if result_wrapper.type == "func":  
            messages = [  
                {  
                    "role": "user",  
                    "content": f"{conformity_prompt}\n\nThe question:{user_input}\nThe answer:{result_wrapper.result}"  
                }  
            ]  
            print("FINAL RESULT WITH FUNCTION CALL: ", parse_result(invokeLLM(messages)).result)  
        else:            print("FINAL RESULT: ", result_wrapper.result

实验效果:

Enter a string: 你好  
PAYLOAD: {"model": "", "messages": [{"role": "system", "content": "You have access to the following tools:\n[{\"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city e.g. Beijing\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\"]}}, \"required\": [\"location\"]}}, {\"name\": \"calculator\", \"description\": \"\\u8ba1\\u7b97\\u5668\", \"parameters\": {\"type\": \"int\", \"properties\": {\"a\": {\"type\": \"int\", \"description\": \"the first number\"}, \"b\": {\"type\": \"int\", \"description\": \"the second number\"}}, \"required\": [\"a\", \"b\"]}}]\nYou can select one of the above tools or just response user's content and respond with only a JSON object matching the following schema:\n{\n \"tool\": <name of the selected tool>,\n \"tool_input\": <parameters for the selected tool, matching the tool's JSON schema>,\n \"message\": <direct response users content>\n}"}, {"role": "user", "content": "\u4f60\u597d"}]}  
RESPONSE: {"model":"","object":"","choices":[{"index":0,"message":{"role":"assistant","content":"```json\n{\"tool\": null, \"tool_input\": null, \"message\": \"你好,有什么可以帮您的吗?\"}\n```","function_call":null},"finish_reason":"stop"}],"queueTime":0.0020923614501953125,"costTime":0.7685532569885254,"usage":{"prompt_token":244,"completion_token":29,"total_tokens":273}}  
=======================================================================  
FINAL RESULT: 你好,有什么可以帮您的吗?  
  
  
Enter a string: 厦门天气如何?  
PAYLOAD: {"model": "", "messages": [{"role": "system", "content": "You have access to the following tools:\n[{\"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city e.g. Beijing\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\"]}}, \"required\": [\"location\"]}}, {\"name\": \"calculator\", \"description\": \"\\u8ba1\\u7b97\\u5668\", \"parameters\": {\"type\": \"int\", \"properties\": {\"a\": {\"type\": \"int\", \"description\": \"the first number\"}, \"b\": {\"type\": \"int\", \"description\": \"the second number\"}}, \"required\": [\"a\", \"b\"]}}]\nYou can select one of the above tools or just response user's content and respond with only a JSON object matching the following schema:\n{\n \"tool\": <name of the selected tool>,\n \"tool_input\": <parameters for the selected tool, matching the tool's JSON schema>,\n \"message\": <direct response users content>\n}"}, {"role": "user", "content": "\u53a6\u95e8\u5929\u6c14\u5982\u4f55\uff1f"}]}  
RESPONSE: {"model":"","object":"","choices":[{"index":0,"message":{"role":"assistant","content":"```json\n{\"tool\": \"get_current_weather\", \"tool_input\": {\"location\": \"Xiamen\", \"unit\": \"celsius\"}, \"message\": \"\"}\n```","function_call":null},"finish_reason":"stop"}],"queueTime":0.0021338462829589844,"costTime":0.9370713233947754,"usage":{"prompt_token":247,"completion_token":36,"total_tokens":283}}  
=======================================================================  
PAYLOAD: {"model": "", "messages": [{"role": "user", "content": "\nPlease generate a natural language description based on the following question and answer.\nQuestion: [Content of the question]\nAnswer: [Content of the answer]\nGenerated Description: The result of [key phrase from the question] is [answer].\nIf necessary, you can polish the description.\nOnly output the Description, with Chinese language.\n\n\nThe question:\u53a6\u95e8\u5929\u6c14\u5982\u4f55\uff1f\nThe answer:The weather of Xiamen is cloudy, and the temperature is 35\u00b0C."}]}  
RESPONSE: {"model":"","object":"","choices":[{"index":0,"message":{"role":"assistant","content":"厦门天气情况是:多云,气温35°C。","function_call":null},"finish_reason":"stop"}],"queueTime":0.008246660232543945,"costTime":0.3240656852722168,"usage":{"prompt_token":143,"completion_token":12,"total_tokens":155}}  
=======================================================================  
FINAL RESULT WITH FUNCTION CALL: 厦门天气情况是:多云,气温35°C。  
  
  
Enter a string: 383加上135721等于多少?  
PAYLOAD: {"model": "", "messages": [{"role": "system", "content": "You have access to the following tools:\n[{\"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city e.g. Beijing\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\"]}}, \"required\": [\"location\"]}}, {\"name\": \"calculator\", \"description\": \"\\u8ba1\\u7b97\\u5668\", \"parameters\": {\"type\": \"int\", \"properties\": {\"a\": {\"type\": \"int\", \"description\": \"the first number\"}, \"b\": {\"type\": \"int\", \"description\": \"the second number\"}}, \"required\": [\"a\", \"b\"]}}]\nYou can select one of the above tools or just response user's content and respond with only a JSON object matching the following schema:\n{\n \"tool\": <name of the selected tool>,\n \"tool_input\": <parameters for the selected tool, matching the tool's JSON schema>,\n \"message\": <direct response users content>\n}"}, {"role": "user", "content": "383\u52a0\u4e0a135721\u7b49\u4e8e\u591a\u5c11\uff1f"}]}  
RESPONSE: {"model":"","object":"","choices":[{"index":0,"message":{"role":"assistant","content":"```json\n{\"tool\": \"calculator\", \"tool_input\": {\"a\": 383, \"b\": 135721}, \"message\": null}\n```","function_call":null},"finish_reason":"stop"}],"queueTime":0.0021514892578125,"costTime":0.9161381721496582,"usage":{"prompt_token":252,"completion_token":35,"total_tokens":287}}  
=======================================================================  
PAYLOAD: {"model": "", "messages": [{"role": "user", "content": "\nPlease generate a natural language description based on the following question and answer.\nQuestion: [Content of the question]\nAnswer: [Content of the answer]\nGenerated Description: The result of [key phrase from the question] is [answer].\nIf necessary, you can polish the description.\nOnly output the Description, with Chinese language.\n\n\nThe question:383\u52a0\u4e0a135721\u7b49\u4e8e\u591a\u5c11\uff1f\nThe answer:136104"}]}  
RESPONSE: {"model":"","object":"","choices":[{"index":0,"message":{"role":"assistant","content":"383加上135721等于136104。","function_call":null},"finish_reason":"stop"}],"queueTime":0.0064160823822021484,"costTime":0.28981900215148926,"usage":{"prompt_token":134,"completion_token":11,"total_tokens":145}}  
=======================================================================  
FINAL RESULT WITH FUNCTION CALL: 383加上135721等于136104。

在这个例子中,预置了两个函数,分别为天气查询和计算器,实验效果中进行了三轮,其中第一次属于未命中函数调用的闲聊场景,后两次分别命中了天气查询和计算器。

在实际的工作中,可能需要预置非常多函数能力,此时可能需要考虑到LLM的输入token限制,必要时需要进行模块划分,将一次LLM决策转化为多次决策,更通用一点的说法就是意图层级识别。

如何学习大模型 AI ?

由于新岗位的生产效率,要优于被取代岗位的生产效率,所以实际上整个社会的生产效率是提升的。

但是具体到个人,只能说是:

“最先掌握AI的人,将会比较晚掌握AI的人有竞争优势”。

这句话,放在计算机、互联网、移动互联网的开局时期,都是一样的道理。

我在一线互联网企业工作十余年里,指导过不少同行后辈。帮助很多人得到了学习和成长。

我意识到有很多经验和知识值得分享给大家,也可以通过我们的能力和经验解答大家在人工智能学习中的很多困惑,所以在工作繁忙的情况下还是坚持各种整理和分享。但苦于知识传播途径有限,很多互联网行业朋友无法获得正确的资料得到学习提升,故此将并将重要的AI大模型资料包括AI大模型入门学习思维导图、精品AI大模型学习书籍手册、视频教程、实战学习等录播视频免费分享出来。

在这里插入图片描述

第一阶段(10天):初阶应用

该阶段让大家对大模型 AI有一个最前沿的认识,对大模型 AI 的理解超过 95% 的人,可以在相关讨论时发表高级、不跟风、又接地气的见解,别人只会和 AI 聊天,而你能调教 AI,并能用代码将大模型和业务衔接。

  • 大模型 AI 能干什么?
  • 大模型是怎样获得「智能」的?
  • 用好 AI 的核心心法
  • 大模型应用业务架构
  • 大模型应用技术架构
  • 代码示例:向 GPT-3.5 灌入新知识
  • 提示工程的意义和核心思想
  • Prompt 典型构成
  • 指令调优方法论
  • 思维链和思维树
  • Prompt 攻击和防范

第二阶段(30天):高阶应用

该阶段我们正式进入大模型 AI 进阶实战学习,学会构造私有知识库,扩展 AI 的能力。快速开发一个完整的基于 agent 对话机器人。掌握功能最强的大模型开发框架,抓住最新的技术进展,适合 Python 和 JavaScript 程序员。

  • 为什么要做 RAG
  • 搭建一个简单的 ChatPDF
  • 检索的基础概念
  • 什么是向量表示(Embeddings)
  • 向量数据库与向量检索
  • 基于向量检索的 RAG
  • 搭建 RAG 系统的扩展知识
  • 混合检索与 RAG-Fusion 简介
  • 向量模型本地部署

第三阶段(30天):模型训练

恭喜你,如果学到这里,你基本可以找到一份大模型 AI相关的工作,自己也能训练 GPT 了!通过微调,训练自己的垂直大模型,能独立训练开源多模态大模型,掌握更多技术方案。

到此为止,大概2个月的时间。你已经成为了一名“AI小子”。那么你还想往下探索吗?

  • 为什么要做 RAG
  • 什么是模型
  • 什么是模型训练
  • 求解器 & 损失函数简介
  • 小实验2:手写一个简单的神经网络并训练它
  • 什么是训练/预训练/微调/轻量化微调
  • Transformer结构简介
  • 轻量化微调
  • 实验数据集的构建

第四阶段(20天):商业闭环

对全球大模型从性能、吞吐量、成本等方面有一定的认知,可以在云端和本地等多种环境下部署大模型,找到适合自己的项目/创业方向,做一名被 AI 武装的产品经理。

  • 硬件选型
  • 带你了解全球大模型
  • 使用国产大模型服务
  • 搭建 OpenAI 代理
  • 热身:基于阿里云 PAI 部署 Stable Diffusion
  • 在本地计算机运行大模型
  • 大模型的私有化部署
  • 基于 vLLM 部署大模型
  • 案例:如何优雅地在阿里云私有部署开源大模型
  • 部署一套开源 LLM 项目
  • 内容安全
  • 互联网信息服务算法备案

学习是一个过程,只要学习就会有挑战。天道酬勤,你越努力,就会成为越优秀的自己。

如果你能在15天内完成所有的任务,那你堪称天才。然而,如果你能完成 60-70% 的内容,你就已经开始具备成为一名大模型 AI 的正确特征了。

这份完整版的大模型 AI 学习资料已经上传CSDN,朋友们如果需要可以微信扫描下方CSDN官方认证二维码免费领取【保证100%免费

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

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

相关文章

动物识别系统Python+卷积神经网络算法+TensorFlow+人工智能+图像识别+计算机毕业设计项目

一、介绍 动物识别系统。本项目以Python作为主要编程语言&#xff0c;并基于TensorFlow搭建ResNet50卷积神经网络算法模型&#xff0c;通过收集4种常见的动物图像数据集&#xff08;猫、狗、鸡、马&#xff09;然后进行模型训练&#xff0c;得到一个识别精度较高的模型文件&am…

Android ImageView支持每个角的不同半径

Android ImageView支持每个角的不同半径 import android.annotation.SuppressLint; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; import an…

css 控制虚线刻度尺寸

文章目录 css效果 css <div style"width: 100%; height: 1px;background-image: linear-gradient(to right, #545454 0%, #545454 80%, transparent 5%);background-size: 15px 10px;background-repeat: repeat-x; margin: 0 auto;"></div>效果

W外链如何实现长链接转短链接教程

要实现微信外链的长链接转短连接&#xff0c;可以借助专门的工具来简化流程并增加链接的安全性和稳定性。 以下是一个具体方案&#xff1a; 使用W外链工具 W外链是一款集成了多种功能的微信外链生成器&#xff0c;包括但不限于短链制作、活码生成、微信外链制作等。以下是使用…

设置PDF打开密码

为PDF文件设置打开密码是一种有效的保护措施&#xff0c;它能防止未经授权的用户访问文件内容。以下是一份专业指南&#xff0c;详细介绍如何为PDF文件设置打开密码。 打开pdf编辑器&#xff0c;我们点击工具栏中的【文件】功能&#xff0c;选择里面的【属性】 然后在属性设置…

英飞凌PSoC4000T的GPIO中断示例工程

关于PSoC4000T的初步介绍见:英飞凌MCU第五代高性能CAPSENSE技术PSoC4000T_psoc 4000t-CSDN博客 下面这个工程,在modustoolbox中可编译、下载到开发板、debug调试。 编译时会用到mtb_shared这个库: 已经pdl这个periperal driver library库:

SMS over IP原理

目录 1. 短消息业务的实现方式 2. 传统 CS 短消息业务中的发送与送达报告 3. MAP/CAP 信令常见消息 4. SMS over IP 特点概述 5. SMS over IP 中的主要流程 5.1 短消息注册流程(NR 或 LTE 接入) 5.2 短消息发送(MO)流程(NR 或 LTE 接入) 5.3 短消息接收(MT)流程(NR 或…

国际知名度最高的华人改名大师颜廷利:当代最牛的易经姓名学泰斗

国际知名度最高的华人改名大师颜廷利&#xff1a;当代最牛的易经姓名学泰斗 颜廷利教授&#xff0c;一位在姓名学领域享有盛誉的专家&#xff0c;其声誉根植于齐鲁大地&#xff0c;山东济南历城区唐王镇&#xff08;现升级为历城区唐王街道办事处&#xff09;。他的工作基地不仅…

YOLOv8改进系列,YOLOv8的Neck替换成AFPN(CVPR 2023)

摘要 多尺度特征在物体检测任务中对编码具有尺度变化的物体非常重要。多尺度特征提取的常见策略是采用经典的自上而下和自下而上的特征金字塔网络。然而,这些方法存在特征信息丢失或退化的问题,影响了非相邻层次的融合效果。一种渐进式特征金字塔网络(AFPN),以支持非相邻…

【Git原理与使用】版本管理与分支管理(1)

目录 一、基本操作 1、初识Git 2、Git安装[Linux-centos] 3、Git安装[ Linnx-ubuntu] 4、创建git本地仓库 5、配置Git 6、认识工作区、暂存区、版本库 7、添加文件 8、查看历史提交记录 9、查看.git文件目录结构 10、查看版本库对象的内容 11、小结&#xff08;在本地的.git仓库…

计算机毕业设计 服装生产管理系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

&#x1f34a;作者&#xff1a;计算机编程-吉哥 &#x1f34a;简介&#xff1a;专业从事JavaWeb程序开发&#xff0c;微信小程序开发&#xff0c;定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事&#xff0c;生活就是快乐的。 &#x1f34a;心愿&#xff1a;点…

什么是安全漏洞?最全的漏洞分类!

01 — “ 什么是漏洞**”** 漏洞是指一个系统存在的弱点或缺陷&#xff0c;系统对特定威胁攻击或危险事件的敏感性&#xff0c;或进行攻击的威胁作用的可能性。漏洞可能来自应用软件或操作系统设计时的缺陷或编码时产生的错误&#xff0c;也可能来自业务在交互处理过程中的设…

想要精益生产管理体系早落地,这些工作不能少!

精益生产管理体系是当代社会将企业管理的各种工具方法和理论、技术以及企业文化融为一体的产物。 推行精益生产管理体系时&#xff0c;企业一定要做好以下3个方面的工作&#xff1a; 1.改变观念&#xff0c;从管理层到员工层都必须深入的贯彻实施精益化生产的思想&#xff0c;…

【分享】“可恶”的运算放大器电容负载

他们说如果使用放大器驱动电容负载(图 1、CLOAD)&#xff0c;一个不错的经验是采用一个 50 或 100 欧的电阻器 (RISO) 将放大器与电容器隔开。这个附加电阻器可能会阻止运算放大器振荡。 图 1.支持电容负载的放大器可能需要在放大器输出与负载电容器之间连接一个电阻器。 使用…

Gitlab runner的使用示例(二):Maven + Docker 自动化构建与部署

Gitlab runner的使用示例&#xff08;二&#xff09;&#xff1a;Maven Docker 自动化构建与部署 在本篇文章中&#xff0c;我们将详细解析一个典型的 GitLab CI/CD 配置文件&#xff08;gitlab-ci.yml&#xff09;&#xff0c;该文件主要用于通过 Maven 构建 Java 应用&…

电脑明明切换到了中文输入法,却无法打字出汉字?

现象&#xff1a; 自己电脑桌面右下角的电脑输入法&#xff0c;已经是中文了 解决办法&#xff1a; 按一下键盘最左边的【Caps Lock】键&#xff0c; 电脑左上角会出现如下弹窗&#xff0c; 调整为&#xff1a;CAPS LOCK OFF 即可&#xff08;OFF时&#xff0c;才能打出汉字…

EW内网穿透详解!

EW EW又叫earthworm&#xff0c;是一套便捷式的网络穿透工具&#xff0c;具有socks5服务架构和端口转发两大核心功能&#xff0c;可以在复杂的网络环境下完成网络穿透。该工具能以"正向"&#xff0c;"反向"&#xff0c;"多级级联"等方式打通一条…

数据结构之线性表——LeetCode:67. 二进制求和,27. 移除元素,26. 删除有序数组中的重复项

67. 二进制求和 题目描述 67. 二进制求和 给你两个二进制字符串 a 和 b &#xff0c;以二进制字符串的形式返回它们的和。 运行代码&#xff08;javaC) class Solution {public String addBinary(String a, String b) {StringBuilder ansnew StringBuilder();int ca0;for(i…

数据库基础知识---------------------------(3)

MYSQL的索引 用于快速找出在某个列中有一特定值的行&#xff0c;不使用索引&#xff0c;MySQL必须从第一条记录开始读完整个表&#xff0c;直到找出相关的行。按实现方式分为Hash索引和BTree索引 单列索引 普通索引 允许在定义索引的列中插入重复值和空值唯一索引 索引列的值必…

凸多边形(Convex Polygon)

凸多边形是边为直边且不向内折叠的特殊形状。连接凸多边形角的所有线都位于形状内部。凸多边形的角始终指向外部。所有边和角都相等的正多边形始终是凸多边形。 如果封闭形状具有曲面&#xff0c;则它不是凸多边形。在几何学中&#xff0c;多边形是具有直边和直角的平面二维形状…