Spring AI ์‹œ์ž‘ํ•˜๊ธฐ

์›๋ฌธ: https://docs.spring.io/spring-ai/reference/getting-started.html


์ด ์„น์…˜์—์„œ๋Š” Spring AI ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์‹œ์ž‘์ ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

ํ•„์š”์— ๋”ฐ๋ผ ๋‹ค์Œ ์„น์…˜์˜ ๊ฐ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๋…ธํŠธ

Spring AI๋Š” Spring Boot 3.2.x ๋ฐ 3.3.x๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์Šคํ”„๋ง ์ดˆ๊ธฐํ™”

start.spring.io๋กœ ์ด๋™ํ•˜์—ฌ ์ƒˆ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์‚ฌ์šฉํ•  AI ๋ชจ๋ธ๊ณผ ๋ฒกํ„ฐ ์Šคํ† ์–ด๋ฅผ ์„ ํƒํ•˜์„ธ์š”.

๋งˆ์ผ์Šคํ†ค ๋ฐ ์Šค๋ƒ…์ƒท ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ถ”๊ฐ€ํ•˜๊ธฐ

์ข…์†์„ฑ ์Šค๋‹ˆํŽซ์„ ์ง์ ‘ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์„น์…˜์˜ ์ง€์นจ์„ ๋”ฐ๋ฅด์„ธ์š”.

๋งˆ์ผ์Šคํ†ค ๋ฐ ์Šค๋ƒ…์ƒท ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋นŒ๋“œ ํŒŒ์ผ์— Spring ๋งˆ์ผ์Šคํ†ค ๋ฐ/๋˜๋Š” ์Šค๋ƒ…์ƒท ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์— ๋Œ€ํ•œ ์ฐธ์กฐ๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Maven์˜ ๊ฒฝ์šฐ ํ•„์š”์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ •์˜๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:

<repositories>
	<repository>
		<id>spring-milestones</id>
		<name>Spring Milestones</name>
		<url>https://repo.spring.io/milestone</url>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</repository>
	<repository>
		<id>spring-snapshots</id>
		<name>Spring Snapshots</name>
		<url>https://repo.spring.io/snapshot</url>
		<releases>
			<enabled>false</enabled>
		</releases>
	</repository>
</repositories>

Gradle์˜ ๊ฒฝ์šฐ ํ•„์š”์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ •์˜๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:

repositories {
  mavenCentral()
  maven { url 'https://repo.spring.io/milestone' }
  maven { url 'https://repo.spring.io/snapshot' }
}

์ข…์†์„ฑ ๊ด€๋ฆฌ

Spring AI BOM(Bill of Materials)์€ Spring AI์˜ ํŠน์ • ๋ฆด๋ฆฌ์Šค์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๋ชจ๋“  ์ข…์†์„ฑ์˜ ๊ถŒ์žฅ ๋ฒ„์ „์„ ์„ ์–ธํ•ฉ๋‹ˆ๋‹ค. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋นŒ๋“œ ์Šคํฌ๋ฆฝํŠธ์—์„œ BOM์„ ์‚ฌ์šฉํ•˜๋ฉด ์ข…์†์„ฑ ๋ฒ„์ „์„ ์ง์ ‘ ์ง€์ •ํ•˜๊ณ  ์œ ์ง€ ๊ด€๋ฆฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ๋Œ€์‹  ์‚ฌ์šฉ ์ค‘์ธ BOM ๋ฒ„์ „์— ๋”ฐ๋ผ ์‚ฌ์šฉ๋˜๋Š” ์ข…์†์„ฑ ๋ฒ„์ „์ด ๊ฒฐ์ •๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ์žฌ์ •์˜ํ•˜์ง€ ์•Š๋Š” ํ•œ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ง€์›๋˜๊ณ  ํ…Œ์ŠคํŠธ๋œ ์ข…์†์„ฑ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๋„๋ก ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.

Maven ์‚ฌ์šฉ์ž๋ผ๋ฉด pom.xml ํŒŒ์ผ์— ๋‹ค์Œ์„ ์ถ”๊ฐ€ํ•˜์—ฌ BOM์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-bom</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Gradle ์‚ฌ์šฉ์ž๋Š” ๋˜ํ•œ Maven BOM์„ ์‚ฌ์šฉํ•˜์—ฌ ์ข…์†์„ฑ ์ œ์•ฝ ์กฐ๊ฑด์„ ์„ ์–ธํ•˜๊ธฐ ์œ„ํ•œ Gradle(5.0 ์ด์ƒ) ๊ธฐ๋ณธ ์ง€์›์„ ํ™œ์šฉํ•˜์—ฌ Spring AI BOM์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” Gradle ๋นŒ๋“œ ์Šคํฌ๋ฆฝํŠธ์˜ ์ข…์†์„ฑ ์„น์…˜์— 'ํ”Œ๋žซํผ' ์ข…์†์„ฑ ํ•ธ๋“ค๋Ÿฌ ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ์Šค๋‹ˆํŽซ์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋“ฏ์ด, ๊ทธ ๋‹ค์Œ์—๋Š” ์‚ฌ์šฉํ•˜๋ ค๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ spring-ai ๋ชจ๋“ˆ์— ๋Œ€ํ•œ ์Šคํƒ€ํ„ฐ ์ข…์†์„ฑ์„ ๋ฒ„์ „ ์—†์ด ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(์˜ˆ: spring-ai-openai).

dependencies {
  implementation platform("org.springframework.ai:spring-ai-bom:1.0.0-SNAPSHOT")
  // Replace the following with the starter dependencies of specific modules you wish to use
  implementation 'org.springframework.ai:spring-ai-openai'
}

ํŠน์ • ์ปดํฌ๋„ŒํŠธ์— ๋Œ€ํ•œ ์ข…์†์„ฑ ์ถ”๊ฐ€

๋ฌธ์„œ์˜ ๋‹ค์Œ ๊ฐ ์„น์…˜์€ ํ”„๋กœ์ ํŠธ ๋นŒ๋“œ ์‹œ์Šคํ…œ์— ์ถ”๊ฐ€ํ•ด์•ผ ํ•˜๋Š” ์ข…์†์„ฑ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

์ƒ˜ํ”Œ ํ”„๋กœ์ ํŠธ

GitHub์—์„œ ์ด๋Ÿฌํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ๋ณต์ œํ•˜์—ฌ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•ญ๊ณตํŽธ ์˜ˆ์•ฝ ๋„์šฐ๋ฏธ

github.com/tzolov/playground-flight-booking

์ด์šฉ์•ฝ๊ด€(๊ฒ€์ƒ‰ ์ฆ๊ฐ• ์ƒ์„ฑ, RAG)์— ์•ก์„ธ์Šคํ•˜๊ณ , ์ž‘์—…(ํ•จ์ˆ˜ ํ˜ธ์ถœ)์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ๋„๊ตฌ(Java ๋ฉ”์„œ๋“œ)์— ์•ก์„ธ์Šคํ•˜๋ฉฐ, LLM์„ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์™€ ์ƒํ˜ธ ์ž‘์šฉํ•˜๋Š” AI ๊ธฐ๋ฐ˜ ์‹œ์Šคํ…œ

OpenAI

Azure OpenAI