package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.operations.ChatResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
ChatResponse res = sdk.client().chat().create()
.chatRequest(ChatRequest.builder()
.messages(List.of(
ChatMessage.builder()
.fragments(List.of(
ChatMessageFragment.builder()
.text("What are the company holidays this year?")
.build()))
.build()))
.build())
.call();
if (res.chatResponse().isPresent()) {
// handle response
}
}
}
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.operations.ChatStreamResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
ChatStreamResponse res = sdk.client().chat().createStream()
.chatRequest(ChatRequest.builder()
.messages(List.of(
ChatMessage.builder()
.fragments(List.of(
ChatMessageFragment.builder()
.text("What are the company holidays this year?")
.build()))
.build()))
.build())
.call();
if (res.chatRequestStream().isPresent()) {
// handle response
}
}
}