Schauen Sie sich meinen Blog-Beitrag an, der interfAIce vorstellt
Fügen Sie in der Datei build.gradle.kts
Ihres Projekts Folgendes hinzu:
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
zu Ihrer Spring-Boot-Anwendungsklasse oder einer ihrer Konfigurationsklassen hinzu @EnableInterfaiceProxies(
basePackages = [ " io.github.mscheong01.interfaice.examples " ]
)
@SpringBootApplication
open class ExampleApplication
application.yml
an spring :
interfaice :
openai :
api-key : ${OPENAI_API_KEY}
chat :
default-model : gpt-3.5-turbo # optional, defaults to gpt-3.5-turbo
@OpenAiInterface
zu Ihrer Schnittstelle hinzu @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 stellt Snapshot-Versionen bereit, die automatisch freigegeben werden, wenn Änderungen an den Hauptzweig übertragen werden. Die aktuelle Snapshot-Version ist die nächste Nebenversion der aktuellen Release-Version mit dem Suffix -SNAPSHOT. Wenn die aktuelle Version beispielsweise 1.2.3 ist, lautet die Snapshot-Version 1.3.0-SNAPSHOT.
Um Snapshot-Versionen zu verwenden, fügen Sie das Maven-Snapshot-Repository zu Ihrer Build-Konfiguration hinzu
repositories {
maven {
url = uri( " https://s01.oss.sonatype.org/content/repositories/snapshots/ " )
}
}
Beiträge sind willkommen! Weitere Informationen finden Sie in unseren Beitragsrichtlinien.
Dieses Projekt ist unter der Apache 2.0-Lizenz lizenziert.