File tree Expand file tree Collapse file tree 4 files changed +4
-11
lines changed
pydantic_ai_slim/pydantic_ai/models Expand file tree Collapse file tree 4 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,6 @@ def __init__(
134
134
api_key = os .getenv ('MISTRAL_API_KEY' ) if api_key is None else api_key
135
135
self .client = Mistral (api_key = api_key , async_client = http_client or cached_async_http_client ())
136
136
137
- def name (self ) -> str :
138
- return f'mistral:{ self ._model_name } '
139
-
140
137
async def request (
141
138
self ,
142
139
messages : list [ModelMessage ],
Original file line number Diff line number Diff line change @@ -135,9 +135,6 @@ def __init__(
135
135
self .system_prompt_role = system_prompt_role
136
136
self ._system = system
137
137
138
- def name (self ) -> str :
139
- return f'openai:{ self ._model_name } '
140
-
141
138
async def request (
142
139
self ,
143
140
messages : list [ModelMessage ],
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ def func_chunk(
176
176
177
177
def test_init ():
178
178
m = MistralModel ('mistral-large-latest' , api_key = 'foobar' )
179
- assert m .name () == 'mistral: mistral-large-latest'
179
+ assert m .model_name == 'mistral-large-latest'
180
180
181
181
182
182
#####################
Original file line number Diff line number Diff line change @@ -54,15 +54,14 @@ def test_init():
54
54
m = OpenAIModel ('gpt-4o' , api_key = 'foobar' )
55
55
assert str (m .client .base_url ) == 'https://api.openai.com/v1/'
56
56
assert m .client .api_key == 'foobar'
57
- assert m .name () == 'openai: gpt-4o'
57
+ assert m .model_name == 'gpt-4o'
58
58
59
59
60
60
def test_init_with_base_url ():
61
61
m = OpenAIModel ('gpt-4o' , base_url = 'https://example.com/v1' , api_key = 'foobar' )
62
62
assert str (m .client .base_url ) == 'https://example.com/v1/'
63
63
assert m .client .api_key == 'foobar'
64
- assert m .name () == 'openai:gpt-4o'
65
- m .name ()
64
+ assert m .model_name == 'gpt-4o'
66
65
67
66
68
67
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():
72
71
73
72
def test_init_with_non_openai_model ():
74
73
m = OpenAIModel ('llama3.2-vision:latest' , base_url = 'https://example.com/v1/' )
75
- m . name ()
74
+ assert m . model_name == 'llama3.2-vision:latest'
76
75
77
76
78
77
def test_init_of_openai_without_api_key_raises_error (env : TestEnv ):
You can’t perform that action at this time.
0 commit comments