feat: Add multimodal support (vision and audio) #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds multimodal capabilities to RLM, enabling vision (image analysis) and audio (transcription + TTS) support in the REPL environment.
Changes
Gemini Client (
rlm/clients/gemini.py)_load_image_as_part()to handle image loading from files, URLs, and base64_load_audio_as_part()to handle audio file loading_get_mime_type()with audio and video MIME types_content_to_parts()to process multimodal content (images + audio)REPL Environment (
rlm/environments/local_repl.py)vision_query(prompt, images)- Analyze images with vision-capable LLMsvision_query_batched(prompts, images_list)- Batch image analysisaudio_query(prompt, audio_files)- Transcribe/analyze audio filesspeak(text, output_path)- Text-to-speech generationSystem Prompt (
rlm/utils/prompts.py)New REPL Functions
vision_query(prompt, images)vision_query("What's in the image?", ["photo.jpg"])vision_query_batched(prompts, images_list)vision_query_batched([...], [[img1], [img2]])audio_query(prompt, audio_files)audio_query("Transcribe this", ["speech.mp3"])speak(text, output_path)speak("Hello world", "output.aiff")Usage Examples
Vision
Audio
Testing
saycommand as fallback)This addresses the open request for multimodal support in RLM.