spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/index.html
Apache License 2.0
2.9k stars 724 forks source link

Unable to read meta-data for class org.springframework.ai.autoconfigure.bedrock.llama2.BedrockLlama2AutoConfiguration #185

Closed StefanoDib closed 9 months ago

StefanoDib commented 9 months ago

Bug description I'm developing an application that interacts with ChatGPT 3.5 and I'm using this library. Since yesterday the project doesn't start anymore because of this error:

java.lang.IllegalStateException: Unable to read meta-data for class org.springframework.ai.autoconfigure.bedrock.llama2.BedrockLlama2AutoConfiguration

My project configuration didn't change since the last time it used to work.

Environment I'm using OpenAi 0.8.0-SNAPSHOT with Java SE 17.0.17. Rolling back to OpenAi 0.7.1-SNAPSHOT works fine.

The parent I am using is:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.0</version>
    <relativePath/>
</parent>

The dependencies are:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.skyscreamer</groupId>
                <artifactId>jsonassert</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>6.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20231013</version>
    </dependency>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.9.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>jakarta.annotation</groupId>
        <artifactId>jakarta.annotation-api</artifactId>
        <version>2.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.ai</groupId>
        <artifactId>spring-ai-openai-spring-boot-starter</artifactId>
        <version>0.8.0-SNAPSHOT</version>
    </dependency>
            <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
            <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
    </dependency>
</dependencies>

The problem occurs when i try to launch the project using both java -jar and mvn spring-boot:run.

Expected behavior The project starts properly.

DEG-7 commented 9 months ago

It seems to be an error with the aws bedrock implementation. The autoconfig metadata refers to BedrockLlama2AutoConfiguration but the correct classname is BedrockLlama2ChatAutoConfiguration FYI @markpollack @tzolov

tzolov commented 9 months ago

Hi @StefanoDib , thanks for testing and reporting this. I will check it shortly

tzolov commented 9 months ago

@DEG-7 Not sure what you mean? could you pass source reference?

tzolov commented 9 months ago

ah, got it. thanks @DEG-7 Indeed the Autoconfiguration.import has wrong definition. Apparently my IDE missed the name refactoring.

tzolov commented 9 months ago

@StefanoDib it should be resolved now. Let me know if other related issues pop-up.

StefanoDib commented 9 months ago

@StefanoDib it should be resolved now. Let me know if other related issues pop-up.

Sadly a new issue popped-up. When performing a mvn clean install, i received this error:

package org.springframework.ai.client does not exists.

Importing OpenAiClient from org.springframework.ai.openai.client, instead of AiClient, solves the problem, but i receive the same error on AiResponse which i can't find somewhere else. I want to clarify that rolling back to 0.7.1-SNAPSHOT still works fine. I hope that my bug reportings are helpful!

StefanoDib commented 9 months ago

@StefanoDib it should be resolved now. Let me know if other related issues pop-up.

Sadly a new issue popped-up. When performing a mvn clean install, i received this error:

package org.springframework.ai.client does not exists.

Importing OpenAiClient from org.springframework.ai.openai.client, instead of AiClient, solves the problem, but i receive the same error on AiResponse which i can't find somewhere else. I want to clarify that rolling back to 0.7.1-SNAPSHOT still works fine. I hope that my bug reportings are helpful!

I just noticed that AiClient and AiResponse were renamed to ChatClient and ChatResponse. I quickly changed the references and the projects works fine.