Build Guava voice agents from Java or Kotlin. See the complete Java examples and Kotlin examples.
The SDK supports Java 8 and newer. Add the SDK artifact from Maven Central.
Gradle (Kotlin DSL):
dependencies {
implementation("ai.goguava:guava-sdk:0.2.0")
}Maven:
<dependency>
<groupId>ai.goguava</groupId>
<artifactId>guava-sdk</artifactId>
<version>0.2.0</version>
</dependency>The SDK automatically uses credentials created by the Guava CLI:
guava loginAlternatively, provide an API key through the environment:
export GUAVA_API_KEY="your-api-key"Java:
import ai.goguava.Agent;
import ai.goguava.helpers.DocumentQA;
public final class Main {
public static void main(String[] args) {
DocumentQA documents = DocumentQA.builder()
.document("Returns are accepted within 30 days with a receipt.")
.namespace("quickstart")
.build();
new Agent()
.organization("Acme Support")
.purpose("Answer customer questions.")
.onQuestion((call, question) -> documents.ask(question))
.listenPhone("+15555555555"); // Replace with your Guava phone number.
}
}Kotlin:
import ai.goguava.Agent
import ai.goguava.helpers.DocumentQA
fun main() {
val documents = DocumentQA(
document = "Returns are accepted within 30 days with a receipt.",
namespace = "quickstart",
)
Agent(
organization = "Acme Support",
purpose = "Answer customer questions.",
).onQuestion { _, question ->
documents.ask(question)
}.listenPhone("+15555555555") // Replace with your Guava phone number.
}The SDK logs through SLF4J. If you haven't already configured an SLF4J backend in your application, we recommend using logback.
Gradle (Kotlin DSL):
dependencies {
runtimeOnly("ch.qos.logback:logback-classic:1.5.18")
}Maven:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.18</version>
<scope>runtime</scope>
</dependency>Check out examples/src/main/resources/logback.xml for an example logging configuration.