Lambdua / openai4j

Java client library for OpenAI API.Full support for all OpenAI API models including Completions, Chat, Edits, Embeddings, Audio, Files, Assistants-v2, Images, Moderations, Batch, and Fine-tuning.
MIT License
303 stars 25 forks source link

Handler dispatch failed: java.lang.NoClassDefFoundError: com/theokanning/openai/assistants/thread/ThreadRequest #46

Closed cikichen closed 3 months ago

cikichen commented 3 months ago
        OpenAiService service = getOpenAiService();
        ThreadRequest threadRequest = ThreadRequest.builder().build();
        Thread thread = service.createThread(threadRequest);
        return thread.getId();

springboot 3.1.0,jdk18

Lambdua commented 3 months ago

The version of openai4j you're using, and the detailed steps leading up to the issue, including any specific commands or code you executed.

cikichen commented 3 months ago

The version of openai4j you're using, and the detailed steps leading up to the issue, including any specific commands or code you executed.

0.21.2 service.createThread(threadRequest);

Lambdua commented 3 months ago

没有办法复现. 我自己使用jdk21 springboot3.3.0 也是可以使用的. 你可以检查依赖,是否正确引入.打包是否存在问题.

cikichen commented 3 months ago

没有办法复现. 我自己使用jdk21 springboot3.3.0 也是可以使用的. 你可以检查依赖,是否正确引入.打包是否存在问题.

之前theokanning的缓存导致的,但是现在还是和之前库一样报错You must provide the 'OpenAI-Beta' header to access the Assistants API. Please try again by setting the header 'OpenAI-Beta: assistants=v2'

Lambdua commented 3 months ago

还是你给的这个方法么?

    @Headers({"OpenAI-Beta: assistants=v2"})
    @POST("threads")
    Single<Thread> createThread(@Body ThreadRequest request);

代码中关于assistant v2的都加过头了.你在确认下呢

cikichen commented 3 months ago

还是你给的这个方法么?

    @Headers({"OpenAI-Beta: assistants=v2"})
    @POST("threads")
    Single<Thread> createThread(@Body ThreadRequest request);

代码中关于assistant v2的都加过头了.你在确认下呢

解决了