[AI]ChatGPT4 与 ChatGPT3.5 区别有多大

ChatGPT 3.5 注册已经不需要手机了,直接邮箱认证就可以,这可真算是好消息,坏消息是 ChatGPT 4 还是要收费。 那么 GPT-3.5 与 GPT-4 区别有多大呢,下面简单测试一下。

以从 TDengine 订阅数据为例,TDengine 算是不太小众的数据库,如果连这个都能搞定,说明GPT 还是蛮厉害的。

目录

    • GPT-3.5 给出的代码
    • GPT-4 给出的代码
    • 官方示例代码

GPT-3.5 给出的代码

这个我是直接从OpenAI 获取的答案
在这里插入图片描述

from taospy import Client# 连接到 TDengine 服务器
conn = Client(host='your_tdengine_server_ip', user='your_username', password='your_password', database='your_database')# 订阅数据回调函数
def callback(data):print(f'Received data: {data}')# 订阅数据
with conn.subscribe('your_table_name', callback):# 在此处可以执行其他任务,让订阅保持活跃input('Press Enter to stop the subscription...\n')# 关闭连接
conn.close()

GPT-4 给出的代码

这是从DevChat 简介获取的答案
在这里插入图片描述

import taos
import time# 创建订阅对象
def create_subscribe(conn):sql = 'select * from test.meters interval(1s)'print("sql: ", sql)sub = conn.subscribe(sql, restart=False)print("sub name:", sub.name())print("create sub res:", sub.result())return sub# 获取订阅对象的值
def get_subscribe_value(sub):while True:print("blocked get result.")sub.consume()print("result: ", sub.result.current)time.sleep(1)# 删除订阅对象
def unsub(sub):print("unsub")sub.unsubscribe()try:conn = taos.connect(host="TDengine的地址", user="root", password="taosdata", database="test", charset="UTF8")sub = create_subscribe(conn)time.sleep(2)get_subscribe_value(sub)time.sleep(2)unsub(sub)print("End of program!")
except Exception as e:print(e)

官方示例代码

地址如下: python/#数据订阅

from taos.tmq import Consumer
import taosdef init_tmq_env(db, topic):conn = taos.connect()conn.execute("drop topic if exists {}".format(topic))conn.execute("drop database if exists {}".format(db))conn.execute("create database if not exists {} wal_retention_period 3600".format(db))conn.select_db(db)conn.execute("create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')")conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')")conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')")conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic))conn.execute("insert into tb1 values (now, 1, 1.0, 'tmq test')")conn.execute("insert into tb2 values (now, 2, 2.0, 'tmq test')")conn.execute("insert into tb3 values (now, 3, 3.0, 'tmq test')")def cleanup(db, topic):conn = taos.connect()conn.execute("drop topic if exists {}".format(topic))conn.execute("drop database if exists {}".format(db))if __name__ == '__main__':init_tmq_env("tmq_test", "tmq_test_topic")  # init envconsumer = Consumer({"group.id": "tg2","td.connect.user": "root","td.connect.pass": "taosdata","enable.auto.commit": "true",})consumer.subscribe(["tmq_test_topic"])try:while True:res = consumer.poll(1)if not res:breakerr = res.error()if err is not None:raise errval = res.value()for block in val:print(block.fetchall())finally:consumer.unsubscribe()consumer.close()cleanup("tmq_test", "tmq_test_topic")

区别有多大呢? 用图片说话
在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SDUT OJ《算法分析与设计》贪心算法

A - 汽车加油问题 Description 一辆汽车加满油后可行驶n公里。旅途中有若干个加油站。设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少。并证明算法能产生一个最优解。 对于给定的n和k个加油站位置,计算最少加油次数。 I…

OpenHarmony源码下载

OpenHarmony源码下载 现在的 OpenHarmony 4.0 源码已经有了,在 https://gitee.com/openharmony 地址中,描述了源码获取的方式,但那是基于 ubuntu 或者说是 Linux 的下载方式。在 windows 平台下的下载方式没有做出介绍。 我自己尝试了 wind…

Shell判断:流程控制—if(三)

一、调试脚本 1、调试脚本的其他方法: [rootlocalhost ~] # sh -n useradd.sh 仅调试脚本中的语法错误。 [rootlocalhost ~]# sh -vx useradd.sh 以调试的方式执行,查询整个执行过程。 2、示例: [rootlocalhost ~]# sh -n useradd.sh #调…

Git精讲

Git基本操作 创建Git本地仓库 git initgit clone 配置Git git config [--global] user.name "Your Name" git config [--global] user.email "emailexample.com"–global是一个可选项。如果使用了该选项,表示这台机器上所有的Git仓库都会使…

【giszz笔记】产品设计标准流程【4】

(续上回) 我们继续把扩展考虑UX环节的产品打造标准流程,来进行梳理。 一千个人心中有一千个哈姆雷特,本文将日常大家耳熟能详,但是又未必人人心中成体系的产品打造标准流程,进行总结。 考虑了两种项目&a…

【Linux系统化学习】进程的状态 | 僵尸进程 | 孤儿进程

个人主页点击直达:小白不是程序媛 Linux专栏:Linux系统化学习 目录 操作系统进程的状态 运行状态 阻塞状态 进程阻塞的现象 挂起阻塞状态 Linux进程状态 Linux内核源代码怎么说 R(running状态)运行状态 S(sl…

Tomcat无法映射到activiti-app导致activiti无法启动页面

原因之一:JDK版本与Tomcat版本不匹配,jdk8 yyds 我使用的是JDK11,Tomcat是9.0的,都是最新的,但还是不行,最后JDK改为8,tomcat的cmd后台没有报错,activiti-pp也可以正常访问了,很神奇…

FPGA设计时序约束八、others类约束之Set_Case_Analysis

目录 一、序言 二、Set Case Analysis 2.1 基本概念 2.2 设置界面 2.3 命令语法 2.4 命令示例 三、工程示例 四、参考资料 一、序言 在Vivado的时序约束窗口中,存在一类特殊的约束,划分在others目录下,可用于设置忽略或修改默认的时序…

算法通关村——数字中的统计、溢出、进制转换处理模板

数字与数学基础问题 1、数字统计 1.1、符号统计 LeetCode1822. 给定一个数组,求所有元素的乘积的符号,如果最终答案是负的返回-1,如果最终答案是正的返回1,如果答案是0返回0. 这题其实只用看数组中0和负数的个数就好了&#x…

SDUT OJ《算法分析与设计》搜索算法

A - 子集和问题 Description 子集和问题的一个实例为〈S,t〉。其中,S{ x1 , x2 ,…,xn }是一个正整数的集合,c是一个正整数。子集和问题判定是否存在S的一个子集S1,使得: 。 试设计一个解子…

SpringBoot项目连接linux服务器数据库两种解决方法(linux直接开放端口访问本机通过SSH协议访问,以mysql为例)

最近找个springboot脚手架重新熟悉一下springboot相关框架的东西,结果发现好像项目还不能直接像数据库GUI工具一样填几个SSH参数就可以了,于是就给他再整一下看看如何解决 linux开放3306(可修改)端口直接访问 此方法较为方便&am…

PMCW体制雷达系列文章(4) – PMCW雷达之抗干扰

说明 本文作为PMCW体制雷达系列文章之一,主要聊聊FMCW&PMCW两种体制雷达的干扰问题。事实上不管是通信领域还是雷达领域,对于一切以电磁波作为媒介的信息传递活动,干扰是无处不在的。近年来,随着雷达装车率的提高,…