LLM4STemplate

org.llm4s.spring.LLM4STemplate
final class LLM4STemplate(client: JLlmClient, executor: ExecutorService)

Spring-friendly entry point to an LLM.

complete and tryComplete block the calling thread. completeAsync never does: it is JLlmClient.completeAsync with the call on executor (the llm4sTaskExecutor bean), and the returned future completes from there. Cancelling the future with cancel(true) interrupts the provider call, which is how llm4s cancels work; a failure completes the future exceptionally with the LlmException, and so does an executor that refuses the call (its RejectedExecutionException the cause).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def complete(query: String): String
def complete(conversation: Conversation): String
def complete(conversation: Conversation, options: CompletionOptions): String
def completeAsync(query: String): CompletableFuture[String]
def completeAsync(conversation: Conversation): CompletableFuture[String]
def tryComplete(query: String): LlmResult[String]
def tryComplete(conversation: Conversation): LlmResult[String]