Skip to content

Commit 7e1c180

Browse files
committed
Fix tests fails for new cohere version
1 parent 8c32055 commit 7e1c180

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

pydantic_ai_slim/pydantic_ai/models/cohere.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
ChatMessageV2,
4141
ChatResponse,
4242
SystemChatMessageV2,
43-
TextAssistantMessageContentItem,
43+
TextAssistantMessageV2ContentItem,
4444
ToolCallV2,
4545
ToolCallV2Function,
4646
ToolChatMessageV2,
@@ -111,7 +111,6 @@ def __init__(
111111
*,
112112
provider: Literal['cohere'] | Provider[AsyncClientV2] = 'cohere',
113113
profile: ModelProfileSpec | None = None,
114-
settings: ModelSettings | None = None,
115114
):
116115
"""Initialize an Cohere model.
117116
@@ -122,15 +121,13 @@ def __init__(
122121
'cohere' or an instance of `Provider[AsyncClientV2]`. If not provided, a new provider will be
123122
created using the other parameters.
124123
profile: The model profile to use. Defaults to a profile picked by the provider based on the model name.
125-
settings: Model-specific settings that will be used as defaults for this model.
126124
"""
127125
self._model_name = model_name
128126

129127
if isinstance(provider, str):
130128
provider = infer_provider(provider)
131129
self.client = provider.client
132-
133-
super().__init__(settings=settings, profile=profile or provider.model_profile)
130+
self._profile = profile or provider.model_profile
134131

135132
@property
136133
def base_url(self) -> str:
@@ -227,7 +224,7 @@ def _map_messages(self, messages: list[ModelMessage]) -> list[ChatMessageV2]:
227224
assert_never(item)
228225
message_param = AssistantChatMessageV2(role='assistant')
229226
if texts:
230-
message_param.content = [TextAssistantMessageContentItem(text='\n\n'.join(texts))]
227+
message_param.content = [TextAssistantMessageV2ContentItem(text='\n\n'.join(texts))]
231228
if tool_calls:
232229
message_param.tool_calls = tool_calls
233230
cohere_messages.append(message_param)

pydantic_ai_slim/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ dependencies = [
6262
logfire = ["logfire>=3.11.0"]
6363
# Models
6464
openai = ["openai>=1.86.0"]
65-
cohere = ["cohere>=5.13.11; platform_system != 'Emscripten'"]
65+
cohere = ["cohere>=5.16.0; platform_system != 'Emscripten'"]
6666
vertexai = ["google-auth>=2.36.0", "requests>=2.32.2"]
6767
google = ["google-genai>=1.24.0"]
6868
anthropic = ["anthropic>=0.52.0"]

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)