Add a new abstraction to simplify implementation of common ChatBot use cases

* Add ChatBot and basic DefaultChatBot
* Add streaming ChatBot support.
* Add Evaluator interface and RelevancyEvaluator implementation
* Add Content data type abstraction for Document and Message
* Renaming and package refactoring
* update .gitignore to allow node package name
* Add List<Media> to node and move ai.transformer package to ai.prompt.transformer
* Add Short/Long term memory support.
* Add mixing transformers support

Docs TBD
This commit is contained in:
Mark Pollack
2024-04-18 13:09:47 -04:00
parent 012a2ad74a
commit dfb8bf6a44
54 changed files with 3376 additions and 99 deletions

View File

@@ -78,16 +78,29 @@ The `Message` interface encapsulates a textual message, a collection of attribut
[source,java]
----
public interface Message {
public interface Message extends Node<String> {
String getContent();
Map<String, Object> getProperties();
List<Media> getMedia();
MessageType getMessageType();
}
----
and the Node interface is
```java
public interface Node<T> {
T getContent();
Map<String, Object> getMetadata();
}
```
The `Message` interface has various implementations that correspond to the categories of messages that an AI model can process.
Some models, like OpenAI's chat completion endpoint, distinguish between message categories based on conversational roles, effectively mapped by the `MessageType`.

View File

@@ -49,19 +49,29 @@ The `Message` interface encapsulates a textual message, a collection of attribut
The interface is defined as follows:
```java
public interface Message {
public interface Message extends Node<String> {
String getContent();
List<Media> getMedia();
Map<String, Object> getProperties();
MessageType getMessageType();
}
```
and the Node interface is
```java
public interface Node<T> {
T getContent();
Map<String, Object> getMetadata();
}
```
Various implementations of the `Message` interface correspond to different categories of messages that an AI model can process. Some models, like those from OpenAI, distinguish between message categories based on conversational roles. These roles are effectively mapped by the `MessageType`, as discussed below.