Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ optional-dependencies.slack = [ "slack-bolt>=1.22" ]
optional-dependencies.test = [
"a2a-sdk>=0.3,<0.4",
"anthropic>=0.78", # For anthropic model tests; 0.78 introduced ThinkingConfigAdaptiveParam (required for Claude Opus 4.7).
"beautifulsoup4>=4.12,<5", # For load_web_page tool
"crewai[tools]; python_version>='3.11' and python_version<'3.12'", # For CrewaiTool tests; chromadb/pypika fail on 3.12+
"google-cloud-firestore>=2.11,<3",
"google-cloud-iamconnectorcredentials>=0.1,<0.2",
Expand All @@ -145,6 +146,7 @@ optional-dependencies.test = [
"langgraph>=0.2.60,<0.4.8", # For LangGraphAgent
"litellm>=1.83.7,<=1.83.14", # For LiteLLM tests. Lower bound: 5 CVE patches (2026-04). Upper bound pinned to current latest; bump deliberately. See #5488.
"llama-index-readers-file>=0.4", # For retrieval tests
"lxml>=5.3", # For load_web_page tool
"openai>=1.100.2", # For LiteLLM
"opentelemetry-instrumentation-google-genai>=0.3b0,<1",
"pypika>=0.50", # For crewai->chromadb dependency
Expand Down
7 changes: 6 additions & 1 deletion src/google/adk/agents/invocation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ def _get_events(
if event.invocation_id == self.invocation_id
]
if current_branch:
results = [event for event in results if event.branch == self.branch]
results = [
event
for event in results
if event.branch == self.branch
or (event.branch is None and event.author == "user")
]
return results

def should_pause_invocation(self, event: Event) -> bool:
Expand Down
24 changes: 23 additions & 1 deletion src/google/adk/dependencies/rouge_scorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,26 @@

from __future__ import annotations

from rouge_score import rouge_scorer
import re
import sys
from typing import Any

# NLTK (a subdependency of rouge-score) attempts to import 'regex'.
# If 'regex' is not installed or blocked from cwd on CI runners, provide
# a fallback wrapper that delegates to standard 're' so NLTK operates.
if "regex" not in sys.modules:
try:
import regex # type: ignore # pylint: disable=g-import-not-at-top
except Exception:

class _RegexFallback:

def __getattr__(self, name: str) -> Any:
return getattr(re, name, 0)

sys.modules["regex"] = _RegexFallback() # type: ignore

try:
from rouge_score import rouge_scorer
except Exception:
rouge_scorer = None
2 changes: 2 additions & 0 deletions src/google/adk/evaluation/final_response_match_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def _calculate_rouge_1_scores(candidate: str, reference: str):
Returns:
A dictionary containing the ROUGE-1 precision, recall, and f-measure.
"""
if rouge_scorer is None:
raise ImportError("rouge-score package is required for ROUGE evaluation.")
scorer = rouge_scorer.RougeScorer(["rouge1"], use_stemmer=True)

# The score method returns a dictionary where keys are the ROUGE types
Expand Down
Loading
Loading