|
OpenAnima 0.2.0
Middleware for conversational NPCs that interact with the player, the world and each other
|
#include <IProvider.h>
Public Member Functions | |
| IProvider (const IProvider &)=delete | |
| Providers are used through a pointer, so copying and moving are not offered. | |
| IProvider & | operator= (const IProvider &)=delete |
| IProvider (IProvider &&)=delete | |
| IProvider & | operator= (IProvider &&)=delete |
| virtual OpenAnima::Core::Completion | complete (const std::vector< OpenAnima::Core::ChatMessage > &messages, const Call &call)=0 |
| OpenAnima::Core::Completion | complete (const std::vector< OpenAnima::Core::ChatMessage > &messages, const DeltaSink &onDelta) |
| OpenAnima::Core::Completion | complete (const std::vector< OpenAnima::Core::ChatMessage > &messages) |
Protected Member Functions | |
| IProvider ()=default | |
| Only derived classes build a provider. | |
An interchangeable inference backend. The rest of the library talks to this interface, so replacing a hosted API with a local model is a configuration change rather than a code change.
|
inline |
Sends a whole conversation and waits for the answer.
| messages | Conversation in chronological order; the last entry is the current turn. |
| OpenAnimaError | subclasses when the call cannot be completed. |
A class that implements the virtual form keeps both conveniences reachable through its own type: the provider here brings them in, and anything else can either do the same with using IProvider::complete; or forward to them.
References complete().
|
pure virtual |
Sends a whole conversation and returns the answer.
| messages | Conversation in chronological order; the last entry is the current turn. |
| call | Where the pieces go, and how the call can be abandoned. |
| OpenAnimaError | subclasses when the call cannot be completed. |
Implemented in OpenAnima::Provider::RestProvider.
Referenced by complete(), OpenAnima::Provider::RestProvider::complete(), complete(), and OpenAnima::Provider::RestProvider::complete().
|
inline |
Sends a whole conversation and reports the answer while it is produced.
| messages | Conversation in chronological order; the last entry is the current turn. |
| onDelta | Called with every piece of the answer as it arrives, in order. |
| OpenAnimaError | subclasses when the call cannot be completed. |
References complete().