Class LLMContext#
Defined in File llm_context.hpp
Inheritance Relationships#
Base Type#
public std::enable_shared_from_this< LLMContext >
Class Documentation#
-
class LLMContext : public std::enable_shared_from_this<LLMContext>#
Holds and manages information related to LLM tasks and input mappings required for LLMNode execution. Outputs of node executions are also saved here for use by nodes and task handlers in LLMEngine.
Public Functions
-
LLMContext()#
Construct a new LLMContext object.
Construct a new LLMContext object.
- Parameters:
task – task for new context
message – control message for new context
- std::shared_ptr<LLMContext> parent,
- std::string name,
- input_mappings_t inputs
Construct a new LLMContext object.
- Parameters:
parent – parent context
name – new context name
inputs – input mappings for new context
-
~LLMContext()#
Destroy the LLMContext object.
-
std::shared_ptr<LLMContext> parent() const#
Get parent context.
- Returns:
std::shared_ptr<LLMContext>
-
const std::string &name() const#
Get name of context.
- Returns:
const std::string&
-
const input_mappings_t &input_map() const#
Get map of internal mappings for this context.
- Returns:
const input_mappings_t&
-
std::shared_ptr<ControlMessage> &message() const#
Get control message for this context.
- Returns:
std::shared_ptr<ControlMessage>&
-
const utilities::json_t &all_outputs() const#
Get all outputs for this context.
- Returns:
const utilities::json_t&
-
std::string full_name() const#
Get full name of context containing parents up to root.
- Returns:
std::string
- std::shared_ptr<LLMContext> push(
- std::string name,
- input_mappings_t inputs
Create new context from this context using provided name and input mappings.
- Parameters:
name – name of new context
inputs – input mappings for new context
- Returns:
std::shared_ptr<LLMContext>
-
void pop()#
Moves output map from this context to parent context. Outputs to move can be selected using set_output_names, otherwise all outputs are noved by default.
-
const utilities::json_t &get_input() const#
Get the input value from parent context corresponding to first internal input of this context.
- Returns:
- const utilities::json_t &get_input(
- const std::string &node_name
Get the parent output value corresponding to given internal input name.
- Parameters:
node_name – internal input name
- Returns:
-
utilities::json_t get_inputs() const#
Get parent output values corresponding to all internal input names.
- Returns:
-
void set_output(utilities::json_t outputs)#
Set output mappings for this context.
- Parameters:
outputs – output mappings
- void set_output(
- const std::string &output_name,
- utilities::json_t output
Set an output value for this context.
- Parameters:
output_name – output name
output – output value
-
void set_output_names(std::vector<std::string> output_names)#
Set the output names to propagate from this context when using pop.
- Parameters:
output_names – output names to propagate
-
void outputs_complete()#
-
const utilities::json_t &view_outputs() const#
Get all outputs for this context.
- Returns:
const utilities::json_t&
-
LLMContext()#