Package dyntabs.ai

Class Conversation

java.lang.Object
dyntabs.ai.Conversation

public class Conversation extends Object
A simple chat conversation with an AI model.

A Conversation wraps a language model and provides a single send(String) method. If memory is enabled, the AI remembers previous messages in the conversation.

Always create via EasyAI.chat(), never directly.

Use Case 1: One-Shot Question (No Memory)


 Conversation chat = EasyAI.chat().build();
 String answer = chat.send("What is the capital of France?");
 // answer: "The capital of France is Paris."
 

Use Case 2: Multi-Turn Conversation (With Memory)


 Conversation chat = EasyAI.chat()
     .withMemory(20)   // remember last 20 messages
     .build();

 chat.send("My name is John");
 String answer = chat.send("What is my name?");
 // answer: "Your name is John." (AI remembers!)
 

Use Case 3: Chat With a Personality


 Conversation chat = EasyAI.chat()
     .withMemory(20)
     .withSystemMessage("You are a pirate. Always respond in pirate speak.")
     .build();

 String answer = chat.send("How are you?");
 // answer: "Arrr, I be doin' fine, matey!"
 
See Also:
  • Method Details

    • send

      public String send(String message)
      Sends a message to the AI and returns its response.

      If memory was enabled via withMemory(), the AI will remember all previous messages in this conversation. Otherwise, each call is independent.

      Parameters:
      message - the user's message (plain text)
      Returns:
      the AI's response as a String