Web Analytics Made Easy - Statcounter
Skip to content

Class SBDAssistant#

ClassList > SBDAssistant

This class is the base class for assistants. More...

  • #include <SBDAssistant.hpp>

Inherits the following classes: SBCReferenceTarget

Public Functions#

Type Name
SBDAssistant ()
Constructs an assistant.
virtual SBDAssistantAnswer * act (const std::wstring & question, const std::wstring & translation)
Executes an action.
virtual SBDAssistantAnswer * getAnswer (const std::wstring & question, const std::wstring & translation)
Returns an answer to a question.
virtual SBDAssistantAnswer * getCompletion (const std::wstring & question, const std::wstring & translation, const std::wstring & system, const std::wstring & queryType)
Returns a completion to a single question.
const SBUUID & getConversationUUID () const
Returns the conversation UUID.
SBGAssistant * getGUI () const
Returns a pointer to the GUI of the assistant.
virtual SBDAssistantAnswer * getNSLExpression (const std::wstring & question, const std::wstring & translation)
Returns an NSL expression.
virtual std::wstring getTranscription (const std::wstring & fileName, std::wstring & language)
Returns a transcription for an audio file with file name fileName and the detectedlanguage .
virtual std::wstring getTranslation (const std::wstring & text, const std::wstring & language)
Returns the translation of text inlanguage into English.
const SBUUID & getUserUUID () const
Returns the user UUID.
virtual SBDAssistantAnswer * memorize (const std::wstring & fileName)
Memorizes a document.
virtual SBDAssistantAnswer * memorize (const std::wstring & url, const std::wstring & include=L"", const std::wstring & exclude=L"")
Memorizes a webpage.
virtual SBDAssistantAnswer * search (const std::wstring & question, const std::wstring & translation)
Performs a search.
virtual SBDAssistantAnswer * select (const std::wstring & question, const std::wstring & translation)
Selects nodes in the document.
void setConversationUUID (const SBUUID & conversationUUID)
Sets the conversation UUID.
void setGUI (SBGAssistant * gui)
Sets the pointer to the GUI of the assistant.
void setUserUUID (const SBUUID & userUUID)
Sets the user UUID.
virtual ~SBDAssistant ()
Destructs the assistant.

Public Functions inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTarget ()
Builds the reference target.
unsigned int getMemoryFootprint () const
Returns the memory footprint.
void printReferencesToOwners () const
Prints the references to the owners of this reference target.
virtual ~SBCReferenceTarget ()
Destructor.

Protected Attributes inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTargetData * dataPointer
A pointer to the private data.

Protected Functions inherited from SBCReferenceTarget#

See SBCReferenceTarget

Type Name
SBCReferenceTarget (SBCReferenceTargetData * dataPointer)
Protected constructor.
void removeAllReferenceOwners ()
Stops all the reference owners from referencing this reference target.

Detailed Description#

Short name: SBAssistant

Public Functions Documentation#

function SBDAssistant#

Constructs an assistant.

SBDAssistant::SBDAssistant () 

Constructs an SBDAssistant object.


function act#

Executes an action.

virtual SBDAssistantAnswer * SBDAssistant::act (
    const std::wstring & question,
    const std::wstring & translation
) 

Executes an action based on the given question and its translation.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.

Returns:

Pointer to an SBDAssistantAnswer object representing the result of the action, or nullptr if no action is performed.


function getAnswer#

Returns an answer to a question.

virtual SBDAssistantAnswer * SBDAssistant::getAnswer (
    const std::wstring & question,
    const std::wstring & translation
) 

Retrieves an answer to the given question.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.

Returns:

Pointer to an SBDAssistantAnswer object representing the answer, or nullptr if no answer is available.


function getCompletion#

Returns a completion to a single question.

virtual SBDAssistantAnswer * SBDAssistant::getCompletion (
    const std::wstring & question,
    const std::wstring & translation,
    const std::wstring & system,
    const std::wstring & queryType
) 

Retrieves a completion for a single question using additional context.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.
  • system System prompt providing additional context or instructions.
  • queryType Type of query to influence the completion behavior.

Returns:

Pointer to an SBDAssistantAnswer object representing the completion, or nullptr if unavailable.


function getConversationUUID#

Returns the conversation UUID.

const SBUUID & SBDAssistant::getConversationUUID () const

Returns the conversation UUID associated with the assistant.

Returns:

Constant reference to the conversation UUID.


function getGUI#

Returns a pointer to the GUI of the assistant.

SBGAssistant * SBDAssistant::getGUI () const

Returns:

Pointer to the SBGAssistant instance associated with this assistant.


function getNSLExpression#

Returns an NSL expression.

virtual SBDAssistantAnswer * SBDAssistant::getNSLExpression (
    const std::wstring & question,
    const std::wstring & translation
) 

Generates an NSL expression based on the given question.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.

Returns:

Pointer to an SBDAssistantAnswer object containing the NSL expression, or nullptr if none is generated.


function getTranscription#

Returns a transcription for an audio file with file name fileName and the detectedlanguage .

virtual std::wstring SBDAssistant::getTranscription (
    const std::wstring & fileName,
    std::wstring & language
) 

Retrieves a transcription for the specified audio file and detects its language.

Parameters:

  • fileName Path to the audio file to transcribe.
  • language Output parameter that receives the detected language of the audio file.

Returns:

The transcription text of the audio file. Returns an empty string if transcription fails.


function getTranslation#

Returns the translation of text inlanguage into English.

virtual std::wstring SBDAssistant::getTranslation (
    const std::wstring & text,
    const std::wstring & language
) 

Translates the given text from the specified language into English.

Parameters:

  • text The text to translate.
  • language The language of the source text.

Returns:

The translated text in English.


function getUserUUID#

Returns the user UUID.

const SBUUID & SBDAssistant::getUserUUID () const

Returns the user UUID associated with the assistant.

Returns:

Constant reference to the user UUID.


function memorize [1/2]#

Memorizes a document.

virtual SBDAssistantAnswer * SBDAssistant::memorize (
    const std::wstring & fileName
) 

Memorizes the content of a document specified by a file name.

Parameters:

  • fileName Path to the file to be memorized.

Returns:

Pointer to an SBDAssistantAnswer object indicating the result, or nullptr on failure.


function memorize [2/2]#

Memorizes a webpage.

virtual SBDAssistantAnswer * SBDAssistant::memorize (
    const std::wstring & url,
    const std::wstring & include=L"",
    const std::wstring & exclude=L""
) 

Memorizes a webpage, optionally including or excluding specific content.

Parameters:

  • url URL of the webpage to memorize.
  • include Optional filter to include specific parts of the page.
  • exclude Optional filter to exclude specific parts of the page.

Returns:

Pointer to an SBDAssistantAnswer object indicating the result, or nullptr on failure.


Performs a search.

virtual SBDAssistantAnswer * SBDAssistant::search (
    const std::wstring & question,
    const std::wstring & translation
) 

Performs a search based on the given question and its translation.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.

Returns:

Pointer to an SBDAssistantAnswer object containing the search results, or nullptr if no results are found.


function select#

Selects nodes in the document.

virtual SBDAssistantAnswer * SBDAssistant::select (
    const std::wstring & question,
    const std::wstring & translation
) 

Selects nodes in the document based on the given question and its translation.

Parameters:

  • question The original question in the user's language.
  • translation The translation of the question into English.

Returns:

Pointer to an SBDAssistantAnswer object representing the selected nodes, or nullptr if selection fails.


function setConversationUUID#

Sets the conversation UUID.

void SBDAssistant::setConversationUUID (
    const SBUUID & conversationUUID
) 

Sets the conversation UUID for the assistant.

Parameters:

  • conversationUUID The UUID to assign to the current conversation.

function setGUI#

Sets the pointer to the GUI of the assistant.

void SBDAssistant::setGUI (
    SBGAssistant * gui
) 

Parameters:

  • g Pointer to the SBGAssistant instance to associate with this assistant.

function setUserUUID#

Sets the user UUID.

void SBDAssistant::setUserUUID (
    const SBUUID & userUUID
) 

Sets the user UUID for the assistant.

Parameters:

  • userUUID The UUID to assign to the user.

function ~SBDAssistant#

Destructs the assistant.

virtual SBDAssistant::~SBDAssistant () 

Destroys the SBDAssistant object.