Skip to content

fix: stabilize failing ElevenLabs, HuggingFace, and Sarvam tests - #636

Draft
DaemonLoki wants to merge 3 commits into
mainfrom
fix-tests
Draft

fix: stabilize failing ElevenLabs, HuggingFace, and Sarvam tests#636
DaemonLoki wants to merge 3 commits into
mainfrom
fix-tests

Conversation

@DaemonLoki

Copy link
Copy Markdown
Contributor

Why

Several plugin tests and model assumptions drifted from current provider behavior, which made CI flaky or fail outright. ElevenLabs STT can emit multiple utterances per clip, HuggingFace VLM interrupt coverage needed a more reliable signal than counting streamed deltas, and Sarvam no longer offers sarvam-30b.

Changes

  • Relax ElevenLabs STT turn-event assertions and add unit coverage for partial/committed transcript callbacks
  • Make HuggingFace TransformersVLM interrupt tests wait on model.generate and assert truncated generation
  • Remove unsupported sarvam-30b from sarvam.LLM and update README/tests to sarvam-105b

Made with Cursor

DaemonLoki and others added 2 commits August 19, 2026 09:50
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated Sarvam support to remove sarvam-30b and use sarvam-105b in examples and tests. Added a changelog entry for the breaking change. Expanded ElevenLabs STT tests for turn event ordering, duplicate partials, empty commits, keepalive commits, and participant propagation. Added mocked and integration tests for interruption and cleanup during Hugging Face generation.

Merge Risk: 🟡 Moderate · up to 3fcd9

The PR updates provider-specific tests and model references, but its interruption coverage still depends on mocked behavior and permits more generated output than the intended cancellation contract. Merge should wait for these test corrections or explicit owner acceptance.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
plugins/huggingface/tests/test_transformers_vlm.py (2)

148-150: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the mock-based generation setup.

Line 148 configures MagicMock.generate with side_effect. Use a concrete test-only model implementation and construct VLMResources with it. This keeps the interruption test deterministic without mocks.

As per coding guidelines, **/*test*.py says “Never mock in tests; use pytest for testing.”

Source: Coding guidelines


348-348: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use direct attribute assignment.

Line 348 uses setattr. Assign resources.model.generate directly.

Proposed fix
-        setattr(resources.model, "generate", signaling_generate)
+        resources.model.generate = signaling_generate

As per coding guidelines, **/*.py says “Avoid getattr, hasattr, delattr, setattr; prefer normal attribute access.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c7501ab9-205a-42f9-ba77-1036ffa7e8bf

📥 Commits

Reviewing files that changed from the base of the PR and between adc3523 and 795445f.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • plugins/elevenlabs/tests/test_elevenlabs_stt.py
  • plugins/huggingface/tests/test_transformers_vlm.py
  • plugins/sarvam/README.md
  • plugins/sarvam/tests/test_sarvam_llm.py
  • plugins/sarvam/vision_agents/plugins/sarvam/llm.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread CHANGELOG.md Outdated
Comment thread plugins/elevenlabs/tests/test_elevenlabs_stt.py
Comment thread plugins/huggingface/tests/test_transformers_vlm.py Outdated
Comment thread plugins/sarvam/README.md
SARVAM_BASE_URL = "https://api.sarvam.ai/v1"
DEFAULT_MODEL = "sarvam-m"
SUPPORTED_MODELS = {"sarvam-m", "sarvam-30b", "sarvam-105b"}
SUPPORTED_MODELS = {"sarvam-m", "sarvam-105b"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 4 '\bSUPPORTED_MODELS\b|sarvam-30b' .

Repository: GetStream/Vision-Agents

Length of output: 5457


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- candidate files ---'
fd -t f 'llm\.py$|test.*sarvam|sarvam.*test' . | head -80

printf '%s\n' '--- Sarvam LLM structure ---'
ast-grep outline plugins/sarvam/vision_agents/plugins/sarvam/llm.py

printf '%s\n' '--- Sarvam LLM implementation ---'
cat -n plugins/sarvam/vision_agents/plugins/sarvam/llm.py | sed -n '1,180p'

printf '%s\n' '--- LLM class and constructor usages ---'
rg -n -C 5 'class LLM|def __init__|model not in|SUPPORTED_MODELS|Sarvam LLM|sarvam-30b' \
  plugins/sarvam . -g '*.py' | head -300

Repository: GetStream/Vision-Agents

Length of output: 31989


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- base ChatCompletionsLLM constructor ---'
rg -n -C 12 'class ChatCompletionsLLM|def __init__' \
  plugins/openai/vision_agents/plugins/openai agents-core/vision_agents/core/llm/llm.py -g '*.py' | head -240

printf '%s\n' '--- Sarvam LLM tests ---'
cat -n plugins/sarvam/tests/test_sarvam_llm.py | sed -n '1,150p'

printf '%s\n' '--- AST validation probe ---'
python3 - <<'PY'
import ast
from pathlib import Path

sarvam_path = Path("plugins/sarvam/vision_agents/plugins/sarvam/llm.py")
source = sarvam_path.read_text()
tree = ast.parse(source)

class InitVisitor(ast.NodeVisitor):
    def __init__(self):
        self.init = None
    def visit_FunctionDef(self, node):
        if node.name == "__init__":
            self.init = node
        self.generic_visit(node)

visitor = InitVisitor()
visitor.visit(tree)
init = visitor.init
print("SarvamLLM.__init__ contains SUPPORTED_MODELS:", any(
    isinstance(node, ast.Name) and node.id == "SUPPORTED_MODELS"
    for node in ast.walk(init)
))
print("SarvamLLM.__init__ model comparisons:", [
    ast.unparse(node) for node in ast.walk(init)
    if isinstance(node, ast.Compare)
])

base_candidates = list(Path("plugins/openai").rglob("*.py"))
for path in base_candidates:
    text = path.read_text()
    if "class ChatCompletionsLLM" not in text:
        continue
    base_tree = ast.parse(text)
    for node in ast.walk(base_tree):
        if isinstance(node, ast.ClassDef) and node.name == "ChatCompletionsLLM":
            inits = [
                item for item in node.body
                if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef))
                and item.name == "__init__"
            ]
            if inits:
                base_init = inits[0]
                print("Base constructor:", path)
                print("Base constructor model comparisons:", [
                    ast.unparse(item) for item in ast.walk(base_init)
                    if isinstance(item, ast.Compare)
                ])
                print("Base constructor model assignments:", [
                    ast.unparse(item) for item in ast.walk(base_init)
                    if isinstance(item, ast.Assign)
                    and "model" in ast.unparse(item)
                ])
PY

Repository: GetStream/Vision-Agents

Length of output: 27706


Reject unsupported Sarvam models at construction.

SarvamLLM.__init__ does not enforce SUPPORTED_MODELS; the base class only assigns self.model. Add a ValueError for sarvam-30b and a rejection test.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
plugins/huggingface/tests/test_transformers_vlm.py (2)

127-160: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Do not add MagicMock-based tests here.

The new interruption test uses mocked model and processor behavior. Replace these mocks with concrete test implementations, or keep interruption coverage in the real integration test.

As per coding guidelines, "**/*test*.py: Never mock in tests; use pytest for testing."

Source: Coding guidelines


362-367: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the one-token interruption contract.

generated_token_counts[0] < 20 allows 19 tokens after interruption. The upstream _CancelStoppingCriteria contract in plugins/huggingface/vision_agents/plugins/huggingface/transformers_llm.py:160-175 requires generation to stop within one token. Assert generated_token_counts[0] <= 1 so this test detects delayed cancellation.

Proposed assertion
-            assert generated_token_counts[0] < 20
+            assert generated_token_counts[0] <= 1
🧹 Nitpick comments (1)
plugins/huggingface/tests/test_transformers_vlm.py (1)

348-348: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use normal attribute assignment instead of setattr.

Replace this call with resources.model.generate = signaling_generate.

As per coding guidelines, “Avoid getattr, hasattr, delattr and setattr; prefer normal attribute access.”

Proposed change
-        setattr(resources.model, "generate", signaling_generate)
+        resources.model.generate = signaling_generate

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c55a79f-8f98-4a39-b8ac-10e2d78b7c51

📥 Commits

Reviewing files that changed from the base of the PR and between 795445f and 3fcd9a4.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • plugins/elevenlabs/tests/test_elevenlabs_stt.py
  • plugins/huggingface/tests/test_transformers_vlm.py
  • plugins/sarvam/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/sarvam/README.md
  • CHANGELOG.md
  • plugins/elevenlabs/tests/test_elevenlabs_stt.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

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.

1 participant