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 許可證獲得許可。