yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::PromptBuilder Class Reference

#include <prompt_builder.h>

Collaboration diagram for yaze::cli::PromptBuilder:

Public Member Functions

 PromptBuilder ()
 
void SetRom (Rom *rom)
 
absl::Status LoadResourceCatalogue (const std::string &yaml_path)
 
std::string BuildSystemInstruction ()
 
std::string BuildSystemInstructionWithExamples ()
 
std::string BuildContextualPrompt (const std::string &user_prompt, const RomContext &context)
 
std::string BuildPromptFromHistory (const std::vector< agent::ChatMessage > &history)
 
void AddFewShotExample (const FewShotExample &example)
 
std::vector< FewShotExampleGetExamplesForCategory (const std::string &category)
 
std::string LookupTileId (const std::string &alias) const
 
const std::map< std::string, std::string > & tile_reference () const
 
std::string BuildFunctionCallSchemas () const
 
void SetVerbosity (int level)
 

Private Member Functions

std::string BuildCommandReference () const
 
std::string BuildFewShotExamplesSection () const
 
std::string BuildToolReference () const
 
std::string BuildContextSection (const RomContext &context)
 
std::string BuildConstraintsSection () const
 
std::string BuildTileReferenceSection () const
 
absl::StatusOr< std::string > ResolveCataloguePath (const std::string &yaml_path) const
 
void ClearCatalogData ()
 
absl::Status ParseCommands (const nlohmann::json &commands)
 
absl::Status ParseTools (const nlohmann::json &tools)
 
absl::Status ParseExamples (const nlohmann::json &examples)
 
void ParseTileReference (const nlohmann::json &tile_reference)
 

Private Attributes

Romrom_ = nullptr
 
std::unique_ptr< ResourceContextBuilderresource_context_builder_
 
std::map< std::string, std::string > command_docs_
 
std::vector< FewShotExampleexamples_
 
std::vector< ToolSpecificationtool_specs_
 
std::map< std::string, std::string > tile_reference_
 
int verbosity_ = 1
 
bool catalogue_loaded_ = false
 

Detailed Description

Definition at line 67 of file prompt_builder.h.

Constructor & Destructor Documentation

◆ PromptBuilder()

yaze::cli::PromptBuilder::PromptBuilder ( )
default

Member Function Documentation

◆ SetRom()

void yaze::cli::PromptBuilder::SetRom ( Rom * rom)
inline

Definition at line 71 of file prompt_builder.h.

References rom_.

◆ LoadResourceCatalogue()

absl::Status yaze::cli::PromptBuilder::LoadResourceCatalogue ( const std::string & yaml_path)

◆ BuildSystemInstruction()

std::string yaze::cli::PromptBuilder::BuildSystemInstruction ( )

Definition at line 634 of file prompt_builder.cc.

◆ BuildSystemInstructionWithExamples()

std::string yaze::cli::PromptBuilder::BuildSystemInstructionWithExamples ( )

Definition at line 689 of file prompt_builder.cc.

◆ BuildContextualPrompt()

std::string yaze::cli::PromptBuilder::BuildContextualPrompt ( const std::string & user_prompt,
const RomContext & context )

Definition at line 699 of file prompt_builder.cc.

◆ BuildPromptFromHistory()

std::string yaze::cli::PromptBuilder::BuildPromptFromHistory ( const std::vector< agent::ChatMessage > & history)

Definition at line 714 of file prompt_builder.cc.

◆ AddFewShotExample()

void yaze::cli::PromptBuilder::AddFewShotExample ( const FewShotExample & example)

Definition at line 733 of file prompt_builder.cc.

◆ GetExamplesForCategory()

std::vector< FewShotExample > yaze::cli::PromptBuilder::GetExamplesForCategory ( const std::string & category)

Definition at line 737 of file prompt_builder.cc.

References BuildCommandReference(), BuildToolReference(), command_docs_, and tool_specs_.

Here is the call graph for this function:

◆ LookupTileId()

std::string yaze::cli::PromptBuilder::LookupTileId ( const std::string & alias) const

Definition at line 370 of file prompt_builder.cc.

References tile_reference_.

◆ tile_reference()

const std::map< std::string, std::string > & yaze::cli::PromptBuilder::tile_reference ( ) const
inline

Definition at line 97 of file prompt_builder.h.

References tile_reference_.

Referenced by ParseTileReference().

◆ BuildFunctionCallSchemas()

std::string yaze::cli::PromptBuilder::BuildFunctionCallSchemas ( ) const

Definition at line 424 of file prompt_builder.cc.

References tool_specs_.

Referenced by BuildConstraintsSection(), and BuildContextSection().

◆ SetVerbosity()

void yaze::cli::PromptBuilder::SetVerbosity ( int level)
inline

Definition at line 105 of file prompt_builder.h.

References verbosity_.

◆ BuildCommandReference()

std::string yaze::cli::PromptBuilder::BuildCommandReference ( ) const
private

Definition at line 378 of file prompt_builder.cc.

References command_docs_.

Referenced by GetExamplesForCategory().

◆ BuildFewShotExamplesSection()

std::string yaze::cli::PromptBuilder::BuildFewShotExamplesSection ( ) const
private

Definition at line 475 of file prompt_builder.cc.

References examples_.

◆ BuildToolReference()

std::string yaze::cli::PromptBuilder::BuildToolReference ( ) const
private

Definition at line 391 of file prompt_builder.cc.

References tool_specs_.

Referenced by GetExamplesForCategory().

◆ BuildContextSection()

std::string yaze::cli::PromptBuilder::BuildContextSection ( const RomContext & context)
private

Definition at line 595 of file prompt_builder.cc.

References BuildFunctionCallSchemas().

Here is the call graph for this function:

◆ BuildConstraintsSection()

std::string yaze::cli::PromptBuilder::BuildConstraintsSection ( ) const
private

Definition at line 516 of file prompt_builder.cc.

References BuildFunctionCallSchemas(), BuildTileReferenceSection(), yaze::util::PlatformPaths::FindAsset(), tile_reference_, and tool_specs_.

Here is the call graph for this function:

◆ BuildTileReferenceSection()

std::string yaze::cli::PromptBuilder::BuildTileReferenceSection ( ) const
private

Definition at line 583 of file prompt_builder.cc.

Referenced by BuildConstraintsSection().

◆ ResolveCataloguePath()

absl::StatusOr< std::string > yaze::cli::PromptBuilder::ResolveCataloguePath ( const std::string & yaml_path) const
private

Definition at line 84 of file prompt_builder.cc.

References yaze::util::PlatformPaths::FindAsset().

Referenced by LoadResourceCatalogue().

Here is the call graph for this function:

◆ ClearCatalogData()

void yaze::cli::PromptBuilder::ClearCatalogData ( )
private

Definition at line 76 of file prompt_builder.cc.

References catalogue_loaded_, command_docs_, examples_, tile_reference_, and tool_specs_.

Referenced by LoadResourceCatalogue().

◆ ParseCommands()

absl::Status yaze::cli::PromptBuilder::ParseCommands ( const nlohmann::json & commands)
private

Definition at line 179 of file prompt_builder.cc.

References command_docs_.

Referenced by LoadResourceCatalogue().

◆ ParseTools()

◆ ParseExamples()

◆ ParseTileReference()

void yaze::cli::PromptBuilder::ParseTileReference ( const nlohmann::json & tile_reference)
private

Definition at line 358 of file prompt_builder.cc.

References tile_reference(), and tile_reference_.

Referenced by LoadResourceCatalogue().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom* yaze::cli::PromptBuilder::rom_ = nullptr
private

Definition at line 122 of file prompt_builder.h.

Referenced by SetRom().

◆ resource_context_builder_

std::unique_ptr<ResourceContextBuilder> yaze::cli::PromptBuilder::resource_context_builder_
private

Definition at line 123 of file prompt_builder.h.

◆ command_docs_

std::map<std::string, std::string> yaze::cli::PromptBuilder::command_docs_
private

◆ examples_

std::vector<FewShotExample> yaze::cli::PromptBuilder::examples_
private

Definition at line 125 of file prompt_builder.h.

Referenced by BuildFewShotExamplesSection(), ClearCatalogData(), and ParseExamples().

◆ tool_specs_

std::vector<ToolSpecification> yaze::cli::PromptBuilder::tool_specs_
private

◆ tile_reference_

std::map<std::string, std::string> yaze::cli::PromptBuilder::tile_reference_
private

◆ verbosity_

int yaze::cli::PromptBuilder::verbosity_ = 1
private

Definition at line 128 of file prompt_builder.h.

Referenced by SetVerbosity().

◆ catalogue_loaded_

bool yaze::cli::PromptBuilder::catalogue_loaded_ = false
private

Definition at line 129 of file prompt_builder.h.

Referenced by ClearCatalogData(), and LoadResourceCatalogue().


The documentation for this class was generated from the following files: