mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Formatted includes/data_model
This commit is contained in:
@@ -17,64 +17,64 @@
|
|||||||
* @brief Generated brewery payload.
|
* @brief Generated brewery payload.
|
||||||
*/
|
*/
|
||||||
struct BreweryResult {
|
struct BreweryResult {
|
||||||
/**
|
/**
|
||||||
* @brief Brewery display name in English.
|
* @brief Brewery display name in English.
|
||||||
*/
|
*/
|
||||||
std::string name_en;
|
std::string name_en;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Brewery description text in English.
|
* @brief Brewery description text in English.
|
||||||
*/
|
*/
|
||||||
std::string description_en;
|
std::string description_en;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Brewery display name in the local language.
|
* @brief Brewery display name in the local language.
|
||||||
*/
|
*/
|
||||||
std::string name_local;
|
std::string name_local;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Brewery description text in the local language.
|
* @brief Brewery description text in the local language.
|
||||||
*/
|
*/
|
||||||
std::string description_local;
|
std::string description_local;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generated user profile payload.
|
* @brief Generated user profile payload.
|
||||||
*/
|
*/
|
||||||
struct UserResult {
|
struct UserResult {
|
||||||
/**
|
/**
|
||||||
* @brief First (given) name, copied from the sampled Name -- not
|
* @brief First (given) name, copied from the sampled Name -- not
|
||||||
* LLM-invented.
|
* LLM-invented.
|
||||||
*/
|
*/
|
||||||
std::string first_name{};
|
std::string first_name{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Last (family) name, copied from the sampled Name -- not
|
* @brief Last (family) name, copied from the sampled Name -- not
|
||||||
* LLM-invented.
|
* LLM-invented.
|
||||||
*/
|
*/
|
||||||
std::string last_name{};
|
std::string last_name{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gender associated with the sampled first name, copied from the
|
* @brief Gender associated with the sampled first name, copied from the
|
||||||
* sampled Name -- not LLM-invented.
|
* sampled Name -- not LLM-invented.
|
||||||
*/
|
*/
|
||||||
std::string gender{};
|
std::string gender{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Username handle.
|
* @brief Username handle.
|
||||||
*/
|
*/
|
||||||
std::string username{};
|
std::string username{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Short user biography.
|
* @brief Short user biography.
|
||||||
*/
|
*/
|
||||||
std::string bio{};
|
std::string bio{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Relative check-in/activity weight for this user, used to drive
|
* @brief Relative check-in/activity weight for this user, used to drive
|
||||||
* a J-curve activity profile in later pipeline phases.
|
* a J-curve activity profile in later pipeline phases.
|
||||||
*/
|
*/
|
||||||
float activity_weight{};
|
float activity_weight{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pipeline Data Models
|
// Pipeline Data Models
|
||||||
@@ -83,8 +83,8 @@ struct UserResult {
|
|||||||
* @brief Enriched city data with Wikipedia context.
|
* @brief Enriched city data with Wikipedia context.
|
||||||
*/
|
*/
|
||||||
struct EnrichedCity {
|
struct EnrichedCity {
|
||||||
City location;
|
City location;
|
||||||
std::string region_context{};
|
std::string region_context{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,8 +92,8 @@ struct EnrichedCity {
|
|||||||
* from that city's curated postal-code examples.
|
* from that city's curated postal-code examples.
|
||||||
*/
|
*/
|
||||||
struct BreweryAddress {
|
struct BreweryAddress {
|
||||||
City city;
|
City city;
|
||||||
std::string postal_code{};
|
std::string postal_code{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,16 +101,16 @@ struct BreweryAddress {
|
|||||||
* postal code selected from that city's curated postal-code examples.
|
* postal code selected from that city's curated postal-code examples.
|
||||||
*/
|
*/
|
||||||
struct UserAddress {
|
struct UserAddress {
|
||||||
City city;
|
City city;
|
||||||
std::string postal_code{};
|
std::string postal_code{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper struct to store generated brewery data.
|
* @brief Helper struct to store generated brewery data.
|
||||||
*/
|
*/
|
||||||
struct BreweryRecord {
|
struct BreweryRecord {
|
||||||
BreweryAddress address;
|
BreweryAddress address;
|
||||||
BreweryResult brewery;
|
BreweryResult brewery;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,10 +121,10 @@ struct BreweryRecord {
|
|||||||
* consumer can register real accounts from the pipeline's SQLite export.
|
* consumer can register real accounts from the pipeline's SQLite export.
|
||||||
*/
|
*/
|
||||||
struct UserRecord {
|
struct UserRecord {
|
||||||
UserAddress address;
|
UserAddress address;
|
||||||
UserResult user;
|
UserResult user;
|
||||||
std::string email{};
|
std::string email{};
|
||||||
std::string date_of_birth{};
|
std::string date_of_birth{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_DATA_MODEL_GENERATED_MODELS_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_DATA_MODEL_GENERATED_MODELS_H_
|
||||||
|
|||||||
@@ -28,54 +28,54 @@ namespace prog_opts = boost::program_options;
|
|||||||
* `postal_code` object in the locations dataset.
|
* `postal_code` object in the locations dataset.
|
||||||
*/
|
*/
|
||||||
struct PostalCodeSpec {
|
struct PostalCodeSpec {
|
||||||
/**
|
/**
|
||||||
* @brief Permissive country-wide postal-code format regex, used as the
|
* @brief Permissive country-wide postal-code format regex, used as the
|
||||||
* validation fallback for a selected example.
|
* validation fallback for a selected example.
|
||||||
*/
|
*/
|
||||||
std::string country_format_regex{};
|
std::string country_format_regex{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief City-specific postal-code regexes (more precise than the country
|
* @brief City-specific postal-code regexes (more precise than the country
|
||||||
* format).
|
* format).
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> city_regexes{};
|
std::vector<std::string> city_regexes{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Concrete example postal codes for this city. The postal code
|
* @brief Concrete example postal codes for this city. The postal code
|
||||||
* service selects from these rather than synthesizing codes.
|
* service selects from these rather than synthesizing codes.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> examples{};
|
std::vector<std::string> examples{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Canonical city record for city-level generation.
|
* @brief Canonical city record for city-level generation.
|
||||||
*/
|
*/
|
||||||
struct City {
|
struct City {
|
||||||
std::string city{};
|
std::string city{};
|
||||||
std::string state_province{};
|
std::string state_province{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ISO 3166-2 subdivision code.
|
* @brief ISO 3166-2 subdivision code.
|
||||||
*/
|
*/
|
||||||
std::string iso3166_2{};
|
std::string iso3166_2{};
|
||||||
|
|
||||||
std::string country{};
|
std::string country{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ISO 3166-1 country code.
|
* @brief ISO 3166-1 country code.
|
||||||
*/
|
*/
|
||||||
std::string iso3166_1{};
|
std::string iso3166_1{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Local language codes in priority order.
|
* @brief Local language codes in priority order.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> local_languages{};
|
std::vector<std::string> local_languages{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Postal-code metadata (format regex, city regexes, and concrete
|
* @brief Postal-code metadata (format regex, city regexes, and concrete
|
||||||
* examples) sourced directly from the curated locations dataset.
|
* examples) sourced directly from the curated locations dataset.
|
||||||
*/
|
*/
|
||||||
PostalCodeSpec postal_code{};
|
PostalCodeSpec postal_code{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Name / Persona Models
|
// Name / Persona Models
|
||||||
@@ -86,44 +86,44 @@ struct City {
|
|||||||
* Produced by the SampleName() helper in generate_users.cc.
|
* Produced by the SampleName() helper in generate_users.cc.
|
||||||
*/
|
*/
|
||||||
struct Name {
|
struct Name {
|
||||||
std::string first_name{};
|
std::string first_name{};
|
||||||
std::string last_name{};
|
std::string last_name{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gender associated with the sampled forename (e.g. "M", "F"), as
|
* @brief Gender associated with the sampled forename (e.g. "M", "F"), as
|
||||||
* reported by the source dataset.
|
* reported by the source dataset.
|
||||||
*/
|
*/
|
||||||
std::string gender{};
|
std::string gender{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A single forename entry from the names-by-country fixture data.
|
* @brief A single forename entry from the names-by-country fixture data.
|
||||||
*/
|
*/
|
||||||
struct ForenameEntry {
|
struct ForenameEntry {
|
||||||
/**
|
/**
|
||||||
* @brief Romanized forename.
|
* @brief Romanized forename.
|
||||||
*/
|
*/
|
||||||
std::string name{};
|
std::string name{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gender associated with this forename, as reported by the source
|
* @brief Gender associated with this forename, as reported by the source
|
||||||
* dataset (e.g. "M", "F").
|
* dataset (e.g. "M", "F").
|
||||||
*/
|
*/
|
||||||
std::string gender{};
|
std::string gender{};
|
||||||
|
|
||||||
bool operator==(const ForenameEntry& other) const {
|
bool operator==(const ForenameEntry& other) const {
|
||||||
return name == other.name && gender == other.gender;
|
return name == other.name && gender == other.gender;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template <>
|
template <>
|
||||||
struct hash<ForenameEntry> {
|
struct hash<ForenameEntry> {
|
||||||
size_t operator()(const ForenameEntry& entry) const noexcept {
|
size_t operator()(const ForenameEntry& entry) const noexcept {
|
||||||
const size_t name_hash = std::hash<std::string>{}(entry.name);
|
const size_t name_hash = std::hash<std::string>{}(entry.name);
|
||||||
const size_t gender_hash = std::hash<std::string>{}(entry.gender);
|
const size_t gender_hash = std::hash<std::string>{}(entry.gender);
|
||||||
return name_hash ^ (gender_hash << 1);
|
return name_hash ^ (gender_hash << 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
@@ -131,20 +131,20 @@ struct hash<ForenameEntry> {
|
|||||||
* @brief A persona archetype used to ground LLM-generated user bios.
|
* @brief A persona archetype used to ground LLM-generated user bios.
|
||||||
*/
|
*/
|
||||||
struct UserPersona {
|
struct UserPersona {
|
||||||
/**
|
/**
|
||||||
* @brief Persona display name (e.g. "Hophead Explorer").
|
* @brief Persona display name (e.g. "Hophead Explorer").
|
||||||
*/
|
*/
|
||||||
std::string name{};
|
std::string name{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Short description of the persona's interests and voice.
|
* @brief Short description of the persona's interests and voice.
|
||||||
*/
|
*/
|
||||||
std::string description{};
|
std::string description{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Beer styles this persona gravitates toward.
|
* @brief Beer styles this persona gravitates toward.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> style_affinities{};
|
std::vector<std::string> style_affinities{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Configuration Models
|
// Configuration Models
|
||||||
@@ -153,88 +153,88 @@ struct UserPersona {
|
|||||||
* @brief LLM sampling parameters.
|
* @brief LLM sampling parameters.
|
||||||
*/
|
*/
|
||||||
struct SamplingOptions {
|
struct SamplingOptions {
|
||||||
/**
|
/**
|
||||||
* @brief LLM sampling temperature (higher = more random).
|
* @brief LLM sampling temperature (higher = more random).
|
||||||
*/
|
*/
|
||||||
float temperature = 1.0F;
|
float temperature = 1.0F;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LLM nucleus sampling top-p parameter.
|
* @brief LLM nucleus sampling top-p parameter.
|
||||||
*/
|
*/
|
||||||
float top_p = 0.95F;
|
float top_p = 0.95F;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LLM top-k sampling parameter.
|
* @brief LLM top-k sampling parameter.
|
||||||
*/
|
*/
|
||||||
uint32_t top_k = 64;
|
uint32_t top_k = 64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Context window size (tokens).
|
* @brief Context window size (tokens).
|
||||||
*/
|
*/
|
||||||
uint32_t n_ctx = 8192;
|
uint32_t n_ctx = 8192;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Random seed (-1 for random, otherwise non-negative).
|
* @brief Random seed (-1 for random, otherwise non-negative).
|
||||||
*/
|
*/
|
||||||
int seed = -1;
|
int seed = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of layers to offload to GPU.
|
* @brief Number of layers to offload to GPU.
|
||||||
*/
|
*/
|
||||||
int n_gpu_layers = 0;
|
int n_gpu_layers = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration for the LLM generator component.
|
* @brief Configuration for the LLM generator component.
|
||||||
*/
|
*/
|
||||||
struct GeneratorOptions {
|
struct GeneratorOptions {
|
||||||
/**
|
/**
|
||||||
* @brief Path to the LLM model file (gguf format).
|
* @brief Path to the LLM model file (gguf format).
|
||||||
*/
|
*/
|
||||||
std::filesystem::path model_path;
|
std::filesystem::path model_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Use mocked generator instead of actual LLM inference.
|
* @brief Use mocked generator instead of actual LLM inference.
|
||||||
*/
|
*/
|
||||||
bool use_mocked = false;
|
bool use_mocked = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specific sampling parameters for this generator.
|
* @brief Specific sampling parameters for this generator.
|
||||||
* If nullopt, the application should use global defaults.
|
* If nullopt, the application should use global defaults.
|
||||||
*/
|
*/
|
||||||
std::optional<SamplingOptions> sampling;
|
std::optional<SamplingOptions> sampling;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration for the pipeline execution and output.
|
* @brief Configuration for the pipeline execution and output.
|
||||||
*/
|
*/
|
||||||
struct PipelineOptions {
|
struct PipelineOptions {
|
||||||
/**
|
/**
|
||||||
* @brief Directory for generated artifacts.
|
* @brief Directory for generated artifacts.
|
||||||
*/
|
*/
|
||||||
std::filesystem::path output_path;
|
std::filesystem::path output_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Directory that contains named prompt files (e.g.
|
* @brief Directory that contains named prompt files (e.g.
|
||||||
* BREWERY_GENERATION.md).
|
* BREWERY_GENERATION.md).
|
||||||
*/
|
*/
|
||||||
std::filesystem::path prompt_dir;
|
std::filesystem::path prompt_dir;
|
||||||
|
|
||||||
std::filesystem::path log_path;
|
std::filesystem::path log_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of locations to sample from the dataset
|
* @brief Number of locations to sample from the dataset
|
||||||
* More locations -> more users/more breweries
|
* More locations -> more users/more breweries
|
||||||
*/
|
*/
|
||||||
uint32_t location_count;
|
uint32_t location_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Root configuration object for the Biergarten pipeline.
|
* @brief Root configuration object for the Biergarten pipeline.
|
||||||
*/
|
*/
|
||||||
struct ApplicationOptions {
|
struct ApplicationOptions {
|
||||||
GeneratorOptions generator;
|
GeneratorOptions generator;
|
||||||
PipelineOptions pipeline;
|
PipelineOptions pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function Declarations
|
// Function Declarations
|
||||||
|
|||||||
Reference in New Issue
Block a user