본문 바로가기

스프링

spring AI gradle 의존성 추가 방법

1.레포지토리 추가

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }//ai 디펜던시 조회장소 추가
}

 

maven { url 'https://repo.spring.io/milestone' }  만 추가(mavenCentral()은 원래있을거임)

2.버전변수추가(안하고 그냥 바로 적어도되긴함

ext {
    set('springAiVersion', "1.0.0-M1")//밑에서 사용할 버전 변수
}

추가

3.bom추가

dependencyManagement {
    imports {
        mavenBom "org.springframework.ai:spring-ai-bom:${springAiVersion}"
    }
}

통째로 추가하면됨(이미 dependencyManagement가 있으면 거기 넣고)

 

4.의존성추가

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'com.mysql:mysql-connector-j'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
    //ai
    implementation 'org.springframework.ai:spring-ai-openai-spring-boot-starter' //이거 추가
}

implementation 'org.springframework.ai:spring-ai-openai-spring-boot-starter' 추가(이건 openAi꺼,각 벤더별로 다르게 추가하면됨)

밴더별 이름은

https://docs.spring.io/spring-ai/reference/api/chat/openai-chat.html

 

OpenAI Chat :: Spring AI Reference

Multimodality refers to a model’s ability to simultaneously understand and process information from various sources, including text, images, audio, and other data formats. Presently, the OpenAI gpt-4o and gpt-4o-mini models offers multimodal support. Ref

docs.spring.io

왼쪽의 회사별 목록 들어가서 보면됨