Skip to content

Repository files navigation

Guava SDK for Java and Kotlin (Preview)

CI Maven Central Version

Build Guava voice agents from Java or Kotlin. See the complete Java examples and Kotlin examples.

Installation

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>

Authentication

The SDK automatically uses credentials created by the Guava CLI:

guava login

Alternatively, provide an API key through the environment:

export GUAVA_API_KEY="your-api-key"

Quickstart

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.
}

Logging

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.

About

An SDK for building Guava voice agents using Java or Kotlin.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages