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
14 changes: 9 additions & 5 deletions langfun/core/eval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,19 @@ def _run_group(arg: tuple[int, list[_LeafNode]]) -> None:
'LastCompleted': leaf.node.id
})

# NOTE(daiyip): Run leaf nodes grouped by model resource id. This allows
# evaluations using the same resource to run sequentially, which favors
# completing evaluations over running evaluations sparsely.
# NOTE: Fan out all independent leaf evaluations concurrently. Each leaf
# is placed in its own group (keyed by its unique leaf id) and the run is
# dispatched with max_workers == number of leaves, so every leaf can be
# in flight at once. Per-model backpressure is still enforced by the
# LM-level rate-limit semaphore (Layer C, keyed by resource_id), which
# remains the only cap on concurrent requests to a given model.
filter = filter or (lambda x: True)
leaf_nodes: list[_LeafNode] = []
leaf_groups: dict[str, list[_LeafNode]] = collections.defaultdict(list)

for i, leaf in enumerate(self.leaf_nodes):
node = _LeafNode(index=i + 1, node=leaf, enabled=filter(leaf))
leaf_groups[leaf.lm.resource_id].append(node)
leaf_groups[leaf.id].append(node)
leaf_nodes.append(node)

if leaf_groups:
Expand All @@ -354,7 +357,8 @@ def _run_group(arg: tuple[int, list[_LeafNode]]) -> None:
_run_group,
[(overview_bar, group) for group in leaf_groups.values()],
silence_on_errors=None,
max_workers=len(leaf_groups)):
max_workers=len(leaf_nodes),
):
pass

# Save results for non-leaf nodes.
Expand Down
1 change: 1 addition & 0 deletions langfun/core/llms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
from langfun.core.llms.vertexai import VertexAIGemini3ProPreview
from langfun.core.llms.vertexai import VertexAIGemini3ProImagePreview
from langfun.core.llms.vertexai import VertexAIGemini3FlashPreview
from langfun.core.llms.vertexai import VertexAIGemini35Flash

# Veo video generation models.
from langfun.core.llms.veo import Veo
Expand Down
26 changes: 26 additions & 0 deletions langfun/core/llms/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,32 @@ def estimate_cost(self, usage: lf.LMSamplingUsage) -> float | None:
max_tokens_per_minute=4_000_000,
),
),
# Gemini 3.5 Flash
GeminiModelInfo(
model_id='gemini-3.5-flash',
in_service=True,
provider=pg.oneof(['Google GenAI', 'VertexAI']),
model_type='instruction-tuned',
description=(
'Gemini 3.5 Flash: High-efficiency, low-latency multimodal'
' model optimized for agentic workflows.'
),
release_date=datetime.datetime(2026, 5, 19),
input_modalities=GeminiModelInfo.ALL_SUPPORTED_INPUT_TYPES,
context_length=lf.ModelInfo.ContextLength(
max_input_tokens=1_048_576,
max_output_tokens=65_536,
),
pricing=GeminiModelInfo.Pricing(
cost_per_1m_cached_input_tokens=0.15,
cost_per_1m_input_tokens=1.50,
cost_per_1m_output_tokens=9.00,
),
rate_limits=lf.ModelInfo.RateLimits(
max_requests_per_minute=2_000,
max_tokens_per_minute=4_000_000,
),
),
# Gemini 2.5 Flash
GeminiModelInfo(
model_id='gemini-2.5-flash',
Expand Down
7 changes: 7 additions & 0 deletions langfun/core/llms/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ class VertexAIGemini3FlashPreview(VertexAIGemini): # pylint: disable=invalid-na
location = 'global'


class VertexAIGemini35Flash(VertexAIGemini): # pylint: disable=invalid-name
"""Gemini 3.5 Flash GA model launched on 05/19/2026."""

model = 'gemini-3.5-flash'
location = 'global'


class VertexAIGemini31FlashLitePreview(VertexAIGemini): # pylint: disable=invalid-name
"""Gemini 3.1 Flash Lite Preview model."""

Expand Down
Loading