interfAIce
1.0.1
lihat posting blog saya yang memperkenalkan antarmuka
Di file build.gradle.kts
proyek Anda, tambahkan yang berikut:
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
ke kelas aplikasi booting pegas Anda atau kelas konfigurasinya @EnableInterfaiceProxies(
basePackages = [ " io.github.mscheong01.interfaice.examples " ]
)
@SpringBootApplication
open class ExampleApplication
application.yml
spring :
interfaice :
openai :
api-key : ${OPENAI_API_KEY}
chat :
default-model : gpt-3.5-turbo # optional, defaults to gpt-3.5-turbo
@OpenAiInterface
ke antarmuka Anda @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 menyediakan versi snapshot yang secara otomatis dirilis ketika perubahan didorong ke cabang utama. Versi snapshot saat ini adalah versi minor berikutnya dari versi rilis saat ini dengan akhiran -SNAPSHOT. Misalnya, jika rilis saat ini adalah 1.2.3, versi snapshotnya adalah 1.3.0-SNAPSHOT.
Untuk menggunakan versi snapshot, tambahkan repositori snapshot maven ke konfigurasi build Anda
repositories {
maven {
url = uri( " https://s01.oss.sonatype.org/content/repositories/snapshots/ " )
}
}
Kontribusi dipersilahkan! Silakan lihat pedoman kontribusi kami untuk informasi lebih lanjut.
Proyek ini dilisensikan di bawah Lisensi Apache 2.0.