-
-
Notifications
You must be signed in to change notification settings - Fork 399
Implement vision #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implement vision #159
Conversation
WalkthroughThis PR introduces a vision module to Glados, enabling the system to process camera input via a Vision Language Model. Changes include a new Changes
Sequence DiagramsequenceDiagram
participant Main as Glados Engine
participant Vision as VisionProcessor
participant Camera as Camera Input
participant VLM as Vision LLM
participant LLM as LLM Queue
Main->>Vision: Create with config
Main->>Vision: Start thread
loop Every capture_interval_seconds
Vision->>Vision: Wait for processing_active_event
Vision->>Camera: Initialize/grab frame
Camera-->>Vision: Frame data
Vision->>Vision: Preprocess & encode to JPEG
Vision->>VLM: POST image with system prompt
VLM-->>Vision: Scene description
Vision->>Vision: Prefix with [vision]
Vision->>LLM: Enqueue description
LLM->>Main: Feed to LLM processing
Main->>Main: Append vision handling system prompt
Main-->>LLM: LLM response
end
Main->>Vision: Shutdown event
Vision->>Vision: Release camera, cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~40 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
README.md(2 hunks)configs/glados_vision_config.yaml(1 hunks)pyproject.toml(1 hunks)src/glados/Vision/__init__.py(1 hunks)src/glados/Vision/constants.py(1 hunks)src/glados/Vision/vision_config.py(1 hunks)src/glados/Vision/vision_processor.py(1 hunks)src/glados/core/engine.py(7 hunks)vision.md(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-14T08:22:38.799Z
Learnt from: Leandro4002
Repo: dnhkng/GLaDOS PR: 154
File: src/glados/default_configs/glados_config.yaml:11-18
Timestamp: 2025-09-14T08:22:38.799Z
Learning: User Leandro4002 prefers to keep the original GLaDOS persona examples in src/glados/default_configs/glados_config.yaml, including the dark humor references, as part of maintaining the character's authentic personality from the Portal game series.
Applied to files:
README.mdconfigs/glados_vision_config.yaml
🧬 Code graph analysis (3)
src/glados/Vision/__init__.py (2)
src/glados/Vision/vision_config.py (1)
VisionConfig(4-11)src/glados/Vision/vision_processor.py (1)
VisionProcessor(20-183)
src/glados/core/engine.py (3)
src/glados/Vision/vision_config.py (1)
VisionConfig(4-11)src/glados/Vision/vision_processor.py (2)
VisionProcessor(20-183)run(43-88)src/glados/core/llm_processor.py (1)
run(123-230)
src/glados/Vision/vision_processor.py (1)
src/glados/Vision/vision_config.py (1)
VisionConfig(4-11)
🪛 LanguageTool
vision.md
[style] ~3-~3: As a shorter alternative for ‘able to’, consider using “can”.
Context: # Glados vision module Glados is able to capture the world with a camera and rea...
(BE_ABLE_TO)
[style] ~24-~24: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...other processors. I made so that glados is able to react to changes in the environment. - ...
(BE_ABLE_TO)
[style] ~26-~26: Who is ‘not sure’? Consider being more precise.
Context: ...ions, even when it's instructed not to. Not sure whether this is a problem with qwen3:4b...
(WHO_NOT_SURE)
🪛 markdownlint-cli2 (0.18.1)
vision.md
6-6: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 Ruff (0.14.3)
src/glados/Vision/vision_processor.py
82-82: Do not catch blind exception: Exception
(BLE001)
171-171: Do not catch blind exception: Exception
(BLE001)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/glados/vision/vision_processor.py (1)
68-82: Skip the VLM call when the LLM queue is already busyRight now we still capture, encode, and post to the VLM even if the downstream queue is backed up, only to drop the result immediately afterward. Moving the
qsize()backpressure check ahead of_post_vision_queryavoids unnecessary camera work and HTTP calls while preserving the existing throttling behaviour.- description = self._post_vision_query(payload_image) - - if self.llm_queue.qsize() >= 1: # LLM is busy, avoid flooding the queue with vision updates + if self.llm_queue.qsize() >= 1: # LLM is busy, avoid flooding the queue with vision updates logger.info("VisionProcessor: Skipped a vision update.") self._sleep(loop_started) continue + + description = self._post_vision_query(payload_image)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/glados/vision/__init__.py(1 hunks)src/glados/vision/constants.py(1 hunks)src/glados/vision/vision_config.py(1 hunks)src/glados/vision/vision_processor.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/glados/vision/__init__.py (2)
src/glados/vision/vision_config.py (1)
VisionConfig(4-11)src/glados/vision/vision_processor.py (1)
VisionProcessor(20-183)
src/glados/vision/vision_processor.py (1)
src/glados/vision/vision_config.py (1)
VisionConfig(4-11)
🪛 Ruff (0.14.3)
src/glados/vision/vision_processor.py
82-82: Do not catch blind exception: Exception
(BLE001)
171-171: Do not catch blind exception: Exception
(BLE001)
Hi, I added vision to glados. Please review whether my solution is acceptable.
See
vision.mdfor usage notes and technical details. I'm open to change stuff / make it better before merging.Demo: Youtube video
Summary by CodeRabbit
New Features
Documentation
Dependencies