likes
comments
collection
share

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

作者站长头像
站长
· 阅读数 21

原文:赵侠客

前言

sora的热点还没有褪去,这两天又大火了Clude3,有的说超越GPT-4,还有的说有意识了,连马斯克都说人类也是文件也。我们这些吃瓜群众看着AI每隔几天一个热点,心理素质差的人有可能越来越焦虑。回头看看这几年大火的东西,像区块链、元宇宙、WEB3哪个当年是不号称要改变世界,如今他们都怎么样你们都知道。读万卷书不如行万里路,看这些AI热点还不如亲自使用一下,为了避免AI焦虑我还是趁热打铁,先开箱使用一下Claude3,看看在代码生成方面和ChatGPT哪个强。

问题一:Nacos配置修改,代码中如何自动刷新

ChatGPT

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

Claude 3

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距 最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

对比

从回答来看Claude3确实完爆ChatGPT,不仅给出了配置代码还给出了调用代码,ChatGPT的回答就显的太简单了。

问题二:帮我使用CompletableFuture将100个URL并发下载到本地/usr/pic目录下

ChatGPT

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距 最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

Claude 3

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距 最强AI Claude 3有意识了?四个问题看出和ChatGPT差距 最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

对比

从这段下载代码来看Claude3也强于ChatGPT,ChatGPT的DownloadFromUrl省略了,Claude3代码完整还给出了解释。

问题三:然后用JAVA多线程将/usr/pic下载所有目录及其子目录中的文件打包成zip文件

ChatGPT

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

import java.io.*;
import java.util.concurrent.*;
import java.util.zip.*;

public class ZipCreator {
    public static void main(String[] args) {
        String sourceDir = "/usr/pic"; // 源目录
        String zipFile = "/usr/pic.zip"; // 目标zip文件
        // 使用线程池创建多线程
        ExecutorService executor = Executors.newFixedThreadPool(5);
        try {
            // 创建ZipOutputStream用于写入zip文件
            FileOutputStream fos = new FileOutputStream(zipFile);
            ZipOutputStream zos = new ZipOutputStream(fos);
            // 遍历指定目录及其子目录中的文件
            traverseAndZip(sourceDir, sourceDir, zos, executor);
            // 关闭ZipOutputStream
            zos.close();
            System.out.println("Zip file created successfully: " + zipFile);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭线程池
            executor.shutdown();
        }
    }

    private static void traverseAndZip(String rootDir, String currentDir, ZipOutputStream zos, ExecutorService executor) {
        File dir = new File(currentDir);
        File[] files = dir.listFiles();
        if (files != null) {
            for (File file : files) {
                if (file.isDirectory()) {
                    // 如果是目录,则递归遍历
                    traverseAndZip(rootDir, file.getAbsolutePath(), zos, executor);
                } else {
                    // 如果是文件,则提交一个任务给线程池来进行压缩
                    executor.submit(() -> {
                        try {
                            String entryName = file.getAbsolutePath().substring(rootDir.length() + 1);
                            ZipEntry zipEntry = new ZipEntry(entryName);
                            zos.putNextEntry(zipEntry);
                            FileInputStream fis = new FileInputStream(file);
                            byte[] buffer = new byte[1024];
                            int length;
                            while ((length = fis.read(buffer)) > 0) {
                                zos.write(buffer, 0, length);
                            }
                            fis.close();
                            zos.closeEntry();
                            System.out.println("File added to zip: " + file.getAbsolutePath());
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    });
                }
            }
        }
    }
}

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

Claude 3

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Phaser;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class ZipFileCreator {
    private static final String SOURCE_DIR = "/usr/pic";
    private static final String ZIP_FILE = "/usr/pic.zip";
    private static final int THREAD_COUNT = 4;

    public static void main(String[] args) throws IOException {
        Path sourcePath = Paths.get(SOURCE_DIR);
        Path zipPath = Paths.get(ZIP_FILE);

        try (ZipOutputStream zipOutputStream = new ZipOutputStream(Files.newOutputStream(zipPath))) {
            Phaser phaser = new Phaser(1);
            ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT);

            Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
                    phaser.register();
                    executorService.submit(() -> {
                        try {
                            zipDirectory(dir, sourcePath, zipOutputStream);
                        } finally {
                            phaser.arriveAndDeregister();
                        }
                    });
                    return FileVisitResult.CONTINUE;
                }
            });

            phaser.arriveAndAwaitAdvance();
            executorService.shutdown();
        }

        System.out.println("ZIP file created: " + ZIP_FILE);
    }

    private static void zipDirectory(Path dir, Path sourcePath, ZipOutputStream zipOutputStream) {
        try {
            Files.walk(dir)
                    .filter(path -> !Files.isDirectory(path))
                    .forEach(path -> {
                        try {
                            ZipEntry zipEntry = new ZipEntry(sourcePath.relativize(path).toString());
                            zipOutputStream.putNextEntry(zipEntry);
                            Files.copy(path, zipOutputStream);
                            zipOutputStream.closeEntry();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

对比

从这个多线程压缩代码来看,ChatGPT用的方法比较传统,Claude3用的相对更新,更先进。

问题四:数据处理

帮我将下列数据数据和中文按顺序分别提取出来,用/分隔
输入:
72#大公司/73#项目部/84#实施团队
输出:
72/73/84 ,大公司/项目部/实施团队

需求处理的数据:
72#大公司/73#项目部/84#实施团队
72#大公司/73#项目部/82#开发测试组织

ChatGPT

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

Claude 3

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

最强AI Claude 3有意识了?四个问题看出和ChatGPT差距

对比

从这个数据处理来看Claude3还是强于ChatGPT

总结

从四道代码问题来看Claude 3确实蛮强的,代码生成可以说超过了ChatGPT,其它领域有没有超过ChatGPT还需要继续测试,至于有没有意识,这个不知道怎么测试,有人知道怎么测试吗?可以交流一下