Skip to content

Commit ef80e23

Browse files
Remove stale name methods from openai and mistral models (#925)
1 parent 2ec49b8 commit ef80e23

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

pydantic_ai_slim/pydantic_ai/models/mistral.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ def __init__(
134134
api_key = os.getenv('MISTRAL_API_KEY') if api_key is None else api_key
135135
self.client = Mistral(api_key=api_key, async_client=http_client or cached_async_http_client())
136136

137-
def name(self) -> str:
138-
return f'mistral:{self._model_name}'
139-
140137
async def request(
141138
self,
142139
messages: list[ModelMessage],

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ def __init__(
135135
self.system_prompt_role = system_prompt_role
136136
self._system = system
137137

138-
def name(self) -> str:
139-
return f'openai:{self._model_name}'
140-
141138
async def request(
142139
self,
143140
messages: list[ModelMessage],

tests/models/test_mistral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def func_chunk(
176176

177177
def test_init():
178178
m = MistralModel('mistral-large-latest', api_key='foobar')
179-
assert m.name() == 'mistral:mistral-large-latest'
179+
assert m.model_name == 'mistral-large-latest'
180180

181181

182182
#####################

tests/models/test_openai.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@ def test_init():
5454
m = OpenAIModel('gpt-4o', api_key='foobar')
5555
assert str(m.client.base_url) == 'https://api.openai.com/v1/'
5656
assert m.client.api_key == 'foobar'
57-
assert m.name() == 'openai:gpt-4o'
57+
assert m.model_name == 'gpt-4o'
5858

5959

6060
def test_init_with_base_url():
6161
m = OpenAIModel('gpt-4o', base_url='https://example.com/v1', api_key='foobar')
6262
assert str(m.client.base_url) == 'https://example.com/v1/'
6363
assert m.client.api_key == 'foobar'
64-
assert m.name() == 'openai:gpt-4o'
65-
m.name()
64+
assert m.model_name == 'gpt-4o'
6665

6766

6867
def test_init_with_no_api_key_will_still_setup_client():
@@ -72,7 +71,7 @@ def test_init_with_no_api_key_will_still_setup_client():
7271

7372
def test_init_with_non_openai_model():
7473
m = OpenAIModel('llama3.2-vision:latest', base_url='https://example.com/v1/')
75-
m.name()
74+
assert m.model_name == 'llama3.2-vision:latest'
7675

7776

7877
def test_init_of_openai_without_api_key_raises_error(env: TestEnv):

0 commit comments

Comments
 (0)