MBilal-72 commited on
Commit
82f1d4e
·
verified ·
1 Parent(s): 994eab4

correct the prompt formet in scrorer.py

Browse files
Files changed (1) hide show
  1. utils/scorer.py +81 -7
utils/scorer.py CHANGED
@@ -17,18 +17,92 @@ class GEOScorer:
17
 
18
  def setup_prompts(self):
19
  """Initialize prompts for different types of analysis"""
20
-
21
  # Main GEO analysis prompt
22
- def setup_prompts(self):
23
- self.geo_analysis_prompt = "You are a Generative Engine Optimization (GEO) Specialist. Your task is to critically analyze the input content for its effectiveness in AI-powered search engines and large language model (LLM) systems. Evaluate the content using the following GEO criteria, assigning a score from 1 to 10 for each: \n\n1. AI Search Visibility - How likely is the content to be surfaced by AI search engines?\n2. Query Intent Matching - How well does the content align with common user queries?\n3. Factual Accuracy & Authority - How trustworthy and authoritative is the information?\n4. Conversational Readiness - Is the content well-suited for AI chat responses?\n5. Semantic Richness - Does the content effectively use relevant semantic keywords?\n6. Context Completeness - Is the content self-contained and does it provide complete answers?\n7. Citation Worthiness - How likely is the content to be cited by AI systems?\n8. Multi-Query Coverage - Does the content address multiple related questions?\n\nAlso provide:\n- Key topics and entities mentioned\n- Missing information or content gaps\n- Specific optimization opportunities\n- Actionable enhancement recommendations\n\nRespond strictly in JSON format using the structure below (double curly braces shown here to escape string formatting, do NOT include them in actual output):\n\n{{\n \"geo_scores\": {{\n \"ai_search_visibility\": 0.0,\n \"query_intent_matching\": 0.0,\n \"factual_accuracy\": 0.0,\n \"conversational_readiness\": 0.0,\n \"semantic_richness\": 0.0,\n \"context_completeness\": 0.0,\n \"citation_worthiness\": 0.0,\n \"multi_query_coverage\": 0.0\n }},\n \"overall_geo_score\": 0.0,\n \"primary_topics\": [\"topic1\", \"topic2\"],\n \"entities\": [\"entity1\", \"entity2\"],\n \"missing_gaps\": [\"gap1\", \"gap2\"],\n \"optimization_opportunities\": [\n {{\n \"type\": \"semantic_enhancement\",\n \"description\": \"Describe the improvement opportunity\",\n \"priority\": \"high\"\n }}\n ],\n \"recommendations\": [\n \"Write clear and specific suggestions to improve the content\"\n ]\n}}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
-
26
  # Quick scoring prompt for faster analysis
27
- self.quick_score_prompt = "You are an AI Search Optimization Analyst. Evaluate the given content and provide a quick scoring based on key criteria.\nRate each of the following from 1 to 10:\n1. AI Search Visibility\n2. Query Intent Matching\n3. Conversational Readiness\n4. Citation Worthiness\n\n{\n \"scores\": {\n \"ai_search_visibility\": 0.0,\n \"query_intent_matching\": 0.0,\n \"conversational_readiness\": 0.0,\n \"citation_worthiness\": 0.0\n },\n \"overall_score\": 0.0,\n \"top_recommendation\": \"Provide the most critical improvement needed\"\n}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
-
30
  # Competitive analysis prompt
31
- self.competitive_prompt = "Compare these content pieces for GEO performance. Identify which performs better for AI search and why.\nContent A: {content_a}\nContent B: {content_b}\nProvide analysis in JSON:\n{\n \"winner\": \"A\" or \"B\",\n \"score_comparison\": {\n \"content_a_score\": 7.5,\n \"content_b_score\": 8.2\n },\n \"key_differences\": [\"difference1\", \"difference2\"],\n \"improvement_suggestions\": {\n \"content_a\": [\"suggestion1\"],\n \"content_b\": [\"suggestion1\"]\n }\n}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  def analyze_page_geo(self, content: str, title: str, detailed: bool = True) -> Dict[str, Any]:
34
  """
 
17
 
18
  def setup_prompts(self):
19
  """Initialize prompts for different types of analysis"""
20
+
21
  # Main GEO analysis prompt
22
+ self.geo_analysis_prompt = (
23
+ "You are a Generative Engine Optimization (GEO) Specialist. Your task is to critically analyze the input content for its effectiveness in AI-powered search engines and large language model (LLM) systems. "
24
+ "Evaluate the content using the following GEO criteria, assigning a score from 1 to 10 for each: \n\n"
25
+ "1. AI Search Visibility - How likely is the content to be surfaced by AI search engines?\n"
26
+ "2. Query Intent Matching - How well does the content align with common user queries?\n"
27
+ "3. Factual Accuracy & Authority - How trustworthy and authoritative is the information?\n"
28
+ "4. Conversational Readiness - Is the content well-suited for AI chat responses?\n"
29
+ "5. Semantic Richness - Does the content effectively use relevant semantic keywords?\n"
30
+ "6. Context Completeness - Is the content self-contained and does it provide complete answers?\n"
31
+ "7. Citation Worthiness - How likely is the content to be cited by AI systems?\n"
32
+ "8. Multi-Query Coverage - Does the content address multiple related questions?\n\n"
33
+ "Also provide:\n"
34
+ "- Key topics and entities mentioned\n"
35
+ "- Missing information or content gaps\n"
36
+ "- Specific optimization opportunities\n"
37
+ "- Actionable enhancement recommendations\n\n"
38
+ "Respond strictly in JSON format using the structure below (double curly braces shown here to escape string formatting, do NOT include them in actual output):\n\n"
39
+ "{{\n"
40
+ " \"geo_scores\": {{\n"
41
+ " \"ai_search_visibility\": 0.0,\n"
42
+ " \"query_intent_matching\": 0.0,\n"
43
+ " \"factual_accuracy\": 0.0,\n"
44
+ " \"conversational_readiness\": 0.0,\n"
45
+ " \"semantic_richness\": 0.0,\n"
46
+ " \"context_completeness\": 0.0,\n"
47
+ " \"citation_worthiness\": 0.0,\n"
48
+ " \"multi_query_coverage\": 0.0\n"
49
+ " }},\n"
50
+ " \"overall_geo_score\": 0.0,\n"
51
+ " \"primary_topics\": [\"topic1\", \"topic2\"],\n"
52
+ " \"entities\": [\"entity1\", \"entity2\"],\n"
53
+ " \"missing_gaps\": [\"gap1\", \"gap2\"],\n"
54
+ " \"optimization_opportunities\": [\n"
55
+ " {{\n"
56
+ " \"type\": \"semantic_enhancement\",\n"
57
+ " \"description\": \"Describe the improvement opportunity\",\n"
58
+ " \"priority\": \"high\"\n"
59
+ " }}\n"
60
+ " ],\n"
61
+ " \"recommendations\": [\n"
62
+ " \"Write clear and specific suggestions to improve the content\"\n"
63
+ " ]\n"
64
+ "}}"
65
+ )
66
 
 
67
  # Quick scoring prompt for faster analysis
68
+ self.quick_score_prompt = (
69
+ "You are an AI Search Optimization Analyst. Evaluate the given content and provide a quick scoring based on key criteria.\n"
70
+ "Rate each of the following from 1 to 10:\n"
71
+ "1. AI Search Visibility\n"
72
+ "2. Query Intent Matching\n"
73
+ "3. Conversational Readiness\n"
74
+ "4. Citation Worthiness\n\n"
75
+ "{{\n"
76
+ " \"scores\": {{\n"
77
+ " \"ai_search_visibility\": 0.0,\n"
78
+ " \"query_intent_matching\": 0.0,\n"
79
+ " \"conversational_readiness\": 0.0,\n"
80
+ " \"citation_worthiness\": 0.0\n"
81
+ " }},\n"
82
+ " \"overall_score\": 0.0,\n"
83
+ " \"top_recommendation\": \"Provide the most critical improvement needed\"\n"
84
+ "}}"
85
+ )
86
 
 
87
  # Competitive analysis prompt
88
+ self.competitive_prompt = (
89
+ "Compare these content pieces for GEO performance. Identify which performs better for AI search and why.\n"
90
+ "Content A: {content_a}\n"
91
+ "Content B: {content_b}\n"
92
+ "Provide analysis in JSON:\n"
93
+ "{{\n"
94
+ " \"winner\": \"A\" or \"B\",\n"
95
+ " \"score_comparison\": {{\n"
96
+ " \"content_a_score\": 7.5,\n"
97
+ " \"content_b_score\": 8.2\n"
98
+ " }},\n"
99
+ " \"key_differences\": [\"difference1\", \"difference2\"],\n"
100
+ " \"improvement_suggestions\": {{\n"
101
+ " \"content_a\": [\"suggestion1\"],\n"
102
+ " \"content_b\": [\"suggestion1\"]\n"
103
+ " }}\n"
104
+ "}}"
105
+ )
106
 
107
  def analyze_page_geo(self, content: str, title: str, detailed: bool = True) -> Dict[str, Any]:
108
  """