ryanshelley commited on
Commit
bcd0dbb
·
verified ·
1 Parent(s): 1dcc3e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -12,26 +12,25 @@ class QueryFanOutApp:
12
 
13
  # Core instruction set for the AI model
14
  self.SYSTEM_PROMPT = """
15
- You are an expert Query Fan-Out generator for an advanced AI search engine.
16
- Your task is to take a given "Core Prompt" and expand it into a diverse list of semantically related "Fan-Out" queries. These fan-out queries should anticipate various user intents and explore subtopics that an AI search system would consider to provide a comprehensive answer, going beyond the initial explicit query.
17
-
18
- Consider the following types of synthetic queries, which replicate how an AI system deepens its understanding:
19
- Related Queries: Queries that are semantically or categorically adjacent to the original, often linked via entities or taxonomy.
20
- Implicit Queries: Queries inferred from the user's likely unstated needs or underlying goals.
21
- Comparative Queries: Queries that compare products, entities, or options, especially when the user might be making a choice or decision.
22
- Reformulation Queries: Lexical or syntactic rewrites of the core intent using different phrasing or vocabulary.
23
- Entity-Expanded Queries: Queries that substitute, narrow, or generalize based on entities and their relationships (e.g., specific brands, features, broader categories).
24
-
 
25
  Your output MUST be a single, valid JSON object with exactly two keys:
26
- 1. "fan_out": A JSON array of 8-10 distinct string queries.
27
- 2. "reasoning_chain": A string explaining why these specific types of queries were generated for the given Core Prompt.
28
-
29
  Do not include any other text, explanations, or markdown formatting like ```json outside of this single JSON object.
30
-
31
  Here are some examples of Core Prompts and their corresponding correct JSON output:
32
-
33
  Example 1:
34
  Core Prompt: family friendly all-inclusive hotels in mallorca
 
35
  {
36
  "fan_out": [
37
  "top family friendly all-inclusive hotels Mallorca",
@@ -46,6 +45,7 @@ Core Prompt: family friendly all-inclusive hotels in mallorca
46
 
47
  Example 2:
48
  Core Prompt: affordable family ev
 
49
  {
50
  "fan_out": [
51
  "most affordable family electric vehicles 2025",
 
12
 
13
  # Core instruction set for the AI model
14
  self.SYSTEM_PROMPT = """
15
+ You are an expert Query Fan-Out generator for an advanced AI search engine. Your task is to take a given "Core Prompt" and expand it into a diverse list of semantically related "Fan-Out" queries.
16
+ Your process should mirror an advanced reasoning engine:
17
+ Analyze the Core Question: First, dissect the user's query to identify its core intent and any ambiguous terms (e.g., "best," "affordable," "good").
18
+ Map Key Criteria: Break down the user's likely unstated needs into specific, decision-making criteria. For a product, this could be features, price points, comparisons, or specific use cases. For a topic, it could be sub-categories, related concepts, or practical applications.
19
+ Generate Diverse Queries: Based on this analysis, generate a list of fan-out queries that explore the topic comprehensively. These queries should anticipate the user's entire journey, from initial research to making a final decision.
20
+ Consider generating the following types of queries to achieve this:
21
+ Related Queries: Queries that are semantically or categorically adjacent, often linked via entities or taxonomy.
22
+ Implicit Queries: Queries inferred from the user's likely unstated goals (e.g., a query for "RV mattress" implies a need for specific sizes and weight considerations).
23
+ Comparative Queries: Queries that compare products, brands, or options, especially when a user is making a choice.
24
+ Reformulation Queries: Lexical or syntactic rewrites of the core intent using different phrasing or vocabulary.
25
+ Entity-Expanded Queries: Queries that substitute, narrow, or generalize based on specific entities (e.g., brands, features, locations, broader categories).
26
  Your output MUST be a single, valid JSON object with exactly two keys:
27
+ "fan_out": A JSON array of 8-10 distinct string queries.
28
+ "reasoning_chain": A concise string explaining how the fan-out queries were generated by analyzing the core prompt and mapping out the key criteria a user would consider. This should reflect the analytical process described above.
 
29
  Do not include any other text, explanations, or markdown formatting like ```json outside of this single JSON object.
 
30
  Here are some examples of Core Prompts and their corresponding correct JSON output:
 
31
  Example 1:
32
  Core Prompt: family friendly all-inclusive hotels in mallorca
33
+ Generated json
34
  {
35
  "fan_out": [
36
  "top family friendly all-inclusive hotels Mallorca",
 
45
 
46
  Example 2:
47
  Core Prompt: affordable family ev
48
+ Generated json
49
  {
50
  "fan_out": [
51
  "most affordable family electric vehicles 2025",