using System.Text.Json.Serialization;
public sealed record DateDescription
[JsonPropertyName("amount")]
public int Amount { get; init; }
[JsonPropertyName("period_type")]
public string? PeriodType { get; init; }
[JsonPropertyName("period_modifier")]
public string? PeriodModifier { get; init; }
public sealed record RawQueryModel
[JsonPropertyName("query")]
public string? Query { get; set; }
[JsonPropertyName("from")]
public DateDescription? From { get; set; }
public DateDescription? To { get; set; }
[JsonPropertyName("display")]
public string? Display { get; set; }
[JsonPropertyName("error_reason")]
public string? ErrorReason { get; set; }
[JsonPropertyName("keywords")]
public string[]? Keywords { get; set; }
[JsonPropertyName("succeed")]
public bool Succeed { get; set; }
[JsonPropertyName("line_type")]
public string? LineType { get; set; }
[JsonPropertyName("key_accounts")]
public string[]? KeywordAccounts { get; set; }
[JsonPropertyName("key_departments")]
public string[]? KeywordDepartments { get; set; }
[JsonPropertyName("key_vendors")]
public string[]? KeywordVendors { get; set; }
[JsonPropertyName("group_by")]
public string? GroupBy { get; set; }
[JsonPropertyName("drill_down")]
public bool? DrillDown { get; set; }
public static void Main()
StringBuilder prompt = new();
foreach (string example in Examples()){ prompt.AppendLine(example); }
Console.WriteLine(prompt);
private static string WriteExample(string[] questions, RawQueryModel query)
string n = Environment.NewLine;
string qs = String.Join($"{n}or{n}", questions.Select(q => $"Q: {q}"));
string a = JsonSerializer.Serialize(query, new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull });
return $"Ex:{n}{qs}{n}A: {a}{n}";
private static string WriteExample(string question, RawQueryModel query) => WriteExample(new[] { question }, query);
private static string[] Examples() => new[]
"How did we do against the budget for MLOPS salaries this year so far?",
"How did we do for MLOPS salaries this year so far?",
Keywords = new[] { "MLOPS", "salaries" },
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodModifier = "Now", },
"Show me details for office supplies",
Keywords = new[] { "office supplies" },
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodModifier = "Now", },
"Can you create a barchart for total spend with Company Inc. and Amazon vendors grouped by dept?",
KeywordVendors = new[] { "Company Inc.", "Amazon" },
From = new DateDescription { PeriodType = "Month", PeriodModifier = "Start", Amount = -12, },
To = new DateDescription { PeriodModifier = "Now", },
"What is the DevOps dept budget qtd?",
KeywordDepartments = new[] { "DevOps" },
From = new DateDescription { PeriodType = "Quarter", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodModifier = "Now", },
"Show planned vs spent in recruiting, grouping by accounts in a pie chart",
Keywords = new[] { "recruiting" },
From = new DateDescription { PeriodType = "Month", PeriodModifier = "Start", Amount = -12, },
To = new DateDescription { PeriodModifier = "Now", },
"Why did we overspend last month for Tahoma sales?",
Keywords = new[] { "Tahoma Sales" },
From = new DateDescription { PeriodType = "Month", PeriodModifier = "Start", Amount = -1, },
To = new DateDescription { PeriodType = "Month", PeriodModifier = "End", Amount = -1, },
"Why was I over budget in Tahoma Sales last month?",
"What drove the overage for Tahoma sales previous month?",
Keywords = new[] { "Tahoma Sales" },
From = new DateDescription { PeriodType = "Month", PeriodModifier = "Start", Amount = -1, },
To = new DateDescription { PeriodType = "Month", PeriodModifier = "End", Amount = -1, },
"Show our salaries and revenue budget for this year.",
"I want the planned spends for salaries and revenue for this year.",
"How much have we planned for salaries and revenue this year?",
Keywords = new[] { "salaries" },
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodType = "Year", PeriodModifier = "End", Amount = 0, },
"Why did we overspend for Tahoma sales?",
Keywords = new[] { "Tahoma sales" },
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodType = "Year", PeriodModifier = "End", Amount = 0, },
"What drove the overage for Brazilian Foody?",
Keywords = new[] { "Brazilian Foody" },
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodType = "Year", PeriodModifier = "End", Amount = 0, },
"What drove the overage?",
From = new DateDescription { PeriodType = "Year", PeriodModifier = "Start", Amount = 0, },
To = new DateDescription { PeriodType = "Year", PeriodModifier = "End", Amount = 0, },