mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
chore(deps): upgrade Pydantic AI to 2.77.0 and refresh the AI model picker (#7002)
* chore(deps): upgrade Pydantic AI to 2.77.0 * test(agent): cover updated provider error handling * test(assistant): locate tool results alongside availability updates * feat: keep older OpenAI and Anthropic models in the picker * fix: use SDK retry causes in Kuma evals and clarify model discovery * feat: preserve historical AI provider model suggestions
This commit is contained in:
1 parent
1c2480f1dc
commit
e7fae94fa1
25 files changed
+406
-147
No files matched your search
@@ -98,7 +98,7 @@ dependencies = [
|
||||
"genson==1.4.0",
|
||||
"pyotp==2.9.0",
|
||||
"qrcode==8.2",
|
||||
"pydantic-ai-slim[anthropic,bedrock,google,groq,mistral,openai,web-fetch]==2.55.0",
|
||||
"pydantic-ai-slim[anthropic,bedrock,google,groq,mistral,openai,web-fetch]==2.77.0",
|
||||
"opentelemetry-sdk>=1.20.0",
|
||||
"netifaces==0.11.0",
|
||||
"requests-futures>=1.1.0",
|
||||
|
||||
@@ -23,7 +23,6 @@ from pydantic_ai.messages import (
|
||||
NativeToolReturnPart,
|
||||
PartEndEvent,
|
||||
PartStartEvent,
|
||||
RetryPromptPart,
|
||||
ToolReturnPart,
|
||||
)
|
||||
|
||||
@@ -244,7 +243,7 @@ def _reports_native_failure(content: Any) -> bool:
|
||||
|
||||
|
||||
def _ended(
|
||||
part: ToolReturnPart | NativeToolReturnPart | RetryPromptPart,
|
||||
part: ToolReturnPart | NativeToolReturnPart,
|
||||
held: bool = False,
|
||||
approved: bool = False,
|
||||
) -> _Ending:
|
||||
@@ -259,7 +258,7 @@ def _ended(
|
||||
:return: Its status, facts, and what people may see of its failures.
|
||||
"""
|
||||
|
||||
if isinstance(part, RetryPromptPart):
|
||||
if part.outcome == "retried":
|
||||
return _Ending(ChatRunStepStatus.FAILED, error_code=ToolErrorCode.INVALID_INPUT)
|
||||
if part.outcome == "interrupted":
|
||||
return _Ending(ChatRunStepStatus.STOPPED)
|
||||
@@ -535,7 +534,7 @@ class ChatRunSteps:
|
||||
def _end(
|
||||
self,
|
||||
tool_call_id: str,
|
||||
part: ToolReturnPart | NativeToolReturnPart | RetryPromptPart,
|
||||
part: ToolReturnPart | NativeToolReturnPart,
|
||||
) -> None:
|
||||
"""Complete the oldest open step of a call, when it has one.
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from baserow.core.models import Workspace
|
||||
|
||||
from .constants import WEB_SEARCH_MAX_PER_REPLY, ProviderFailure, ReasoningEffort
|
||||
from .exceptions import is_google_invalid_api_key, is_xai_invalid_api_key
|
||||
from .historical_models import with_historical_models
|
||||
from .registries import (
|
||||
EmbedKindLimit,
|
||||
FileHandler,
|
||||
@@ -428,9 +429,10 @@ class OpenAIGenerativeAIModelType(BaseOpenAIGenerativeAIModelType):
|
||||
return WebSearchTool()
|
||||
|
||||
def get_known_models(self) -> list[str]:
|
||||
from openai.types import AllModels
|
||||
from pydantic_ai.models.openai import OpenAIModelName
|
||||
|
||||
return get_known_model_names(OpenAIModelName)
|
||||
return get_known_model_names(OpenAIModelName, AllModels)
|
||||
|
||||
@cached_property
|
||||
def file_handler(self) -> OpenAIFileHandler:
|
||||
@@ -521,9 +523,12 @@ class AnthropicGenerativeAIModelType(GenerativeAIModelType):
|
||||
)
|
||||
|
||||
def get_known_models(self) -> list[str]:
|
||||
from anthropic.types import ModelParam
|
||||
from pydantic_ai.models.anthropic import AnthropicModelName
|
||||
|
||||
return get_known_model_names(AnthropicModelName)
|
||||
return with_historical_models(
|
||||
self.type, get_known_model_names(AnthropicModelName, ModelParam)
|
||||
)
|
||||
|
||||
def _prepare_model_settings(
|
||||
self, temperature: Optional[float] = None
|
||||
@@ -628,9 +633,12 @@ class BedrockGenerativeAIModelType(GenerativeAIModelType):
|
||||
from pydantic_ai.models.bedrock import LatestBedrockModelNames
|
||||
from pydantic_ai.providers.bedrock import remove_bedrock_geo_prefix
|
||||
|
||||
models = with_historical_models(
|
||||
self.type, get_known_model_names(LatestBedrockModelNames)
|
||||
)
|
||||
return [
|
||||
name
|
||||
for name in get_known_model_names(LatestBedrockModelNames)
|
||||
for name in models
|
||||
if remove_bedrock_geo_prefix(name) not in _BEDROCK_DISCOVERY_EXCLUDED_MODELS
|
||||
]
|
||||
|
||||
@@ -722,9 +730,12 @@ class GoogleGenerativeAIModelType(GenerativeAIModelType):
|
||||
def get_known_models(self) -> list[str]:
|
||||
from pydantic_ai.models.google import GoogleModelName
|
||||
|
||||
models = with_historical_models(
|
||||
self.type, get_known_model_names(GoogleModelName)
|
||||
)
|
||||
return [
|
||||
name
|
||||
for name in get_known_model_names(GoogleModelName)
|
||||
for name in models
|
||||
if "-image" not in name and name not in _GOOGLE_DISCOVERY_EXCLUDED_MODELS
|
||||
]
|
||||
|
||||
@@ -891,7 +902,7 @@ class XaiGenerativeAIModelType(GenerativeAIModelType):
|
||||
]
|
||||
return [
|
||||
name
|
||||
for name in xai_models
|
||||
for name in with_historical_models(self.type, xai_models)
|
||||
if _XAI_DISCOVERY_MODEL_PATTERN.match(name) and "multi-agent" not in name
|
||||
]
|
||||
|
||||
@@ -957,7 +968,9 @@ class ZaiGenerativeAIModelType(GenerativeAIModelType):
|
||||
|
||||
return [
|
||||
name
|
||||
for name in get_known_model_names(LatestZaiModelNames)
|
||||
for name in with_historical_models(
|
||||
self.type, get_known_model_names(LatestZaiModelNames)
|
||||
)
|
||||
if name not in _ZAI_DISCOVERY_EXCLUDED_MODELS
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
"""Chat model IDs from Baserow's Pydantic AI 2.55 picker missing after 2.77."""
|
||||
|
||||
HISTORICAL_CHAT_MODELS = {
|
||||
"anthropic": ["claude-sonnet-4-5", "claude-sonnet-4-5-20250929"],
|
||||
"bedrock": [
|
||||
"us.amazon.nova-2-lite-v1:0",
|
||||
"anthropic.claude-3-5-haiku-20241022-v1:0",
|
||||
"us.anthropic.claude-3-5-haiku-20241022-v1:0",
|
||||
"global.anthropic.claude-opus-4-5-20251101-v1:0",
|
||||
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
"us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
"anthropic.claude-sonnet-4-6",
|
||||
"us.anthropic.claude-sonnet-4-6",
|
||||
"eu.anthropic.claude-sonnet-4-6",
|
||||
"anthropic.claude-haiku-4-5-20251001-v1:0",
|
||||
"us.anthropic.claude-haiku-4-5-20251001-v1:0",
|
||||
"eu.anthropic.claude-haiku-4-5-20251001-v1:0",
|
||||
"anthropic.claude-haiku-5-5",
|
||||
"us.anthropic.claude-haiku-5-5",
|
||||
"eu.anthropic.claude-haiku-5-5",
|
||||
"au.anthropic.claude-haiku-5-5",
|
||||
"jp.anthropic.claude-haiku-5-5",
|
||||
"meta.llama3-8b-instruct-v1:0",
|
||||
"meta.llama3-70b-instruct-v1:0",
|
||||
"meta.llama3-1-8b-instruct-v1:0",
|
||||
"us.meta.llama3-1-8b-instruct-v1:0",
|
||||
"meta.llama3-1-70b-instruct-v1:0",
|
||||
"us.meta.llama3-1-70b-instruct-v1:0",
|
||||
"meta.llama3-1-405b-instruct-v1:0",
|
||||
"us.meta.llama3-2-11b-instruct-v1:0",
|
||||
"us.meta.llama3-2-90b-instruct-v1:0",
|
||||
"us.meta.llama3-2-1b-instruct-v1:0",
|
||||
"us.meta.llama3-2-3b-instruct-v1:0",
|
||||
"mistral.mistral-7b-instruct-v0:2",
|
||||
"mistral.mixtral-8x7b-instruct-v0:1",
|
||||
"mistral.mistral-large-2402-v1:0",
|
||||
"mistral.mistral-large-2407-v1:0",
|
||||
"us.anthropic.claude-opus-4-5-20251101-v1:0",
|
||||
"us.anthropic.claude-opus-4-6-v1",
|
||||
"global.anthropic.claude-opus-4-6-v1",
|
||||
"us.anthropic.claude-opus-4-7",
|
||||
"global.anthropic.claude-opus-4-7",
|
||||
"us.anthropic.claude-opus-4-8",
|
||||
"us.anthropic.claude-opus-5",
|
||||
"global.anthropic.claude-opus-5",
|
||||
"us.anthropic.claude-opus-5-5",
|
||||
"us.anthropic.claude-sonnet-5",
|
||||
"global.anthropic.claude-sonnet-5",
|
||||
"us.anthropic.claude-fable-5",
|
||||
"us.anthropic.claude-fable-5-1",
|
||||
"global.anthropic.claude-fable-5",
|
||||
"global.anthropic.claude-fable-5-1",
|
||||
"us.openai.gpt-5.6-sol",
|
||||
"us.openai.gpt-5.6-luna",
|
||||
"in.openai.gpt-5.6-luna",
|
||||
"us.openai.gpt-5.6-terra",
|
||||
"in.openai.gpt-5.6-terra",
|
||||
"mistral.mistral-small-2402-v1:0",
|
||||
"mistral.ministral-3-3b-instruct",
|
||||
"mistral.ministral-3-8b-instruct",
|
||||
"mistral.pixtral-large-2502-v1:0",
|
||||
"deepseek.r1-v1:0",
|
||||
"qwen.qwen3-32b-v1:0",
|
||||
"qwen.qwen3-coder-30b-a3b-v1:0",
|
||||
"google.gemma-3-4b-it",
|
||||
"google.gemma-3-12b-it",
|
||||
"minimax.minimax-m2",
|
||||
"minimax.minimax-m2.1",
|
||||
"nvidia.nemotron-nano-9b-v2",
|
||||
"nvidia.nemotron-nano-12b-v2",
|
||||
"us.writer.palmyra-x4-v1:0",
|
||||
"zai.glm-4.7-flash",
|
||||
"zai.glm-5",
|
||||
"moonshot.kimi-k2-thinking",
|
||||
],
|
||||
"google": [
|
||||
"gemini-flash-latest",
|
||||
"gemini-flash-lite-latest",
|
||||
"gemini-2.5-flash",
|
||||
"gemini-2.5-flash-lite",
|
||||
"gemini-2.5-pro",
|
||||
"gemini-3-flash-preview",
|
||||
"gemini-3.5-flash",
|
||||
"gemini-3.6-flash",
|
||||
"gemini-3.7-flash",
|
||||
],
|
||||
"xai": [
|
||||
"grok-4.20",
|
||||
"grok-4.20-0309",
|
||||
"grok-4.20-0309-non-reasoning",
|
||||
"grok-4.20-0309-reasoning",
|
||||
"grok-4.20-non-reasoning",
|
||||
"grok-4.20-non-reasoning-latest",
|
||||
"grok-4.20-reasoning-latest",
|
||||
"grok-4.3-latest",
|
||||
"grok-4.5",
|
||||
"grok-4.5-latest",
|
||||
"grok-4.6",
|
||||
],
|
||||
"zai": [
|
||||
"glm-5.2",
|
||||
"glm-5.1",
|
||||
"glm-5",
|
||||
"glm-4.7-flashx",
|
||||
"glm-4.6",
|
||||
"glm-4.6v-flash",
|
||||
"glm-4.6v-flashx",
|
||||
"glm-4.5",
|
||||
"glm-4.5v",
|
||||
"glm-4.5-airx",
|
||||
"glm-4.5-x",
|
||||
"glm-4.5-flash",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def with_historical_models(provider_type: str, current_models: list[str]) -> list[str]:
|
||||
historical = HISTORICAL_CHAT_MODELS.get(provider_type, ())
|
||||
return list(dict.fromkeys([*current_models, *historical]))
|
||||
@@ -80,8 +80,8 @@ def call_with_supported_kwargs(method: Any, **kwargs) -> Any:
|
||||
)
|
||||
|
||||
|
||||
def get_known_model_names(model_name_type: Any) -> list[str]:
|
||||
"""Extract the known string literals from a Pydantic AI model-name type."""
|
||||
def get_known_model_names(model_name_type: Any, *additional_types: Any) -> list[str]:
|
||||
"""Collect model IDs from ordered type hints, keeping the first occurrence."""
|
||||
|
||||
names: list[str] = []
|
||||
|
||||
@@ -96,6 +96,8 @@ def get_known_model_names(model_name_type: Any) -> list[str]:
|
||||
collect(type_arg)
|
||||
|
||||
collect(model_name_type)
|
||||
for additional_type in additional_types:
|
||||
collect(additional_type)
|
||||
return list(dict.fromkeys(names))
|
||||
|
||||
|
||||
|
||||
@@ -1549,13 +1549,14 @@ def test_testing_an_unknown_saved_model_returns_not_found(api_client, staff_head
|
||||
@pytest.mark.parametrize(
|
||||
("provider_type", "expected_model"),
|
||||
[
|
||||
("openai", "gpt-5"),
|
||||
("anthropic", "claude-sonnet-4-5"),
|
||||
("google", "gemini-2.5-flash"),
|
||||
("openai", "gpt-6.2-sol"),
|
||||
("anthropic", "claude-fable-5-2"),
|
||||
("bedrock", "global.openai.gpt-6.1-terra"),
|
||||
("google", "gemini-4-carbon"),
|
||||
("groq", "openai/gpt-oss-120b"),
|
||||
("mistral", "mistral-large-latest"),
|
||||
("xai", "grok-4.3"),
|
||||
("zai", "glm-5.2"),
|
||||
("mistral", "ministral-14b-latest"),
|
||||
("xai", "grok-4.7"),
|
||||
("zai", "glm-5.3-flashx"),
|
||||
],
|
||||
)
|
||||
def test_model_discovery_returns_pydantic_ai_known_models(
|
||||
@@ -1625,7 +1626,7 @@ def test_xai_model_discovery_keeps_only_current_grok_4_models(
|
||||
assert response.status_code == HTTP_200_OK
|
||||
models = response.json()["models"]
|
||||
assert "grok-4.3" in models
|
||||
assert "grok-4.20-non-reasoning" in models
|
||||
assert "grok-4.7" in models
|
||||
assert all(model.startswith("grok-4.") for model in models)
|
||||
assert not any("multi-agent" in model for model in models)
|
||||
for retired_or_unverified in (
|
||||
@@ -1777,9 +1778,9 @@ def test_google_model_discovery_excludes_image_output_models(api_client, staff_h
|
||||
)
|
||||
|
||||
assert response.status_code == HTTP_200_OK
|
||||
assert "gemini-2.5-flash" in response.json()["models"]
|
||||
assert "gemini-2.5-flash-image" not in response.json()["models"]
|
||||
assert "gemini-3-pro-image-preview" not in response.json()["models"]
|
||||
assert "gemini-3.1-flash-lite" in response.json()["models"]
|
||||
assert "gemini-3.1-flash-lite-image" not in response.json()["models"]
|
||||
assert "gemini-3-pro-image" not in response.json()["models"]
|
||||
assert "gemini-2.0-flash" not in response.json()["models"]
|
||||
assert "gemini-2.0-flash-lite" not in response.json()["models"]
|
||||
assert "gemini-2.5-flash-preview-09-2025" not in response.json()["models"]
|
||||
|
||||
@@ -316,11 +316,11 @@ def test_a_question_out_of_bounds_is_retried_instead_of_held(
|
||||
assert reply_state(reply.id) == ("completed", "", "Done.")
|
||||
assert not reply.approvals.exists()
|
||||
assert [
|
||||
part.part_kind
|
||||
(part.part_kind, getattr(part, "outcome", None))
|
||||
for message in received[-1]
|
||||
for part in getattr(message, "parts", [])
|
||||
if getattr(part, "tool_name", None) == ASK_PERSON_TOOL_NAME
|
||||
] == ["tool-call", "retry-prompt"]
|
||||
] == [("tool-call", None), ("tool-return", "retried")]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
@@ -863,7 +863,7 @@ def test_empty_groq_stream_logs_the_original_error_in_debug_mode(
|
||||
assert reply_state(reply_run.context["reply_id"]) == ("failed", "failed", "")
|
||||
assert len(logs) == 1
|
||||
assert (
|
||||
"UnexpectedModelBehavior: Streamed response ended without content or tool calls"
|
||||
"ModelEmptyResponseError: Streamed response ended without content or tool calls"
|
||||
in logs[0].record["message"]
|
||||
)
|
||||
assert "PRIVATE_KEY_CANARY" not in str(logs[0])
|
||||
|
||||
@@ -1466,7 +1466,10 @@ def test_a_page_the_converter_cant_handle_is_a_failed_step(
|
||||
user = data_fixture.create_user()
|
||||
mocker.patch(
|
||||
"baserow.contrib.agent.web_fetch._download",
|
||||
return_value=page(f'<ol start="{"9" * 5000}"><li>One</li></ol>'),
|
||||
return_value=page("<p>Example</p>"),
|
||||
)
|
||||
mocker.patch(
|
||||
"baserow.contrib.agent.web_fetch._convert_html", side_effect=ValueError
|
||||
)
|
||||
returned = fetch_results(mocker, ["https://example.com/"])
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ from pydantic_ai.messages import (
|
||||
DeferredToolRequestsEvent,
|
||||
FunctionToolCallEvent,
|
||||
FunctionToolResultEvent,
|
||||
RetryPromptPart,
|
||||
ToolCallPart,
|
||||
ToolReturnPart,
|
||||
)
|
||||
@@ -83,7 +82,11 @@ def test_steps_keep_call_order_and_distinct_ids_when_provider_ids_are_reused():
|
||||
@pytest.mark.parametrize(
|
||||
"part,status,error_code",
|
||||
[
|
||||
(RetryPromptPart("Try again", tool_call_id="one"), "failed", "invalid_input"),
|
||||
(
|
||||
ToolReturnPart("tool", "Try again", "one", outcome="retried"),
|
||||
"failed",
|
||||
"invalid_input",
|
||||
),
|
||||
(ToolReturnPart("tool", {"error": "denied"}, "one"), "failed", "failed"),
|
||||
(ToolReturnPart("tool", None, "one", outcome="failed"), "failed", "failed"),
|
||||
(
|
||||
@@ -138,7 +141,9 @@ def test_invalid_call_is_failed_even_without_a_result_and_has_no_input():
|
||||
|
||||
|
||||
def retry(call_id):
|
||||
return FunctionToolResultEvent(RetryPromptPart("Fix it", tool_call_id=call_id))
|
||||
return FunctionToolResultEvent(
|
||||
ToolReturnPart("tool", "Fix it", call_id, outcome="retried")
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -7,7 +7,8 @@ import pytest
|
||||
from botocore.stub import Stubber
|
||||
from pydantic_ai import BinaryContent, TextContent, UploadedFile
|
||||
from pydantic_ai.exceptions import ModelAPIError, ModelHTTPError
|
||||
from pydantic_ai.models.openai import OpenAIChatModel
|
||||
from pydantic_ai.models.anthropic import AnthropicModelName
|
||||
from pydantic_ai.models.openai import OpenAIChatModel, OpenAIModelName
|
||||
from pydantic_ai.models.zai import ZaiModel
|
||||
from pydantic_ai.profiles.openai import OpenAIJsonSchemaTransformer
|
||||
|
||||
@@ -25,7 +26,10 @@ from baserow.core.generative_ai.generative_ai_model_types import (
|
||||
XaiGenerativeAIModelType,
|
||||
ZaiGenerativeAIModelType,
|
||||
)
|
||||
from baserow.core.generative_ai.registries import generative_ai_model_type_registry
|
||||
from baserow.core.generative_ai.registries import (
|
||||
generative_ai_model_type_registry,
|
||||
get_known_model_names,
|
||||
)
|
||||
from baserow.core.generative_ai.xai import XAI_BASE_URL, XaiChatProvider
|
||||
from baserow.core.generative_ai.zai import ZaiChatProvider
|
||||
from baserow.test_utils.sentry import make_openai_stream_error, raised_from
|
||||
@@ -55,6 +59,51 @@ def test_google_and_groq_model_types_are_registered():
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("provider_type", "curated_type", "older_model"),
|
||||
[
|
||||
("openai", OpenAIModelName, "gpt-4.1-mini"),
|
||||
("anthropic", AnthropicModelName, "claude-opus-4-5"),
|
||||
],
|
||||
)
|
||||
def test_discovery_appends_older_sdk_models_after_curated_suggestions(
|
||||
provider_type, curated_type, older_model
|
||||
):
|
||||
models = AIProviderHandler.discover_models(provider_type)
|
||||
curated = get_known_model_names(curated_type)
|
||||
|
||||
assert models[: len(curated)] == curated
|
||||
assert older_model in models[len(curated) :]
|
||||
assert len(models) == len(set(models))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("provider_type", "current", "historical"),
|
||||
[
|
||||
("anthropic", "claude-fable-5-2", "claude-sonnet-4-5"),
|
||||
("bedrock", "global.openai.gpt-6.1-terra", "us.amazon.nova-2-lite-v1:0"),
|
||||
("google", "gemini-4-carbon", "gemini-2.5-flash"),
|
||||
("xai", "grok-4.7", "grok-4.6"),
|
||||
("zai", "glm-5.3-flashx", "glm-5.2"),
|
||||
],
|
||||
)
|
||||
def test_discovery_appends_historical_models_once(
|
||||
provider_type, current, historical, monkeypatch
|
||||
):
|
||||
from baserow.core.generative_ai.historical_models import HISTORICAL_CHAT_MODELS
|
||||
|
||||
# A future SDK version can list a historical model again.
|
||||
monkeypatch.setitem(
|
||||
HISTORICAL_CHAT_MODELS,
|
||||
provider_type,
|
||||
[*HISTORICAL_CHAT_MODELS[provider_type], current],
|
||||
)
|
||||
models = AIProviderHandler.discover_models(provider_type)
|
||||
|
||||
assert models.index(current) < models.index(historical)
|
||||
assert len(models) == len(set(models))
|
||||
|
||||
|
||||
def test_openai_supports_files():
|
||||
ai_model_type = OpenAIGenerativeAIModelType()
|
||||
assert ai_model_type.supports_files is True
|
||||
@@ -842,7 +891,7 @@ def test_zai_known_models_exclude_unsuitable_models() -> None:
|
||||
models = ZaiGenerativeAIModelType().get_known_models()
|
||||
|
||||
assert "glm-5.3" in models
|
||||
assert "glm-5.2" in models
|
||||
assert "glm-5.3-flashx" in models
|
||||
assert "glm-4.6v" in models
|
||||
for excluded in (
|
||||
"autoglm-phone-multilingual",
|
||||
@@ -1162,13 +1211,18 @@ def test_bedrock_client_bounds_timeouts_and_retries():
|
||||
assert config.retries == {"mode": "standard", "total_max_attempts": 3}
|
||||
|
||||
|
||||
def test_bedrock_prompt_returns_the_converse_text():
|
||||
def test_bedrock_prompt_returns_streamed_claude_text():
|
||||
client = create_bedrock_runtime_client("eu-central-1", "stored-api-key")
|
||||
stubber = Stubber(client)
|
||||
stubber.add_response("converse", BEDROCK_CONVERSE_RESPONSE)
|
||||
stream = MagicMock()
|
||||
stream.__iter__.return_value = iter(
|
||||
[
|
||||
{"contentBlockDelta": {"contentBlockIndex": 0, "delta": {"text": "Hello"}}},
|
||||
{"messageStop": {"stopReason": "end_turn"}},
|
||||
]
|
||||
)
|
||||
|
||||
with (
|
||||
stubber,
|
||||
patch.object(client, "converse_stream", return_value={"stream": stream}),
|
||||
patch(
|
||||
"baserow.core.generative_ai.bedrock.create_bedrock_runtime_client",
|
||||
return_value=client,
|
||||
@@ -1179,7 +1233,7 @@ def test_bedrock_prompt_returns_the_converse_text():
|
||||
)
|
||||
|
||||
assert result == "Hello"
|
||||
stubber.assert_no_pending_responses()
|
||||
stream.close.assert_called_once_with()
|
||||
|
||||
|
||||
def test_bedrock_caps_temperature_at_one():
|
||||
@@ -1191,7 +1245,7 @@ def test_bedrock_caps_temperature_at_one():
|
||||
def test_bedrock_known_models_exclude_retired_models():
|
||||
models = BedrockGenerativeAIModelType().get_known_models()
|
||||
|
||||
assert "eu.anthropic.claude-sonnet-4-5-20250929-v1:0" in models
|
||||
assert "global.anthropic.claude-fable-5-2" in models
|
||||
assert "us.amazon.nova-pro-v1:0" in models
|
||||
for retired in (
|
||||
"anthropic.claude-v2",
|
||||
@@ -1375,9 +1429,9 @@ def test_bedrock_prompt_sends_prepared_files_as_valid_converse_blocks():
|
||||
),
|
||||
):
|
||||
result = model_type.prompt(
|
||||
BEDROCK_MODEL,
|
||||
"us.amazon.nova-pro-v1:0",
|
||||
"Describe the files",
|
||||
settings_override=_bedrock_settings(),
|
||||
settings_override=_bedrock_settings(models=["us.amazon.nova-pro-v1:0"]),
|
||||
content=[ai_file.content for ai_file in prepared],
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,12 @@ from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
from pydantic_ai import Agent, DeferredToolRequests, ModelRetry
|
||||
from pydantic_ai.messages import ModelResponse, RetryPromptPart, TextPart, ToolCallPart
|
||||
from pydantic_ai.messages import (
|
||||
ModelResponse,
|
||||
RetryFeedbackPart,
|
||||
TextPart,
|
||||
ToolCallPart,
|
||||
)
|
||||
from pydantic_ai.models.function import FunctionModel
|
||||
from pydantic_ai.tools import ToolDefinition
|
||||
|
||||
@@ -110,7 +115,6 @@ def test_printing_a_call_does_not_bypass_deferred_tools(kind):
|
||||
|
||||
def test_the_model_must_issue_a_real_call_after_printing_tool_json():
|
||||
mutations = []
|
||||
retries = []
|
||||
responses = iter(
|
||||
[
|
||||
TextPart('{"name":"create_tables","arguments":{"name":"Projects"}}'),
|
||||
@@ -124,11 +128,6 @@ def test_the_model_must_issue_a_real_call_after_printing_tool_json():
|
||||
return name
|
||||
|
||||
def model(messages, info):
|
||||
retries.extend(
|
||||
part.content
|
||||
for part in messages[-1].parts
|
||||
if isinstance(part, RetryPromptPart)
|
||||
)
|
||||
return ModelResponse(parts=[next(responses)])
|
||||
|
||||
agent = Agent(tools=[create_tables], retries={"output": 2})
|
||||
@@ -138,5 +137,11 @@ def test_the_model_must_issue_a_real_call_after_printing_tool_json():
|
||||
|
||||
assert result.output == "Created Projects."
|
||||
assert mutations == ["Projects"]
|
||||
retries = [
|
||||
part.content
|
||||
for message in result.all_messages()
|
||||
for part in message.parts
|
||||
if isinstance(part, RetryFeedbackPart)
|
||||
]
|
||||
assert len(retries) == 1
|
||||
assert "Use the tool interface" in retries[0]
|
||||
Generated
+34
-32
@@ -51,20 +51,21 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "anthropic"
|
||||
version = "1.13.0"
|
||||
version = "2.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "docstring-parser" },
|
||||
{ name = "httpx2" },
|
||||
{ name = "jiter" },
|
||||
{ name = "opentelemetry-api" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "sniffio" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0b/ed/e76e50601b7c476bcb9a2a7a4c4dab6f1a9b2c03e3922de8b3ec599ccbc5/anthropic-1.13.0.tar.gz", hash = "sha256:ad11d9bb9adafdfea26113943bcde9973e2a439ebeeda6c89ff3e3d85bb2f5c1", size = 1567362, upload-time = "2026-10-09T15:29:08.803Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e1/59/01a1d6c753dad07b2f977e39002f6ada598f3b677dbfdc1f2c8606b5118a/anthropic-2.16.0.tar.gz", hash = "sha256:c6386ded247ae56db35e34a3d828229cf07847934f1cbdc7dbb696b2944b4510", size = 2203841, upload-time = "2026-12-01T16:39:41.986Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/9a/a835340c91bc9a233bd54c05fc438fe07cbef71ca667f24f3892a268ae20/anthropic-1.13.0-py3-none-any.whl", hash = "sha256:157bd74dbf6a595cf9e5fcac557c791fd297924dc48261f57470c2ed6f4e6671", size = 1958595, upload-time = "2026-10-09T15:29:10.689Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/23/f8a12a7c3d6877618b87ec3e86c9dab6948deb67158e9e764507e2db264d/anthropic-2.16.0-py3-none-any.whl", hash = "sha256:fda498e294f8e29cda37862d8cdfa9721dd8ac9489b1c6d5fefadcd6f01d3b33", size = 2873549, upload-time = "2026-12-01T16:39:39.97Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -446,7 +447,7 @@ requires-dist = [
|
||||
{ name = "prosemirror", specifier = "==0.5.2" },
|
||||
{ name = "psutil", specifier = "==7.2.2" },
|
||||
{ name = "psycopg2-binary", specifier = "==2.9.13" },
|
||||
{ name = "pydantic-ai-slim", extras = ["anthropic", "bedrock", "google", "groq", "mistral", "openai", "web-fetch"], specifier = "==2.55.0" },
|
||||
{ name = "pydantic-ai-slim", extras = ["anthropic", "bedrock", "google", "groq", "mistral", "openai", "web-fetch"], specifier = "==2.77.0" },
|
||||
{ name = "pyotp", specifier = "==2.9.0" },
|
||||
{ name = "pysaml2", specifier = "==7.5.5" },
|
||||
{ name = "qrcode", specifier = "==8.2" },
|
||||
@@ -1444,15 +1445,15 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "genai-prices"
|
||||
version = "0.1.9"
|
||||
version = "0.2.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "httpx2" },
|
||||
{ name = "pydantic" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d6/f0/4b4c7f63de6d558714d2207808080dd0988d0317a54ebcde790e4f6c1b6e/genai_prices-0.1.9.tar.gz", hash = "sha256:20ec774d32ec5d345510877fac415f2560bbfeb081bc4cd4e7ebce57a5503e8d", size = 118447, upload-time = "2026-09-25T03:47:27.569Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c9/57/d35f58ac166442f4dd63cf6ace63445fd5bd46eb170241cebd5437b719e6/genai_prices-0.2.5.tar.gz", hash = "sha256:7e3ee897a16a39a1ac1cff328a3f9d839412f6f619028821dcb45b84338f5d3a", size = 166210, upload-time = "2026-11-19T17:55:07.367Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/e0/57d07f653813b7ea9e3a82064a2b6a112f63004530ac665e0934829473c7/genai_prices-0.1.9-py3-none-any.whl", hash = "sha256:3da8faa0a126e4df7be36696b90abe2be1fea8826bfcf45d39d91bc397fa9d1d", size = 125549, upload-time = "2026-09-25T03:47:26.483Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/b7/b72d69ed599146e2a7ca1f484cda17878810205b9ce28fbf5c7a30138fee/genai_prices-0.2.5-py3-none-any.whl", hash = "sha256:864883e3b52031840b8240283c0a3b4ba22315b588e7fe2876025e38194179fc", size = 175874, upload-time = "2026-11-19T17:55:06.117Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1542,7 +1543,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "google-genai"
|
||||
version = "2.25.0"
|
||||
version = "2.34.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
@@ -1556,9 +1557,9 @@ dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "websockets" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/62/0a/a3b7856ca840031d4393dbdd97b67fe811b20061315ed68b67b5c85ca80d/google_genai-2.25.0.tar.gz", hash = "sha256:ab603baa5eee0205926ad0f8d7f93e0400df6d67650e99c33e01ab228ea16ad6", size = 699564, upload-time = "2026-09-22T17:23:01.238Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/22/89/4621aee9cb183efa5b8a187f0e315c49fddcfb8cd7f238b4a3bf4946dcd0/google_genai-2.34.0.tar.gz", hash = "sha256:8e182cf3f73384167b96861cf0aef5102b5070f2db1ea11002879e913806ef37", size = 791853, upload-time = "2026-10-29T06:43:23.706Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/a8/178dbb9d1d6cac721b01592e291146a024bae5ee3224e36569348921dd6c/google_genai-2.25.0-py3-none-any.whl", hash = "sha256:2e8f3a5f76ed00d5ffc3153f6089bc7d3511054eed53ad9cfc6095a7dc59b028", size = 1159631, upload-time = "2026-09-22T17:22:59.291Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2e/42/c24db865d9231b1c672ea26242a4dcf340e200bb1a9823dce4aa9c4c07a4/google_genai-2.34.0-py3-none-any.whl", hash = "sha256:a4cb02aebc4c357f863d2938132f0e3f7967fc5e00b8a4078673f68aad340665", size = 1258155, upload-time = "2026-10-29T06:43:21.121Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1684,15 +1685,15 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "httpcore2"
|
||||
version = "2.12.0"
|
||||
version = "2.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "h11" },
|
||||
{ name = "truststore" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/be/ad/f4f0e57345f1870f3e8cb624e058d7eca6e5a27d33bcc3311d9b618734cd/httpcore2-2.12.0.tar.gz", hash = "sha256:9293522bba0aa7c4c8e9e3f040c16575bd8868e155a77fa30c7a9085a5eae648", size = 67548, upload-time = "2026-08-18T13:22:08.211Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ae/c2/5ceabefc58023fb8d40d16f35e389d6ce1f0641e07852e20b10a17723ada/httpcore2-2.17.0.tar.gz", hash = "sha256:cf652b1f8e892ada4ab189b395c444ca3afbea4cb9a05f9a8359431228c0d040", size = 71463, upload-time = "2026-11-30T15:51:48.882Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d2/74/d370e55600d9bcfa0d9794b0166126d49291a3d2b20c268fc98c453a4948/httpcore2-2.12.0-py3-none-any.whl", hash = "sha256:7e04258ce01013d7d615e5b910a3b27fac937d7a95038227e79652b4ba3b4ceb", size = 83074, upload-time = "2026-08-18T13:22:05.854Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/0b/617a09b1d9c80717d1ab0c48184504504fa39ec784ee070b0f4aa2107f0a/httpcore2-2.17.0-py3-none-any.whl", hash = "sha256:72e3674317e5d6bdfc4ca5ea52e4b05302b0b185f95eecfb7dd9399230c51a6f", size = 86100, upload-time = "2026-11-30T15:51:45.914Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1741,7 +1742,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "httpx2"
|
||||
version = "2.12.0"
|
||||
version = "2.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
@@ -1749,9 +1750,9 @@ dependencies = [
|
||||
{ name = "idna" },
|
||||
{ name = "truststore" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7f/f8/579a8b51e42e38ee32647df9f08aa25643ae788e275cc625b199829c4671/httpx2-2.12.0.tar.gz", hash = "sha256:7631fe9887a8a2275f4a2540e053aa670fcc50742864a9ae7c66e609fdcf12cf", size = 100040, upload-time = "2026-08-18T13:22:09.086Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/65/39/26097287d6ff579ce0e74e5d2e0559bc38cbfe193aa6b816d922ae8ec4c2/httpx2-2.17.0.tar.gz", hash = "sha256:807d9eb393c8d8c20accf33a6a596343dfda6c7cdbcb972ed4163c900dcdf89f", size = 106759, upload-time = "2026-11-30T15:51:50.129Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/95/411ba65569158e862368917aaf56597f3e5fa3b91b0502919638465a08f3/httpx2-2.12.0-py3-none-any.whl", hash = "sha256:cc8b6eecb8661c146b8f89a60e97456ee086e91a784ed31ac450c3a9e613dd36", size = 95427, upload-time = "2026-08-18T13:22:06.834Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/3c/6112b7c372a84a332db85f208ba31fccf9287d6ca67d6107c454e00ba4f3/httpx2-2.17.0-py3-none-any.whl", hash = "sha256:4345a932391496a082b65929f72260dbc9ce5cd2d21bcb28d00f0569935a6eb1", size = 100259, upload-time = "2026-11-30T15:51:47.481Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2281,11 +2282,11 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "mistralai"
|
||||
version = "2.9.2"
|
||||
version = "3.11.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "eval-type-backport" },
|
||||
{ name = "httpx" },
|
||||
{ name = "httpx2" },
|
||||
{ name = "jsonpath-python" },
|
||||
{ name = "opentelemetry-api" },
|
||||
{ name = "opentelemetry-semantic-conventions" },
|
||||
@@ -2293,9 +2294,9 @@ dependencies = [
|
||||
{ name = "python-dateutil" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/50/d9/bc41311a7bd3f34f3aa508329fbaf675482643db7301efba2c3d7cdcc7c6/mistralai-2.9.2.tar.gz", hash = "sha256:50d98863aea6588d825a962aa3684361d1446d9f6f4530028705dac2799603ed", size = 537750, upload-time = "2026-08-11T07:51:17.693Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a9/e5/ee9b76a5dcbbe17bfa755388ecc04cb828734e5448f19ad5e8aebeaa822a/mistralai-3.11.0.tar.gz", hash = "sha256:71404c50ce1381008d9f07fa256d5195bb5115085ec32e20c667efcce78f178e", size = 798337, upload-time = "2026-12-01T21:52:13.16Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/35/cf/3e90441960bfea6559cb6af5d1ca3c6ff9d39866a4fe0d19b4e85cc45786/mistralai-2.9.2-py3-none-any.whl", hash = "sha256:9d90b85b25c409e50aabe150350aa680f71e0803c0273d177a0379912f73bc45", size = 1282115, upload-time = "2026-08-11T07:51:16.005Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/61/54/c6561a47ea082ac3b43f14bed3da94c56760a02e974388fb3bc2b4d59ea4/mistralai-3.11.0-py3-none-any.whl", hash = "sha256:979d7136fb78fcfd63d30468af7af373bb9c6902ec6dd5e1ff069168a2de32c1", size = 1954923, upload-time = "2026-12-01T21:52:11.314Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2401,7 +2402,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "openai"
|
||||
version = "3.28.0"
|
||||
version = "3.62.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
@@ -2411,9 +2412,9 @@ dependencies = [
|
||||
{ name = "sniffio" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b7/a3/3b5576af9c4b8cb7eef1383d33c48a9431b292983fe4b78cbffb31d0aeeb/openai-3.28.0.tar.gz", hash = "sha256:cf0509d32d7bd8eb6a3db02417957cb455212b6629d071826b9ea1f61659e2a4", size = 1827445, upload-time = "2026-10-09T20:50:14.477Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0e/09/8a37514fb228f011d1f579ee6b43d80444fefbdd73c2927c9f7393f56fe2/openai-3.62.2.tar.gz", hash = "sha256:5e8e1dcfd6155fb045d6405f7c6f915a261fd23b54c08dcf27932074244e1eac", size = 2419656, upload-time = "2026-12-02T02:36:01.734Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/4a/5c807ade1a86ab8accad20dc993ca7de5d1f7b2e78d4674c300c2e6a47b9/openai-3.28.0-py3-none-any.whl", hash = "sha256:1ea40a084ffe2f9f16fd3bea6e870f757853b536b18d8e737c518ef849a2920c", size = 2171532, upload-time = "2026-10-09T20:50:12.282Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/0f/a81140aca413b216edd62df525b35a876b51e2ecbb4da3cee916f47dcac3/openai-3.62.2-py3-none-any.whl", hash = "sha256:8b8cc1e3f7455c2df34372fa2762d00ea87b86dadfd9799ae32124a3e74b9f2f", size = 2482929, upload-time = "2026-12-02T02:35:59.356Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3178,7 +3179,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-ai-slim"
|
||||
version = "2.55.0"
|
||||
version = "2.77.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
@@ -3188,11 +3189,12 @@ dependencies = [
|
||||
{ name = "opentelemetry-api" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "pydantic-graph" },
|
||||
{ name = "truststore" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9c/d6/3526056afb236ac3c01b07ae05f1fefc97cbee59f8e824b96ffd5405bbfe/pydantic_ai_slim-2.55.0.tar.gz", hash = "sha256:50b5ee70d3a0509c1f36bec759249e69f4dc060f1a816b1bbf0730af54297376", size = 1878726, upload-time = "2026-10-09T19:40:52.951Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/dd/48/1d2e9e5581b6f84ca86ede7bd735cd870cdc7f03af7dca581c386449ac94/pydantic_ai_slim-2.77.0.tar.gz", hash = "sha256:28ae793fb801145d97f7c7ea8e060b26e313f59e6d0972caaa147fe27827a6c0", size = 2920936, upload-time = "2026-11-28T00:01:42.376Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/93/cc/16c6bc21748e3705a4c1f8e7d71dfc54228dbf142f8506a36689acb1e9c9/pydantic_ai_slim-2.55.0-py3-none-any.whl", hash = "sha256:7fcea628e78c2f247af94504534f0577151496166998d74ec145505040b19c68", size = 2197589, upload-time = "2026-10-09T19:40:38.767Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/05/05f6406a6aad9ca19f7daf13ec2e313063e5fea0ac60bc29e5fb3651fa23/pydantic_ai_slim-2.77.0-py3-none-any.whl", hash = "sha256:83642b33f343a4ee170cb986336226d18ab0b0da37581d76f8169b2c10e32a9d", size = 3336285, upload-time = "2026-11-28T00:01:30.054Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
@@ -3254,7 +3256,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-graph"
|
||||
version = "2.55.0"
|
||||
version = "2.77.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
@@ -3262,9 +3264,9 @@ dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b2/22/4e25465059448c4322e5f53f33e7b25ceb404c2d4dda8cfb0f497f7fb54b/pydantic_graph-2.55.0.tar.gz", hash = "sha256:461de7d0c33af634c3adeb21712f527f15878edf826d216184f024795e9c80c1", size = 45824, upload-time = "2026-10-09T19:40:57.238Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/93/1d/d8dd6e135ea68a1b947698fb22c53b4ee4ab1be3010f75d13c578a199076/pydantic_graph-2.77.0.tar.gz", hash = "sha256:429439970c0f39105e9745e0b587860f5197cafe29bc54a5209a0016c63e299e", size = 47818, upload-time = "2026-11-28T00:01:45.719Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/59/b5/630fc830897cfb0e458dea8ffcac5dd58791784220255637e99817b04cdd/pydantic_graph-2.55.0-py3-none-any.whl", hash = "sha256:774a64db707e759e22a4b2d6f8849986331fac009bb3f36ba3ed0cb8eee7a150", size = 53274, upload-time = "2026-10-09T19:40:44.876Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/96/29ca660d7163d6b57608d554fbb99d21c039b28aa3b823fafa0a08d7aec7/pydantic_graph-2.77.0-py3-none-any.whl", hash = "sha256:af69635b0d2efdbe947a146b46a2b258a8ec9f9a877d27609ffdf7311c16cc11", size = 54953, upload-time = "2026-11-28T00:01:35.587Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4123,11 +4125,11 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "truststore"
|
||||
version = "0.10.4"
|
||||
version = "0.10.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/53/a3/1585216310e344e8102c22482f6060c7a6ea0322b63e026372e6dcefcfd6/truststore-0.10.4.tar.gz", hash = "sha256:9d91bd436463ad5e4ee4aba766628dd6cd7010cf3e2461756b3303710eebc301", size = 26169, upload-time = "2025-08-12T18:49:02.73Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ee/9f/c5201d42a484c061e528825fc8e2d565f5abd50a4ced6fb7d29c4ec99b2b/truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd", size = 28091, upload-time = "2026-10-12T22:27:31.808Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/19/97/56608b2249fe206a67cd573bc93cd9896e1efb9e98bce9c163bcdc704b88/truststore-0.10.4-py3-none-any.whl", hash = "sha256:adaeaecf1cbb5f4de3b1959b42d41f6fab57b2b1666adb59e89cb0b53361d981", size = 18660, upload-time = "2025-08-12T18:49:01.46Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/e9/3a7820be2bb0fe53b6bc9c3be26d3d1158004e4c3ab953aa6840b955b1e9/truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c", size = 19017, upload-time = "2026-10-12T22:27:30.377Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"type": "feature",
|
||||
"message": "Choose newer models such as GPT-6.2, Claude Fable 5.2, Gemini 4 and Grok 4.7 when configuring AI providers. You can still enter an older model by name if your provider supports it.",
|
||||
"issue_origin": "github",
|
||||
"issue_number": null,
|
||||
"domain": "core",
|
||||
"bullet_points": [],
|
||||
"created_at": "2026-12-02"
|
||||
}
|
||||
@@ -16,6 +16,10 @@ Agent actions in the Application Builder and Automations, and the Kuma assistant
|
||||
Each page allows one provider per type: one OpenAI, one Anthropic, and so on. Other
|
||||
users see changes made in **Admin tools → AI providers** after they reload the page.
|
||||
|
||||
For providers with a catalog, the model picker suggests recent models first and
|
||||
also lets you search for older chat models. You can enter any model ID your
|
||||
provider supports. Updating the catalog preserves your saved selections.
|
||||
|
||||
For every model you add, choose which features may use it under **Available for**,
|
||||
and use **Test model** before selecting it anywhere. A model that is not available
|
||||
for a feature does not appear in that feature's model list.
|
||||
|
||||
@@ -123,7 +123,7 @@ def _returned_executions(
|
||||
pending_call = pending_calls.pop(part.tool_call_id, None)
|
||||
if pending_call is None:
|
||||
continue
|
||||
if is_mode_redirect(part.content):
|
||||
if part.outcome == "retried" or is_mode_redirect(part.content):
|
||||
continue
|
||||
tool_name, arguments = pending_call
|
||||
yield _ToolExecution(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
|
||||
from pydantic_ai import Agent, RunContext
|
||||
from pydantic_ai.messages import RetryPromptPart, ToolReturnPart, UserPromptPart
|
||||
from pydantic_ai.messages import ToolReturnPart, UserPromptPart
|
||||
|
||||
from baserow_enterprise.assistant.deps import AssistantDeps
|
||||
from baserow_enterprise.assistant.output_validation import validate_final_answer
|
||||
@@ -68,12 +68,12 @@ def dynamic_pending_mode_calls(ctx: RunContext[AssistantDeps]) -> str:
|
||||
if isinstance(part, UserPromptPart):
|
||||
pending.clear()
|
||||
elif (
|
||||
isinstance(part, (RetryPromptPart, ToolReturnPart))
|
||||
isinstance(part, ToolReturnPart)
|
||||
and is_mode_redirect(part.content)
|
||||
and part.tool_name
|
||||
):
|
||||
pending.add(part.tool_name)
|
||||
elif isinstance(part, ToolReturnPart):
|
||||
elif isinstance(part, ToolReturnPart) and part.outcome != "retried":
|
||||
pending.discard(part.tool_name)
|
||||
if not pending:
|
||||
return ""
|
||||
|
||||
@@ -17,7 +17,12 @@ from django.test import override_settings
|
||||
from pydantic_ai import Agent
|
||||
from pydantic_ai._utils import run_until_complete # noqa: PLC2701
|
||||
from pydantic_ai.exceptions import UnexpectedModelBehavior, UsageLimitExceeded
|
||||
from pydantic_ai.messages import ModelRequest, ModelResponse, RetryPromptPart
|
||||
from pydantic_ai.messages import (
|
||||
ModelRequest,
|
||||
ModelResponse,
|
||||
ToolReturnPart,
|
||||
is_retry,
|
||||
)
|
||||
from pydantic_ai.models import Model
|
||||
from pydantic_ai.tool_manager import ToolManager
|
||||
from pydantic_ai.usage import UsageLimits
|
||||
@@ -114,6 +119,7 @@ def format_message_history(result: Any) -> list[dict]:
|
||||
- content: text content (if any)
|
||||
- tool_calls: list of tool call info (if any)
|
||||
- tool_name: name of tool that returned this result (for tool results)
|
||||
- outcome: the SDK outcome for a tool return
|
||||
- timestamp: message timestamp (if available)
|
||||
"""
|
||||
messages = getattr(result, "all_messages", lambda: [])() or []
|
||||
@@ -133,6 +139,8 @@ def format_message_history(result: Any) -> list[dict]:
|
||||
entry["tool_call_id"] = part.tool_call_id
|
||||
if hasattr(part, "timestamp"):
|
||||
entry["timestamp"] = str(part.timestamp)
|
||||
if isinstance(part, ToolReturnPart):
|
||||
entry["outcome"] = part.outcome
|
||||
|
||||
formatted.append(entry)
|
||||
|
||||
@@ -182,7 +190,7 @@ def count_tool_errors(result: Any) -> tuple[int, str]:
|
||||
"""
|
||||
Count tool validation errors in the agent result.
|
||||
|
||||
Inspects the pydantic-ai message history for ``RetryPromptPart`` entries,
|
||||
Inspects the pydantic-ai message history for retry feedback and retried tool calls,
|
||||
which indicate the LLM sent invalid arguments that failed pydantic
|
||||
validation. Unknown-tool exploration, calls refused until tool search reveals
|
||||
the tool, and mode-switch redirects are excluded: the model recovers from
|
||||
@@ -198,22 +206,19 @@ def count_tool_errors(result: Any) -> tuple[int, str]:
|
||||
for msg in messages:
|
||||
if isinstance(msg, ModelRequest):
|
||||
for part in msg.parts:
|
||||
if isinstance(part, RetryPromptPart):
|
||||
content = str(part.content)
|
||||
if (
|
||||
"Unknown tool name" in content
|
||||
or "is not available yet" in content
|
||||
or is_mode_redirect(content)
|
||||
):
|
||||
if is_retry(part):
|
||||
if part.retry is not None and part.retry.cause in {
|
||||
"unknown_tool",
|
||||
"unavailable_tool",
|
||||
"no_output",
|
||||
}:
|
||||
continue
|
||||
# pydantic-ai's nudge after an empty model response, which it
|
||||
# recovers from on its own — not a tool failure.
|
||||
if part.tool_name is None and content.startswith("Please "):
|
||||
if is_mode_redirect(part.content):
|
||||
continue
|
||||
retry_errors.append(
|
||||
{
|
||||
"tool_name": getattr(part, "tool_name", None),
|
||||
"content": content,
|
||||
"content": str(part.content),
|
||||
}
|
||||
)
|
||||
hint = "\n".join(f" - {e['tool_name']}: {e['content']}" for e in retry_errors)
|
||||
|
||||
@@ -12,7 +12,6 @@ from pydantic_ai import Agent, ModelRetry, RunContext, Tool
|
||||
from pydantic_ai.agent import AgentRunResult
|
||||
from pydantic_ai.messages import (
|
||||
ModelMessage,
|
||||
RetryPromptPart,
|
||||
ToolCallPart,
|
||||
ToolReturnPart,
|
||||
)
|
||||
@@ -120,8 +119,7 @@ def _formula_attempts(
|
||||
Split the formulas passed to get_formula_type during a run into accepted and
|
||||
rejected.
|
||||
|
||||
A rejection reaches the model as a RetryPromptPart and an acceptance as a
|
||||
ToolReturnPart, so the two sets are the run's own record of what was checked.
|
||||
Tool return outcomes record which formulas passed validation or need a retry.
|
||||
|
||||
:param messages: The run's message history.
|
||||
:returns: Exact accepted (table ID, field name, formula) tuples, and normalized
|
||||
@@ -140,9 +138,9 @@ def _formula_attempts(
|
||||
formula = args.get("formula")
|
||||
if isinstance(formula, str) and formula.strip():
|
||||
attempted[part.tool_call_id] = args
|
||||
elif isinstance(part, RetryPromptPart):
|
||||
elif isinstance(part, ToolReturnPart) and part.outcome == "retried":
|
||||
rejected_ids.add(part.tool_call_id)
|
||||
elif isinstance(part, ToolReturnPart):
|
||||
elif isinstance(part, ToolReturnPart) and part.outcome == "success":
|
||||
accepted_ids.add(part.tool_call_id)
|
||||
|
||||
# History retains raw arguments, including numeric strings the tool coerced.
|
||||
|
||||
+3
-3
@@ -6,7 +6,6 @@ import pytest
|
||||
from pydantic_ai.messages import (
|
||||
ModelRequest,
|
||||
ModelResponse,
|
||||
RetryPromptPart,
|
||||
ToolCallPart,
|
||||
ToolReturnPart,
|
||||
)
|
||||
@@ -32,8 +31,9 @@ def _output(workflow, rejected_first=True):
|
||||
),
|
||||
ModelRequest(
|
||||
parts=[
|
||||
RetryPromptPart(
|
||||
"Invalid nodes",
|
||||
ToolReturnPart(
|
||||
content="Invalid nodes",
|
||||
outcome="retried",
|
||||
tool_name="create_workflows",
|
||||
tool_call_id="rejected",
|
||||
)
|
||||
|
||||
+45
-23
@@ -19,9 +19,12 @@ from pydantic_ai.exceptions import (
|
||||
from pydantic_ai.messages import (
|
||||
ModelRequest,
|
||||
ModelResponse,
|
||||
RetryPromptPart,
|
||||
RetryFeedbackPart,
|
||||
RetryInfo,
|
||||
TextPart,
|
||||
ToolCallPart,
|
||||
ToolReturnPart,
|
||||
is_retry,
|
||||
)
|
||||
from pydantic_ai.models.function import FunctionModel
|
||||
from pydantic_ai.models.test import TestModel
|
||||
@@ -136,17 +139,22 @@ def test_mode_redirect_is_not_counted_as_a_failed_tool_call():
|
||||
all_messages=lambda: [
|
||||
ModelRequest(
|
||||
parts=[
|
||||
RetryPromptPart(
|
||||
ToolReturnPart(
|
||||
outcome="retried",
|
||||
content=mode_redirect_message(
|
||||
"create_workflows", AgentMode.AUTOMATION
|
||||
),
|
||||
tool_name="create_workflows",
|
||||
),
|
||||
RetryPromptPart(
|
||||
ToolReturnPart(
|
||||
outcome="retried",
|
||||
content="Missing required workflow name",
|
||||
tool_name="create_workflows",
|
||||
),
|
||||
RetryPromptPart(content="An unsupported completion claim"),
|
||||
RetryFeedbackPart(
|
||||
"An unsupported completion claim",
|
||||
retry=RetryInfo(cause="model_retry"),
|
||||
),
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -184,11 +192,17 @@ def test_refused_call_to_an_unrevealed_tool_is_not_counted_as_a_failed_tool_call
|
||||
)
|
||||
|
||||
assert any(
|
||||
isinstance(part, RetryPromptPart) and "not available yet" in str(part.content)
|
||||
is_retry(part) and part.retry and part.retry.cause == "unavailable_tool"
|
||||
for message in result.all_messages()
|
||||
for part in message.parts
|
||||
)
|
||||
assert count_tool_errors(result) == (0, "")
|
||||
assert [
|
||||
entry["outcome"]
|
||||
for entry in harness.format_message_history(result)
|
||||
if entry["type"] == "ToolReturnPart"
|
||||
and entry["tool_name"] == "create_workflows"
|
||||
] == ["retried", "success"]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -356,18 +370,19 @@ class TestAskUserTool:
|
||||
class TestCountToolErrors:
|
||||
def test_empty_response_retry_is_not_a_tool_error(self):
|
||||
"""pydantic-ai nudges the model after an empty response with a
|
||||
tool_name-less RetryPromptPart; it recovers on its own, so it must not
|
||||
no-output retry; it recovers on its own, so it must not
|
||||
spend the case's tool-error budget."""
|
||||
|
||||
from pydantic_ai.messages import ModelRequest, RetryPromptPart
|
||||
|
||||
from baserow_enterprise.assistant.evals.harness import count_tool_errors
|
||||
|
||||
result = SimpleNamespace(
|
||||
all_messages=lambda: [
|
||||
ModelRequest(
|
||||
parts=[
|
||||
RetryPromptPart(content="Please return text or call a tool.")
|
||||
RetryFeedbackPart(
|
||||
"Please return text or call a tool.",
|
||||
retry=RetryInfo(cause="no_output"),
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -375,18 +390,26 @@ class TestCountToolErrors:
|
||||
|
||||
assert count_tool_errors(result) == (0, "")
|
||||
|
||||
def test_real_tool_validation_error_still_counts(self):
|
||||
from pydantic_ai.messages import ModelRequest, RetryPromptPart
|
||||
|
||||
from baserow_enterprise.assistant.evals.harness import count_tool_errors
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("cause", "content", "expected_count"),
|
||||
[
|
||||
("unknown_tool", "Choose another tool", 0),
|
||||
("unavailable_tool", "Search before calling this tool", 0),
|
||||
("validation_error", "Invalid field value: Unknown tool name", 1),
|
||||
],
|
||||
)
|
||||
def test_tool_errors_are_classified_by_retry_cause(
|
||||
self, cause, content, expected_count
|
||||
):
|
||||
result = SimpleNamespace(
|
||||
all_messages=lambda: [
|
||||
ModelRequest(
|
||||
parts=[
|
||||
RetryPromptPart(
|
||||
content="update_row requires row_id",
|
||||
ToolReturnPart(
|
||||
outcome="retried",
|
||||
content=content,
|
||||
tool_name="create_workflows",
|
||||
retry=RetryInfo(cause=cause),
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -394,14 +417,12 @@ class TestCountToolErrors:
|
||||
)
|
||||
|
||||
count, hint = count_tool_errors(result)
|
||||
assert count == 1
|
||||
assert "create_workflows" in hint
|
||||
assert count == expected_count
|
||||
assert hint == (f" - create_workflows: {content}" if expected_count else "")
|
||||
|
||||
def test_router_redirect_is_recognised_from_the_router_itself(self):
|
||||
"""The harness must not carry its own copy of the redirect wording."""
|
||||
|
||||
from pydantic_ai.messages import ModelRequest, RetryPromptPart
|
||||
|
||||
from baserow_enterprise.assistant.evals.harness import count_tool_errors
|
||||
from baserow_enterprise.assistant.tools.routing import mode_redirect_message
|
||||
|
||||
@@ -409,7 +430,8 @@ class TestCountToolErrors:
|
||||
all_messages=lambda: [
|
||||
ModelRequest(
|
||||
parts=[
|
||||
RetryPromptPart(
|
||||
ToolReturnPart(
|
||||
outcome="retried",
|
||||
content=mode_redirect_message(
|
||||
"create_workflows", AgentMode.AUTOMATION
|
||||
),
|
||||
@@ -453,7 +475,7 @@ class TestExecutedToolCalls:
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"type": "RetryPromptPart",
|
||||
"type": "ToolReturnPart",
|
||||
"tool_name": "create_workflows",
|
||||
"tool_call_id": "deferred",
|
||||
"content": mode_redirect_message(
|
||||
@@ -488,7 +510,7 @@ class TestExecutedToolCalls:
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"type": "RetryPromptPart",
|
||||
"type": "ToolReturnPart",
|
||||
"tool_name": "create_workflows",
|
||||
"tool_call_id": "only",
|
||||
"content": "workflows must not be empty",
|
||||
|
||||
@@ -23,7 +23,7 @@ from pydantic_ai.messages import (
|
||||
ModelResponse,
|
||||
PartDeltaEvent,
|
||||
PartStartEvent,
|
||||
RetryPromptPart,
|
||||
RetryFeedbackPart,
|
||||
TextPart,
|
||||
TextPartDelta,
|
||||
ThinkingPart,
|
||||
@@ -507,6 +507,25 @@ class TestCompactMessageHistory:
|
||||
)
|
||||
assert get_verified_tool_outcomes(next_cycle) == outcomes
|
||||
|
||||
def test_retried_call_in_saved_history_does_not_record_a_mutation(self):
|
||||
legacy_retry = {
|
||||
"part_kind": "retry-prompt",
|
||||
"tool_name": "create_tables",
|
||||
"content": "Missing table name",
|
||||
"tool_call_id": "c1",
|
||||
}
|
||||
messages = ModelMessagesTypeAdapter.validate_python(
|
||||
[
|
||||
ModelRequest(parts=[UserPromptPart("Create a table")]),
|
||||
ModelResponse(parts=[ToolCallPart("create_tables", {}, "c1")]),
|
||||
{"kind": "request", "parts": [legacy_retry]},
|
||||
ModelResponse(parts=[TextPart("What name should I use?")]),
|
||||
]
|
||||
)
|
||||
|
||||
assert messages[2].parts[0].outcome == "retried"
|
||||
assert get_verified_tool_outcomes(compact_message_history(messages)) == []
|
||||
|
||||
def test_remembers_failed_mutations_as_incomplete_work(self):
|
||||
messages = [
|
||||
ModelRequest(parts=[UserPromptPart(content="create it")]),
|
||||
@@ -1449,7 +1468,8 @@ def test_rejected_answer_candidate_is_cleared_before_retry_thinking(
|
||||
|
||||
async def stream(messages, info):
|
||||
retried = any(
|
||||
isinstance(part, RetryPromptPart)
|
||||
isinstance(part, UserPromptPart)
|
||||
and "tool call printed as text" in part.content
|
||||
for message in messages
|
||||
if isinstance(message, ModelRequest)
|
||||
for part in message.parts
|
||||
@@ -2072,15 +2092,9 @@ class TestFinalAnswerValidation:
|
||||
def update_element(page_id: int, element: dict[str, Any], thought: str) -> str:
|
||||
return "Updated."
|
||||
|
||||
retries: list[str] = []
|
||||
answers = iter([answer, "The Editar column is the last column of the table."])
|
||||
|
||||
def model(messages: list[ModelMessage], info: AgentInfo) -> ModelResponse:
|
||||
retries.extend(
|
||||
part.content
|
||||
for part in messages[-1].parts
|
||||
if isinstance(part, RetryPromptPart)
|
||||
)
|
||||
return ModelResponse(parts=[TextPart(content=next(answers))])
|
||||
|
||||
result = main_agent.run_sync(
|
||||
@@ -2093,6 +2107,12 @@ class TestFinalAnswerValidation:
|
||||
model=FunctionModel(model),
|
||||
toolsets=[FunctionToolset(tools=[update_element])],
|
||||
)
|
||||
retries = [
|
||||
part.content
|
||||
for message in result.all_messages()
|
||||
for part in message.parts
|
||||
if isinstance(part, RetryFeedbackPart)
|
||||
]
|
||||
return retries, result.output
|
||||
|
||||
def test_tool_call_printed_as_text_gets_the_corrected_call(self) -> None:
|
||||
|
||||
+3
-3
@@ -12,7 +12,6 @@ import pytest
|
||||
from pydantic_ai import ModelRetry
|
||||
from pydantic_ai.messages import (
|
||||
ModelResponse,
|
||||
RetryPromptPart,
|
||||
ToolCallPart,
|
||||
ToolReturnPart,
|
||||
)
|
||||
@@ -264,8 +263,9 @@ def _tool_call(call_id: str, formula: str) -> ToolCallPart:
|
||||
)
|
||||
|
||||
|
||||
def _rejection(call_id: str) -> RetryPromptPart:
|
||||
return RetryPromptPart(
|
||||
def _rejection(call_id: str) -> ToolReturnPart:
|
||||
return ToolReturnPart(
|
||||
outcome="retried",
|
||||
content="Invalid formula",
|
||||
tool_name=GET_FORMULA_TYPE_TOOL_NAME,
|
||||
tool_call_id=call_id,
|
||||
|
||||
+2
-4
@@ -8,7 +8,7 @@ from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from pydantic_ai.messages import ModelResponse, RetryPromptPart, ToolCallPart
|
||||
from pydantic_ai.messages import ModelResponse, ToolCallPart, is_retry
|
||||
from pydantic_ai.models.function import FunctionModel
|
||||
|
||||
from baserow.contrib.integrations.local_baserow.models import (
|
||||
@@ -247,9 +247,7 @@ def test_invalid_answer_is_sent_back_to_the_agent(builder_setup, monkeypatch):
|
||||
)
|
||||
|
||||
assert result.changed is True
|
||||
retry = [
|
||||
part for part in received[1][-1].parts if isinstance(part, RetryPromptPart)
|
||||
]
|
||||
retry = [part for part in received[1][-1].parts if is_retry(part)]
|
||||
assert "invalid select option id(s)" in str(retry[0].content)
|
||||
assert persisted_filters(s.data_source.service) == [
|
||||
(s.status.id, "single_select_equal", str(s.done_option.id), "raw", None),
|
||||
|
||||
+3
-4
@@ -296,10 +296,9 @@ def test_model_can_search_and_create_an_automation_from_database_mode(
|
||||
if len(requests) == 2:
|
||||
assert visible["create_automation"].defer_loading
|
||||
return ModelResponse(parts=[call])
|
||||
last = messages[-1].parts[-1]
|
||||
assert isinstance(last, ToolReturnPart)
|
||||
assert last.tool_name == "create_automation"
|
||||
assert last.content["created_builders"][0]["name"] == "Order flow"
|
||||
(result,) = [p for p in messages[-1].parts if isinstance(p, ToolReturnPart)]
|
||||
assert result.tool_name == "create_automation"
|
||||
assert result.content["created_builders"][0]["name"] == "Order flow"
|
||||
return ModelResponse(parts=[TextPart(content="done")])
|
||||
|
||||
gpt_oss = GroqModel(
|
||||
|
||||
Reference in new issue
Block a user