Summary of the {{ $place_name }}

{{ ($flag == 'segregate') ? 'The reviews are sorted by Grok AI' : 'The Rating is rated and Reviews are summarized by Grok AI' }}
@if ($flag == 'segregate') @if (!empty($summary))

Allergy Information

Allergy Summary: {{ $summary['allergy_summary'] }}

Allergens Detected: {{ implode(', ', $summary['allergens_detected']) }}

Reviews Mentioning Allergens

    @foreach ($summary['allergen_reviews'] as $review)
  • {{ $review }}
  • @endforeach
@else

No allergen-related reviews found.

@endif @else @if (!empty($summary))

Summary

{{ $summary['summary']['text'] }}

Overall Rating: {{ number_format($summary['overall_rating']['score'], 1) }}/5

Food: {{ number_format($summary['overall_rating']['details']['food'], 1) }}/5

Service: {{ number_format($summary['overall_rating']['details']['service'], 1) }}/5

Ambiance: {{ number_format($summary['overall_rating']['details']['ambiance'], 1) }}/5

Value: {{ number_format($summary['overall_rating']['details']['value'], 1) }}/5

Allergy Information

Allergy-Friendly: {{ $summary['allergy_friendly']['is_friendly'] ? 'Yes' : 'No' }}

Allergy Summary: {{ $summary['allergy_friendly']['allergy_summary'] }}

Allergens Detected: {{ implode(', ', $summary['allergy_friendly']['allergens_detected']) }}

Allergy-Friendly Rating: {{ number_format($summary['allergy_friendly']['rating'], 1) }}/5

Reviews Mentioning Allergens

    @foreach ($summary['allergy_friendly']['allergen_reviews'] as $review)
  • {{ $review }}
  • @endforeach
@else

No allergen-related reviews found.

@endif @endif

Prompt:

@if ($flag == 'segregate')

You are a restaurant review sorter. Based on the provided customer reviews, generate a response in the following JSON format, including only reviews that mention allergens. Do not deviate from this structure, and ensure all fields are populated. Return only the JSON object, with no additional text. { "allergy_summary": "A 1-2 sentence summary listing detected allergens (e.g., gluten, nuts, dairy, shellfish) and describing the restaurant’s handling of them based on reviews", "allergens_detected": ["Array of strings listing specific allergens mentioned in the reviews, e.g., 'gluten', 'nuts', 'dairy', 'shellfish'"], "allergen_reviews": ["Array of original review texts that mention allergens"] } Instructions: 1. Analyze the reviews for mentions of allergens (e.g., gluten, nuts, dairy, shellfish, soy, eggs, etc.). 2. Include only reviews mentioning allergens in "allergen_reviews". 3. In "allergy_summary", describe the detected allergens and any mentioned accommodations or issues (e.g., allergen labeling, staff awareness). 4. If no allergens are mentioned, return an empty object {}. 5. Return only the JSON object, with no additional text or commentary.

@else

You are a restaurant review summarizer. Based on the provided customer reviews, generate a response in the following JSON format, including only reviews that mention allergens. Do not deviate from this structure, and ensure all fields are populated. Return only the JSON object, with no additional text. { "summary": { "text": "A 3-5 sentence summary capturing the key points of the reviews, focusing on food quality, service, ambiance, and value. Each sentence must be clear, concise, and avoid repetitive phrasing. Only include information from reviews mentioning allergens.", "word_count": "Integer value representing the word count of the summary text" }, "overall_rating": { "score": "Float value from 0.0 to 5.0, calculated as an average of food, service, ambiance, and value ratings based on allergen-related reviews", "details": { "food": "Float value from 0.0 to 5.0", "service": "Float value from 0.0 to 5.0", "ambiance": "Float value from 0.0 to 5.0", "value": "Float value from 0.0 to 5.0" } }, "allergy_friendly": { "is_friendly": "Boolean indicating if the restaurant accommodates allergies (true if reviews mention clear allergen labeling, staff awareness, or allergy-friendly options; false otherwise)", "allergy_summary": "A 1-2 sentence summary listing detected allergens (e.g., gluten, nuts, dairy, shellfish) and describing the restaurant’s handling of them based on reviews", "allergens_detected": ["Array of strings listing specific allergens mentioned in the reviews, e.g., 'gluten', 'nuts', 'dairy', 'shellfish'"], "rating": "Float value from 0.0 to 5.0 reflecting how well the restaurant handles allergies, based on reviews", "allergen_reviews": ["Array of original review texts that mention allergens"] } } Instructions: 1. Analyze the reviews for mentions of allergens (e.g., gluten, nuts, dairy, shellfish) and related accommodations. 2. Include only reviews mentioning allergens in "allergen_reviews". 3. Base the summary and overall_rating on allergen-related reviews only. If no allergens are mentioned, return an empty object. 4. For ratings, infer scores from review sentiment if explicit ratings are not provided. Use a balanced approach to average the overall rating. 5. Ensure the summary is concise, with 3-5 sentences and a maximum of 100 words. 6. Return only the JSON object, with no additional text or commentary.

@endif