interfAIce
1.0.1
check out my blog post that introduces interfAIce
In your project's build.gradle.kts
file, add the following:
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
annotation to your spring boot application class or any of its configuration classes@EnableInterfaiceProxies(
basePackages = ["io.github.mscheong01.interfaice.examples"]
)
@SpringBootApplication
open class ExampleApplication
application.yml
filespring:
interfaice:
openai:
api-key: ${OPENAI_API_KEY}
chat:
default-model: gpt-3.5-turbo # optional, defaults to gpt-3.5-turbo
@OpenAiInterface
annotation to your interface@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 provides snapshot versions that are automatically released when changes are pushed to the main branch. The current snapshot version is the next minor version of the current release version with a -SNAPSHOT suffix. For example, if the current release is 1.2.3, the snapshot version will be 1.3.0-SNAPSHOT.
To use snapshot versions, add the maven snapshot repository to your build configuration
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
Contributions are welcome! Please see our contributing guidelines for more information.
This project is licensed under the Apache 2.0 License.