Skip to main content
“How does X compare to Y?” is the question behind most competitive analysis, investment screening, and strategic planning. This recipe pulls both entity profiles from Gildea and produces a structured competitive comparison brief — not just a data table, but an interpreted analysis of relative positioning, momentum, and strategic implications.

Who this is for

  • Investors comparing two companies for a portfolio allocation decision
  • Product leaders evaluating competitive positioning against a specific rival
  • Consultants building competitive analysis sections for client deliverables

The pattern

  1. Pull both entity profiles
  2. Compare trend stats (scale, direction, share of voice, slope)
  3. Compare theme distributions to understand strategic positioning
  4. Check co-occurrence and synthesize into a comparison brief

Step 1: Pull profiles and compare stats

from gildea_sdk import Gildea

client = Gildea()

# 1. Pull both profiles
a = client.entities.get("NVIDIA")
b = client.entities.get("Google")

# 2. Compare trend stats
print(f"{'':20} {'NVIDIA':>12} {'Google':>12}")
print(f"{'Scale':20} {a['scale']:>12} {b['scale']:>12}")
print(f"{'Direction':20} {a['direction'] or 'N/A':>12} {b['direction'] or 'N/A':>12}")
print(f"{'Notability':20} {a['notability'] or 'N/A':>12} {b['notability'] or 'N/A':>12}")
print(f"{'Share of voice':20} {a['trend']['share_of_voice']:>11.1%} {b['trend']['share_of_voice']:>11.1%}")
print(f"{'Slope':20} {a['trend']['theil_sen_slope']:>12.4f} {b['trend']['theil_sen_slope']:>12.4f}")
print(f"{'Signals (total)':20} {a['signal_count']:>12} {b['signal_count']:>12}")
print(f"{'This week':20} {a['trend']['current_week']:>12} {b['trend']['current_week']:>12}")

Step 2: Compare theme distributions

See where each entity’s coverage concentrates — this reveals strategic positioning:
# 3. Theme comparison
print(f"\nValue chain distribution:")
a_vc = a.get("value_chain_distribution", {})
b_vc = b.get("value_chain_distribution", {})
all_themes = sorted(set(a_vc.keys()) | set(b_vc.keys()))

for theme in all_themes:
    a_count = a_vc.get(theme, 0)
    b_count = b_vc.get(theme, 0)
    print(f"  {theme:30} {a_count:>5} {b_count:>5}")

print(f"\nMarket force distribution:")
a_mf = a.get("market_force_distribution", {})
b_mf = b.get("market_force_distribution", {})
all_forces = sorted(set(a_mf.keys()) | set(b_mf.keys()))

for force in all_forces:
    a_count = a_mf.get(force, 0)
    b_count = b_mf.get(force, 0)
    print(f"  {force:30} {a_count:>5} {b_count:>5}")

Step 3: Check co-occurrence

Do these entities appear in the same signals? If so, they’re likely discussed in relation to each other:
# 4. Check if they co-occur
a_related = {r["entity_id"]: r for r in a.get("related_entities", [])}
b_related = {r["entity_id"]: r for r in b.get("related_entities", [])}

if b["entity_id"] in a_related:
    rel = a_related[b["entity_id"]]
    print(f"\nCo-occurrence: {rel['co_occurrence_count']} signals mention both")
else:
    print(f"\nNo direct co-occurrence found")

Step 4: Find cross-entity intelligence

# Signals mentioning entity A, search for claims about entity B
results = client.search("Google AI infrastructure strategy", entity="NVIDIA", limit=5)

for hit in results["data"]:
    print(f"[{hit['relevance_score']:.4f}] {hit['unit']['text']}")
    print(f"  From: {hit['citation']['signal_title']}")
    print()

Step 5: Synthesize into a comparison brief

import json

comparison_data = {
    "entity_a": {
        "name": "NVIDIA",
        "scale": a["scale"],
        "direction": a["direction"],
        "notability": a["notability"],
        "notability_reasoning": a.get("notability_reasoning", ""),
        "signal_count": a["signal_count"],
        "share_of_voice": a["trend"]["share_of_voice"],
        "slope": a["trend"]["theil_sen_slope"],
        "current_week": a["trend"]["current_week"],
        "value_chain_focus": dict(sorted(a_vc.items(), key=lambda x: -x[1])[:3]),
        "market_force_focus": dict(sorted(a_mf.items(), key=lambda x: -x[1])[:3]),
        "top_co_occurrences": [
            r["name"] for r in a.get("related_entities", [])[:5]
        ],
    },
    "entity_b": {
        "name": "Google",
        "scale": b["scale"],
        "direction": b["direction"],
        "notability": b["notability"],
        "notability_reasoning": b.get("notability_reasoning", ""),
        "signal_count": b["signal_count"],
        "share_of_voice": b["trend"]["share_of_voice"],
        "slope": b["trend"]["theil_sen_slope"],
        "current_week": b["trend"]["current_week"],
        "value_chain_focus": dict(sorted(b_vc.items(), key=lambda x: -x[1])[:3]),
        "market_force_focus": dict(sorted(b_mf.items(), key=lambda x: -x[1])[:3]),
        "top_co_occurrences": [
            r["name"] for r in b.get("related_entities", [])[:5]
        ],
    },
    "co_occurrence_count": (
        a_related[b["entity_id"]]["co_occurrence_count"]
        if b["entity_id"] in a_related else 0
    ),
}

comparison_json = json.dumps(comparison_data, indent=2)

SYSTEM_PROMPT = """You are a senior competitive intelligence analyst producing a
structured comparison brief. You will receive entity profile data for two companies
from Gildea's AI market intelligence platform, including trend analytics, theme
distributions, and co-occurrence data.

Rules:
- This is for a decision-maker choosing between, competing against, or evaluating
  these two entities. Write accordingly.
- Start with a one-sentence positioning statement for each entity.
- Compare on 4 dimensions: Momentum (direction/slope), Scale (absolute size),
  Strategic Focus (theme distributions), and Market Context (co-occurrences).
- For each dimension, declare a WINNER or call it a TIE with a one-sentence reason.
- Theme distributions reveal strategy: if Entity A is 80% Infrastructure and Entity B
  is 60% Application Layer, that's a real strategic insight, not just a number.
- Co-occurrence data reveals relationships: shared co-occurrences suggest they operate
  in the same competitive context. Different co-occurrences suggest different arenas.
- End with a "Bottom Line" — the single most important thing to know about how these
  two entities compare right now.
- Keep it under 400 words.

Output format (markdown):

## Competitive Comparison: [Entity A] vs. [Entity B]

### Positioning
- **[Entity A]:** <one-sentence characterization of their current market position>
- **[Entity B]:** <one-sentence characterization of their current market position>

### Head-to-Head

| Dimension | [Entity A] | [Entity B] | Edge |
|-----------|-----------|-----------|------|
| Momentum | <direction, slope> | <direction, slope> | <winner> |
| Scale | <SoV, signal count> | <SoV, signal count> | <winner> |
| Focus | <top themes> | <top themes> | <insight> |
| Context | <top co-occurrences> | <top co-occurrences> | <insight> |

### Strategic Focus Comparison
<2-3 sentences interpreting what the theme distribution differences reveal about
each entity's strategy and competitive positioning>

### Market Context
<2-3 sentences on co-occurrence patterns: who each entity is discussed alongside,
what that reveals, and whether they're competing in the same arena>

### Bottom Line
<1-2 sentences: the single most important takeaway for the decision at hand>
"""

USER_PROMPT = f"""Produce a competitive comparison brief from this entity data:

{comparison_json}
"""

# Pass to your LLM, or print for manual use
print("=== SYSTEM PROMPT ===")
print(SYSTEM_PROMPT)
print("=== USER PROMPT ===")
print(USER_PROMPT)

Example output artifact

## Competitive Comparison: NVIDIA vs. Google

### Positioning
- **NVIDIA:** The dominant infrastructure provider whose compute hardware underpins
  the entire AI economy — discussed more than any other single entity.
- **Google:** A vertically integrated AI player competing simultaneously in
  infrastructure (TPUs), models (Gemini), and applications (Workspace AI, Search).

### Head-to-Head

| Dimension | NVIDIA | Google | Edge |
|-----------|--------|--------|------|
| Momentum | Rising, slope +0.012 | Stable, slope +0.003 | NVIDIA |
| Scale | 14.2% SoV, 847 signals | 11.8% SoV, 712 signals | NVIDIA |
| Focus | 72% Infrastructure | 40% Application Layer, 30% Models | Different arenas |
| Context | AMD, TSMC, Microsoft | OpenAI, Anthropic, Meta | Different competitors |

### Strategic Focus Comparison
NVIDIA's coverage is overwhelmingly concentrated in Infrastructure (72%), reflecting
its role as the foundational compute provider. Google's coverage is more distributed
across Application Layer (40%), Models & Training (30%), and Infrastructure (20%) —
reflecting its strategy of competing at every layer of the stack. This means they
rarely compete head-to-head: NVIDIA's competitive battles are with AMD and custom
silicon efforts, while Google's are with OpenAI and Anthropic at the model and
application layers.

### Market Context
NVIDIA is most frequently discussed alongside AMD, TSMC, and Microsoft — its supply
chain and distribution partners. Google is discussed alongside OpenAI, Anthropic,
and Meta — its model-layer competitors. The co-occurrence overlap is minimal,
confirming these entities occupy different competitive arenas despite both being
"AI companies."

### Bottom Line
NVIDIA and Google are not competing with each other — they're competing in different
layers of the same economy. NVIDIA owns the floor (compute), Google is fighting for
the ceiling (applications and models). An investor or strategist should evaluate them
as complementary bets on AI growth, not as substitutes.

Interpreting results

SignalWhat it meansAction
One entity rising, other decliningMomentum divergence — one is gaining at the other’s expense (or not)Check if they actually compete head-to-head. Declining in different arenas isn’t necessarily related.
Similar theme distributionsThey occupy the same strategic spaceDirect competitors. Dig deeper with cross-entity search to find head-to-head claims.
Very different theme distributionsThey operate in different layers/segmentsNot direct competitors. Compare them to entities in their actual competitive set instead.
High co-occurrence countExperts frequently discuss them togetherStrong competitive or partnership relationship. Pull co-occurrence signals for specifics.
Zero co-occurrenceExperts don’t connect themEither different segments, different scale, or the comparison isn’t meaningful. Reconsider.
Same top co-occurrence partnersThey compete for the same ecosystem positionIntense competitive overlap. This is the most useful comparison scenario.

API calls

  • 2 calls for entity profiles
  • Optional: 1 call for cross-entity search
  • Total: 2-3 calls per comparison