interfAIce
1.0.1
インターフェースを紹介する私のブログ投稿をチェックしてください。
プロジェクトのbuild.gradle.kts
ファイルに以下を追加します。
dependencies {
implementation( " io.github.mscheong01:interfAIce-core:1.0.0 " )
}
// This option is currently required for reflection to work
// Later releases will remove this requirement for Kotlin projects
tasks.withType< KotlinCompile > {
this .kotlinOptions {
freeCompilerArgs = listOf ( " -Xjsr305=strict " )
javaParameters = true
}
}
dependencies {
implementation( " io.github.mscheong01:interfAIce-core:1.0.0 " )
}
// This option is currently required for reflection to work
// If all your classes have a no-arg constructor, you can remove this option
tasks.withType< JavaCompile > {
options.compilerArgs.add( " -parameters " )
}
dependencies {
implementation( " io.github.mscheong01:interfAIce-spring-boot-starter:1.0.0 " )
}
@EnableInterfaiceProxies
アノテーションを Spring Boot アプリケーション クラスまたはその構成クラスのいずれかに追加します@EnableInterfaiceProxies(
basePackages = [ " io.github.mscheong01.interfaice.examples " ]
)
@SpringBootApplication
open class ExampleApplication
application.yml
ファイルに OpenAi API キーを指定します spring :
interfaice :
openai :
api-key : ${OPENAI_API_KEY}
chat :
default-model : gpt-3.5-turbo # optional, defaults to gpt-3.5-turbo
@OpenAiInterface
アノテーションをインターフェースに追加します@OpenAiInterface
interface ExampleInterface {
fun greet ( name : String ): String
}
@RestController
class ExampleController (
private val exampleInterface : ExampleInterface
) {
@GetMapping( " /greet " )
fun greet (@RequestParam name : String ): String {
return exampleInterface.greet(name)
}
}
interfAIce は、変更がメイン ブランチにプッシュされると自動的にリリースされるスナップショット バージョンを提供します。現在のスナップショット バージョンは、現在のリリース バージョンの次のマイナー バージョンで、接尾辞 -SNAPSHOT が付いています。たとえば、現在のリリースが 1.2.3 の場合、スナップショットのバージョンは 1.3.0-SNAPSHOT になります。
スナップショット バージョンを使用するには、Maven スナップショット リポジトリをビルド構成に追加します。
repositories {
maven {
url = uri( " https://s01.oss.sonatype.org/content/repositories/snapshots/ " )
}
}
貢献は大歓迎です!詳細については、投稿ガイドラインをご覧ください。
このプロジェクトは、Apache 2.0 ライセンスに基づいてライセンスされています。