JLlmClient

org.llm4s.javaapi.JLlmClient
final class JLlmClient extends AutoCloseable

Java-friendly wrapper around LLMClient.

The underlying Scala client returns Result[Completion]; this wrapper unwraps the content string and surfaces it as LlmResult so Java callers never import any Scala types.

Obtain instances via Llm4s.createDefaultClient or Llm4s.createClient.

LlmResult<String> r = client.complete("What is 2+2?");
r.ifSuccess(System.out::println).ifFailure(e -> System.err.println(e.getMessage()));

Attributes

Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def close(): Unit

Attributes

Definition Classes
AutoCloseable
def complete(query: String): LlmResult[String]

Sends a single user query and returns the assistant's text response. A null query yields a failed LlmResult, never an exception.

Sends a single user query and returns the assistant's text response. A null query yields a failed LlmResult, never an exception.

Attributes

def complete(conversation: Conversation): LlmResult[String]

Sends a pre-built conversation and returns the assistant's text response.

Sends a pre-built conversation and returns the assistant's text response.

Attributes

def complete(conversation: Conversation, options: CompletionOptions): LlmResult[String]

Full access: send a conversation with explicit CompletionOptions, returning the raw text content.

Full access: send a conversation with explicit CompletionOptions, returning the raw text content.

Attributes