Skip to content

Update roboflow demo#277

Merged
maxkahan merged 10 commits intomainfrom
update-roboflow-demo
Dec 31, 2025
Merged

Update roboflow demo#277
maxkahan merged 10 commits intomainfrom
update-roboflow-demo

Conversation

@maxkahan
Copy link
Contributor

@maxkahan maxkahan commented Dec 31, 2025

adds football commentator example and article
makes minimal roboflow example in the plugins folder

Summary by CodeRabbit

  • Documentation

    • Added comprehensive README, run guide, and setup/env templates for the AI Football Commentator example; includes architecture, config, experiments, and tips.
    • Updated Roboflow plugin example README with streamlined setup, testing flow, and customization guidance.
    • Removed older Roboflow example instructions that previously defined a football-commentator persona.
  • New Features

    • Added a Football Commentator example demonstrating real-time commentary triggered by detections.
  • Chores

    • Added example project configuration for the Roboflow demo.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new standalone football commentator example (code, docs, env, pyproject) and refactors the Roboflow example to a simpler object-detection demo with updated docs and configuration files. No public API signatures were changed.

Changes

Cohort / File(s) Summary
Football Commentator Example (New)
examples/03_football_commentator_example/README.md, examples/03_football_commentator_example/RUNNING_THE_EXAMPLE.md, examples/03_football_commentator_example/instructions.md, examples/03_football_commentator_example/env.example, examples/03_football_commentator_example/football_commentator_example.py
New end-to-end example: local RF-DETR detection + real-time LLM commentary flow, Debouncer-driven ball-detection triggers, CLI entry via AgentLauncher, docs with setup, configuration options, experiments, and instructions. Includes env template.
Roboflow Example — Docs & UX
plugins/roboflow/example/README.md, plugins/roboflow/example/instructions.md, plugins/roboflow/example/env.example
README rewritten and retitled to "Roboflow Object Detection Example"; setup simplified, added customization and event-handling guidance; football-specific instructions removed; env.example comment clarified.
Roboflow Example — Runtime
plugins/roboflow/example/roboflow_example.py
Simplified runtime example: removed Debouncer and LLM calls, now prints detection labels on events and limits default detector classes (now ["person"]). Function signatures retained.
Roboflow Example — Project Config
plugins/roboflow/example/pyproject.toml
New pyproject.toml for the example: project metadata, dependencies, and uv tool.sources mapping to local editable packages.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Video as Video Stream
    participant Detector as RF-DETR (Local)
    participant Agent as Vision Agent
    participant Debouncer as Debouncer
    participant LLM as OpenAI Realtime
    participant Stream as GetStream

    Note over Video,Detector: Continuous frame processing
    Video->>Detector: send frame
    Detector->>Agent: on_detection event (objects)
    Agent->>Debouncer: is_event_allowed(detection)
    alt allowed: ball detected & not debounced
        Debouncer->>Agent: allow
        Agent->>LLM: send selected prompt (simple_response)
        LLM->>Stream: emit commentary
        Stream->>Agent: call/update events
    else blocked: debounced or no ball
        Debouncer->>Agent: block (skip LLM)
    end
    Note over Agent,Detector: continue streaming detections
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #264: Adds debounced, ball-detection-triggered LLM calls and Debouncer usage in the Roboflow/football-commentator example — strongly related to the new example's event flow.
  • PR #277: Modifies the same example entrypoints (create_agent / join_call) and example wiring; overlaps with this PR's example structure and CLI usage.

Suggested reviewers

  • Nash0x7E2
  • dangusev

Poem

In stadium light the small round truth appears,
A shuttered eye counts frames and waits its breath.
The voice, concise and sudden, leans toward the ball—
Debounced, precise, a brief electric cry.
The simpler demo keeps its quiet watch.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Update roboflow demo' is vague and generic, failing to convey the main changes in the changeset. Consider a more descriptive title such as 'Add football commentator example and simplify roboflow demo' to better reflect the primary changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 00a919f and 5f9d8af.

📒 Files selected for processing (4)
  • examples/03_football_commentator_example/RUNNING_THE_EXAMPLE.md
  • examples/03_football_commentator_example/env.example
  • plugins/roboflow/example/README.md
  • plugins/roboflow/example/roboflow_example.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (3)
examples/03_football_commentator_example/README.md (1)

98-98: Consider Markdown link formatting for video embeds.

Four GitHub asset URLs are bare (lines 98, 144, 178, 200). While functional, proper Markdown link syntax improves rendering across different viewers.

Example for line 98:

-https://github.com/user-attachments/assets/600275c4-3ed7-4149-a791-79d24828c0b8
+[Demo Video](https://github.com/user-attachments/assets/600275c4-3ed7-4149-a791-79d24828c0b8)

Also applies to: 144-144, 178-178, 200-200

examples/03_football_commentator_example/football_commentator_example.py (1)

52-54: Use any() for more efficient ball detection check.

The current implementation creates an unnecessary list just to check boolean truthiness. Using any() is more idiomatic and efficient.

🔎 Proposed fix
-        ball_detected = bool(
-            [obj for obj in event.objects if obj["label"] == "sports ball"]
-        )
+        ball_detected = any(
+            obj["label"] == "sports ball" for obj in event.objects
+        )
plugins/roboflow/example/README.md (1)

34-39: Clarify interaction method and fallbacks in testing instructions.

The phrase "Speak to the agent" is ambiguous—it's unclear whether this requires voice input via the demo UI or if text input is accepted. Additionally, the testing flow assumes camera availability without guidance on testing without a camera or handling camera access denials.

🔎 Suggested clarifications
 1. Open the demo UI link that appears in the console
 2. Enable your camera
-3. **Speak to the agent** and ask "What do you see?" or "Describe what's in the video"
+3. **Interact with the agent** (via voice or text chat) and ask "What do you see?" or "Describe what's in the video"
 4. The agent will describe what it sees in the annotated video feed
+
+> **Note:** If camera access is unavailable, the agent will still process the video stream but may have limited context.

Consider adding a troubleshooting section that addresses common setup and runtime issues:

  • Camera access denied
  • Missing API credentials
  • Network connectivity with GetStream
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aad060e and 00a919f.

⛔ Files ignored due to path filters (1)
  • examples/03_football_commentator_example/images/sam3_example_highlighting.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • examples/03_football_commentator_example/README.md
  • examples/03_football_commentator_example/RUNNING_THE_EXAMPLE.md
  • examples/03_football_commentator_example/__init__.py
  • examples/03_football_commentator_example/env.example
  • examples/03_football_commentator_example/football_commentator_example.py
  • examples/03_football_commentator_example/instructions.md
  • examples/03_football_commentator_example/utils.py
  • plugins/roboflow/example/README.md
  • plugins/roboflow/example/env.example
  • plugins/roboflow/example/instructions.md
  • plugins/roboflow/example/pyproject.toml
  • plugins/roboflow/example/roboflow_example.py
💤 Files with no reviewable changes (1)
  • plugins/roboflow/example/instructions.md
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python.mdc)

**/*.py: Never adjust sys.path in Python code
Never write except Exception as e - use specific exception handling
Avoid using getattr, hasattr, delattr and setattr; prefer normal attribute access in Python
Docstrings should follow the Google style guide for docstrings

Files:

  • plugins/roboflow/example/roboflow_example.py
  • examples/03_football_commentator_example/football_commentator_example.py
🧬 Code graph analysis (2)
plugins/roboflow/example/roboflow_example.py (2)
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py (2)
  • RoboflowLocalDetectionProcessor (53-345)
  • events (207-210)
plugins/roboflow/vision_agents/plugins/roboflow/events.py (1)
  • DetectionCompletedEvent (16-31)
examples/03_football_commentator_example/football_commentator_example.py (2)
examples/03_football_commentator_example/utils.py (1)
  • Debouncer (4-19)
plugins/roboflow/vision_agents/plugins/roboflow/events.py (1)
  • DetectionCompletedEvent (16-31)
🪛 LanguageTool
examples/03_football_commentator_example/instructions.md

[style] ~6-~6: This phrase can be considered informal. To elevate your writing, consider using a more professional alternative.
Context: ...s every time. It may make more sense to talk about ball possession, positioning, direction...

(TALK_ABOUT_DISCUSS)

examples/03_football_commentator_example/README.md

[grammar] ~3-~3: Use a hyphen to join words.
Context: ...s](https://visionagents.ai/) is our open source framework for quickly building lo...

(QB_NEW_EN_HYPHEN)


[style] ~80-~80: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ... ``` The rest of the agent logic works exactly the same for both, so we could run identical tes...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[style] ~84-~84: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...The Vision Agents SDK can be configured very quickly, which allowed us to iterate and find t...

(EN_WEAK_ADJECTIVE)


[style] ~106-~106: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...peared to be making a judgment based on a very small number of frames rather than looking at...

(EN_WEAK_ADJECTIVE)


[style] ~108-~108: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...tructure makes switching between models very quick, so we also ran the demo with Gemini Li...

(EN_WEAK_ADJECTIVE)


[style] ~115-~115: Consider a more concise word here.
Context: ...Responsive ### Initial Timed Approach In order to make the model responsive (i.e. not req...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~188-~188: Do not mix variants of the same word (‘pre-train’ and ‘pretrain’) within a single text.
Context: ...on natural language prompts rather than pre-trained classes. Luckily for us, it was also ma...

(EN_WORD_COHERENCY)


[style] ~246-~246: Consider replacing this word to strengthen your wording.
Context: ...p This demo was a useful reality check and reflects the current state of the techn...

(AND_THAT)

🪛 markdownlint-cli2 (0.18.1)
examples/03_football_commentator_example/README.md

98-98: Bare URL used

(MD034, no-bare-urls)


144-144: Bare URL used

(MD034, no-bare-urls)


178-178: Bare URL used

(MD034, no-bare-urls)


200-200: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: unit / Validate extra dependencies in "agents-core/pyproject.toml"
  • GitHub Check: unit / Ruff
  • GitHub Check: unit / Test "not integration"
  • GitHub Check: unit / Mypy
  • GitHub Check: unit / Mypy
  • GitHub Check: unit / Test "not integration"
🔇 Additional comments (7)
plugins/roboflow/example/env.example (1)

1-6: LGTM!

The simplified comments improve clarity without changing functionality.

examples/03_football_commentator_example/instructions.md (1)

1-10: LGTM!

The instructions provide clear guidance for the AI commentator persona. The conversational tone is appropriate for LLM system prompts, and the reference to colored bounding boxes aligns with the detection processor's visual output.

plugins/roboflow/example/pyproject.toml (1)

1-19: LGTM!

The project configuration is well-structured with appropriate dependencies and correct relative paths for local editable sources. The Python version requirement (>=3.10) aligns with modern development practices.

examples/03_football_commentator_example/README.md (1)

1-251: LGTM!

Comprehensive documentation covering architecture, implementation, performance benchmarks, and lessons learned. The two-model approach (RF-DETR + realtime LLM) is well-explained, and the honest assessment of current limitations provides valuable context for users.

plugins/roboflow/example/roboflow_example.py (1)

1-14: LGTM!

The module docstring clearly describes the example's purpose and requirements.

examples/03_football_commentator_example/football_commentator_example.py (1)

1-14: LGTM!

Imports and setup are clean and well-organized.

plugins/roboflow/example/README.md (1)

14-19: Update environment setup guidance with correct variable names.

The instructions reference env.example but don't explain which credentials are required. However, the suggested variable names in the original review are incorrect. The env.example file actually contains:

  • STREAM_API_KEY (not GETSTREAM_API_KEY)
  • STREAM_API_SECRET (not GETSTREAM_API_SECRET)
  • OPENAI_API_KEY (required but not mentioned in original suggestion)

There is no ROBOFLOW_API_KEY variable in the environment file.

Consider expanding the guidance to list the actual required environment variables:

🔎 Suggested expanded setup guidance
 2. Create a `.env` file with your API keys:

 ```bash
 cp env.example .env
-# Edit .env with your actual credentials
+# Edit .env with your credentials:
+# - STREAM_API_KEY: Your GetStream API key
+# - STREAM_API_SECRET: Your GetStream API secret
+# - OPENAI_API_KEY: Your OpenAI API key
</details>



> Likely an incorrect or invalid review comment.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@maxkahan maxkahan merged commit 5c966d3 into main Dec 31, 2025
9 of 10 checks passed
@maxkahan maxkahan deleted the update-roboflow-demo branch December 31, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants