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

[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")

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

相关文章:

  • 小米路由器AX1800降级后的SSH登录和关墙等命令
  • SpringBoot项目连接linux服务器数据库两种解决方法(linux直接开放端口访问本机通过SSH协议访问,以mysql为例)
  • Git 的基本概念和使用方式以及常见错误的处理方法
  • 【华为OD机试高分必刷题目】决战(JavaPythonC++动态规划DP实现)
  • golang学习笔记——接口interfaces
  • 夺走的第一份工作竟是OpenAI CEO?
  • FPGA设计时序约束八、others类约束之Set_Case_Analysis
  • 坐标系下的运动旋量转换
  • SystemVerilog学习 (7)——面向对象编程
  • PMCW体制雷达系列文章(4) – PMCW雷达之抗干扰
  • transform学习资料
  • 认识Tomcat
  • 【前端开发】JS Vue React中的通用递归函数
  • 机器学习第5天:多项式回归与学习曲线
  • 基于一致性算法的微电网分布式控制MATLAB仿真模型
  • hexo+github搭建个人博客
  • CNN 在图像分割中的简史:从 R-CNN 到 Mask R-CNN
  • CSS实用技巧干货
  • Docker下部署自己的LNMP工作环境
  • ES2017异步函数现已正式可用
  • JAVA SE 6 GC调优笔记
  • js ES6 求数组的交集,并集,还有差集
  • Redux系列x:源码分析
  • 分布式熔断降级平台aegis
  • 关于Java中分层中遇到的一些问题
  • 基于 Babel 的 npm 包最小化设置
  • 区块链技术特点之去中心化特性
  • 少走弯路,给Java 1~5 年程序员的建议
  • 怎样选择前端框架
  • 3月27日云栖精选夜读 | 从 “城市大脑”实践,瞭望未来城市源起 ...
  • Spring第一个helloWorld
  • 国内唯一,阿里云入选全球区块链云服务报告,领先AWS、Google ...
  • 教程:使用iPhone相机和openCV来完成3D重建(第一部分) ...
  • 小白应该如何快速入门阿里云服务器,新手使用ECS的方法 ...
  • ​HTTP与HTTPS:网络通信的安全卫士
  • ​LeetCode解法汇总307. 区域和检索 - 数组可修改
  • #stm32整理(一)flash读写
  • #我与Java虚拟机的故事#连载18:JAVA成长之路
  • ()、[]、{}、(())、[[]]命令替换
  • (06)金属布线——为半导体注入生命的连接
  • (8)Linux使用C语言读取proc/stat等cpu使用数据
  • (9)STL算法之逆转旋转
  • (C语言)输入一个序列,判断是否为奇偶交叉数
  • (env: Windows,mp,1.06.2308310; lib: 3.2.4) uniapp微信小程序
  • (附源码)基于SpringBoot和Vue的厨到家服务平台的设计与实现 毕业设计 063133
  • (强烈推荐)移动端音视频从零到上手(下)
  • (转)jQuery 基础
  • (转)Linux整合apache和tomcat构建Web服务器
  • .cfg\.dat\.mak(持续补充)
  • .helper勒索病毒的最新威胁:如何恢复您的数据?
  • .net core 6 集成 elasticsearch 并 使用分词器
  • .NET/C# 如何获取当前进程的 CPU 和内存占用?如何获取全局 CPU 和内存占用?
  • .net使用excel的cells对象没有value方法——学习.net的Excel工作表问题
  • .NET性能优化(文摘)
  • .xml 下拉列表_RecyclerView嵌套recyclerview实现二级下拉列表,包含自定义IOS对话框...