Skip to content

feat: add AI Visibility Insights endpoint synthesising brand signals …#2490

Open
khushboo5723 wants to merge 3 commits into
mainfrom
feat/ai-visibility-insights
Open

feat: add AI Visibility Insights endpoint synthesising brand signals …#2490
khushboo5723 wants to merge 3 commits into
mainfrom
feat/ai-visibility-insights

Conversation

@khushboo5723
Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /llmo/ai-visibility/insights?domain=xxx&region=xxx — synthesises brand AI visibility signals into plain-language insights using Azure OpenAI
  • Fetches brand stats (4-month window) + top 10 topics from the existing Semrush gRPC proxy in parallel, then calls AzureChatOpenAI to produce: a 2-3 sentence summary, trend direction, top strategic topic, and one concrete recommended action
  • Response cached 2h via cachedOk to avoid redundant LLM calls on repeat loads

Test plan

  • GET /llmo/ai-visibility/insights?domain=lovesac.com&region=US returns { domain, region, aiVisibility, trendDirection, summary, topTopic, action }
  • Missing domain returns 400
  • Response includes Cache-Control: private, max-age=7200
  • Unconfigured gRPC returns 503 aiVisibilityNotConfigured

…with LLM

New GET /llmo/ai-visibility/insights endpoint fetches brand stats and top
topics from the existing Semrush gRPC proxy, builds a prompt from the data,
and calls Azure OpenAI to produce a plain-language summary, trend direction,
top strategic topic, and one recommended action. Response is cached 2h via
cachedOk to avoid redundant LLM calls on repeat dashboard loads.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@khushboo5723 khushboo5723 marked this pull request as draft May 26, 2026 13:29
@github-actions
Copy link
Copy Markdown

This PR will trigger a minor release when merged.

26 tests covering constructor validation, happy path (LLM prompt content,
parallel fetch, default region), trend detection, validation errors, gRPC
transport failure, data fetch failures, and LLM failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@khushboo5723 khushboo5723 marked this pull request as ready for review May 26, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants