Skip to content

Releases: devlive-community/openai-java-sdk

2024.01.3

17 May 00:24
db0061b
Compare
Choose a tag to compare
发布版本 发布时间
2024.01.3 2024-05-17

OpenAi


  • 支持新模型 gpt-4o

Google Gemini


  • 支持简单对话

    try (GoogleClient client = GoogleClient.builder()
        .apiKey(token)
        .build()) {
        PartEntity part = PartEntity.builder()
            .text("Hello, Open AI Java SDK!")
            .build();
        ObjectEntity object = ObjectEntity.builder()
            .parts(Lists.newArrayList(part))
            .build();
        ChatEntity chat = ChatEntity.builder()
            .contents(Lists.newArrayList(object))
            .build();
    
        ChatResponse response = client.createChatCompletions(chat);
        response.getCandidates()
            .forEach(item -> item.getContent()
                .getParts()
                .forEach(value -> log.info(value.getText())));
    }
  • 支持连续对话

    List<ObjectEntity> contents = Lists.newArrayList();
    PartEntity part = PartEntity.builder()
            .text("你好,我叫小明")
            .build();
    ObjectEntity object = ObjectEntity.builder()
            .parts(Lists.newArrayList(part))
            .build();
    contents.add(object);
    ChatEntity chat = ChatEntity.builder()
            .contents(contents)
            .build();
    ChatResponse response = client.createChatCompletions(chat);
    response.getCandidates()
            .forEach(item -> item.getContent()
                    .getParts()
                    .forEach(value -> {
                        log.info(value.getText());
    
                        contents.add(ObjectEntity.builder()
                                .role(RoleModel.MODEL)
                                .parts(Lists.newArrayList(PartEntity.builder()
                                        .text(value.getText())
                                        .build()))
                                .build());
                    }));
    
    ObjectEntity newObject = ObjectEntity.builder()
            .parts(Lists.newArrayList(PartEntity.builder()
                    .text("我刚刚说了什么")
                    .build()))
            .build();
    contents.add(newObject);
    ChatEntity newChat = ChatEntity.builder()
            .contents(contents)
            .build();
    client.createChatCompletions(newChat);
  • 支持流式响应

    // 构建客户端
    CountDownLatch countDownLatch = new CountDownLatch(1);
    ConsoleEventSourceListener listener = ConsoleEventSourceListener.builder()
            .countDownLatch(countDownLatch)
            .build();
    GoogleClient client = GoogleClient.builder()
            .apiKey(ResourceUtils.getValue("google.token"))
            .listener(listener)
            .build();
    
    List<ObjectEntity> contents = Lists.newArrayList();
    PartEntity part = PartEntity.builder()
            .text("帮我写一万字的作文")
            .build();
    ObjectEntity object = ObjectEntity.builder()
            .parts(Lists.newArrayList(part))
            .build();
            contents.add(object);
    ChatEntity chat = ChatEntity.builder()
            .contents(contents)
            .build();
    client.createChatCompletions(chat);
    try {
        countDownLatch.await();
    }
    catch (InterruptedException e) {
        log.error("Interrupted while waiting", e);
    }

2024.01.2

10 Mar 03:55
a990304
Compare
Choose a tag to compare
Release version Release Time
2024.01.2 2024-03-10

OpenAi


  • Create thread
  • Retrieve thread
  • Modify thread
  • Delete thread

2024.01.1

02 Mar 14:45
36c2891
Compare
Choose a tag to compare
Release version Release Time
2024.01.1 2024-03-02

OpenAi


  • Create assistant
  • Create assistant file
  • List assistants
  • List assistant files
  • Retrieve assistant
  • Retrieve assistant file
  • Modify assistant
  • Delete assistant
  • Delete assistant file

2023.12.1

23 Dec 06:04
2c8bc71
Compare
Choose a tag to compare
Release version Release Time
2023.12.1 2023-12-23

OpenAi


  • Create fine-tuning job
  • List fine-tuning jobs
  • List fine-tuning events
  • Retrieve fine-tuning job
  • Cancel fine-tuning

1.9.0

22 Aug 06:20
93cbd9b
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.8.0...1.9.0

1.8.0

15 Aug 12:22
928b50e
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.7.0...1.8.0

1.7.0

14 Aug 02:41
80db931
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.6.0...1.7.0

1.6.0

18 Jul 07:36
0d60f47
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.5.0...1.6.0

1.5.0

14 Jul 03:33
960d4a2
Compare
Choose a tag to compare

What's Changed

New Contributors

  • @mlboy made their first contribution in #19

Full Changelog: 1.4.0...1.5.0

1.4.0

11 Jul 03:16
6801f40
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.3.0...1.4.0