ConversationBuilder

org.llm4s.javaapi.ConversationBuilder
See theConversationBuilder companion object
final class ConversationBuilder

Builder for constructing a Conversation without using Scala case-class syntax or sequence literals.

Conversation conv = ConversationBuilder.create()
   .system("You are a helpful assistant.")
   .user("What is the capital of France?")
   .build();

Instances are immutable: every method returns a new builder, so a builder may be shared and forked across threads. A null content argument throws NullPointerException immediately.

Attributes

Companion
object
Source
ConversationBuilder.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Returns a new builder with a assistant message holding content appended; this builder is unchanged.

Returns a new builder with a assistant message holding content appended; this builder is unchanged.

Blank content is accepted here; it is reported later, as a ValidationError, when the message is validated (see AssistantMessage.validate).

Value parameters

content

the assistant message text; must not be null

Attributes

Returns

a new builder whose messages are this builder's followed by the new assistant message

Throws
NullPointerException

if content is null, with the message "assistant content must not be null"

Source
ConversationBuilder.scala

Returns a Conversation holding the messages added so far, in call order. Building does not change the builder, so it can still be extended or built again afterwards.

Returns a Conversation holding the messages added so far, in call order. Building does not change the builder, so it can still be extended or built again afterwards.

Attributes

Source
ConversationBuilder.scala

Returns a new builder with a system message holding content appended; this builder is unchanged.

Returns a new builder with a system message holding content appended; this builder is unchanged.

Blank content is accepted here; it is reported later, as a ValidationError, when the message is validated (see SystemMessage.validate).

Value parameters

content

the system message text; must not be null

Attributes

Returns

a new builder whose messages are this builder's followed by the new system message

Throws
NullPointerException

if content is null, with the message "system content must not be null"

Source
ConversationBuilder.scala

Returns a new builder with a user message holding content appended; this builder is unchanged.

Returns a new builder with a user message holding content appended; this builder is unchanged.

Blank content is accepted here; it is reported later, as a ValidationError, when the message is validated (see UserMessage.validate).

Value parameters

content

the user message text; must not be null

Attributes

Returns

a new builder whose messages are this builder's followed by the new user message

Throws
NullPointerException

if content is null, with the message "user content must not be null"

Source
ConversationBuilder.scala