@@ -12,8 +12,8 @@ def td() -> TestData:
12
12
td .flag ('model-config' )
13
13
.variations (
14
14
{
15
- 'model' : {'id ' : 'fakeModel' , 'parameters' : {'temperature' : 0.5 , 'maxTokens' : 4096 }, 'custom' : {'extra-attribute' : 'value' }},
16
- 'provider' : {'id ' : 'fakeProvider' },
15
+ 'model' : {'name ' : 'fakeModel' , 'parameters' : {'temperature' : 0.5 , 'maxTokens' : 4096 }, 'custom' : {'extra-attribute' : 'value' }},
16
+ 'provider' : {'name ' : 'fakeProvider' },
17
17
'messages' : [{'role' : 'system' , 'content' : 'Hello, {{name}}!' }],
18
18
'_ldMeta' : {'enabled' : True , 'versionKey' : 'abcd' },
19
19
},
@@ -26,7 +26,7 @@ def td() -> TestData:
26
26
td .flag ('multiple-messages' )
27
27
.variations (
28
28
{
29
- 'model' : {'id ' : 'fakeModel' , 'parameters' : {'temperature' : 0.7 , 'maxTokens' : 8192 }},
29
+ 'model' : {'name ' : 'fakeModel' , 'parameters' : {'temperature' : 0.7 , 'maxTokens' : 8192 }},
30
30
'messages' : [
31
31
{'role' : 'system' , 'content' : 'Hello, {{name}}!' },
32
32
{'role' : 'user' , 'content' : 'The day is, {{day}}!' },
@@ -42,7 +42,7 @@ def td() -> TestData:
42
42
td .flag ('ctx-interpolation' )
43
43
.variations (
44
44
{
45
- 'model' : {'id ' : 'fakeModel' , 'parameters' : {'extra-attribute' : 'I can be anything I set my mind/type to' }},
45
+ 'model' : {'name ' : 'fakeModel' , 'parameters' : {'extra-attribute' : 'I can be anything I set my mind/type to' }},
46
46
'messages' : [{'role' : 'system' , 'content' : 'Hello, {{ldctx.name}}! Is your last name {{ldctx.last}}?' }],
47
47
'_ldMeta' : {'enabled' : True , 'versionKey' : 'abcd' },
48
48
}
@@ -54,7 +54,7 @@ def td() -> TestData:
54
54
td .flag ('multi-ctx-interpolation' )
55
55
.variations (
56
56
{
57
- 'model' : {'id ' : 'fakeModel' , 'parameters' : {'extra-attribute' : 'I can be anything I set my mind/type to' }},
57
+ 'model' : {'name ' : 'fakeModel' , 'parameters' : {'extra-attribute' : 'I can be anything I set my mind/type to' }},
58
58
'messages' : [{'role' : 'system' , 'content' : 'Hello, {{ldctx.user.name}}! Do you work for {{ldctx.org.shortname}}?' }],
59
59
'_ldMeta' : {'enabled' : True , 'versionKey' : 'abcd' },
60
60
}
@@ -66,7 +66,7 @@ def td() -> TestData:
66
66
td .flag ('off-config' )
67
67
.variations (
68
68
{
69
- 'model' : {'id ' : 'fakeModel' , 'parameters' : {'temperature' : 0.1 }},
69
+ 'model' : {'name ' : 'fakeModel' , 'parameters' : {'temperature' : 0.1 }},
70
70
'messages' : [{'role' : 'system' , 'content' : 'Hello, {{name}}!' }],
71
71
'_ldMeta' : {'enabled' : False , 'versionKey' : 'abcd' },
72
72
}
@@ -116,19 +116,19 @@ def ldai_client(client: LDClient) -> LDAIClient:
116
116
117
117
def test_model_config_delegates_to_properties ():
118
118
model = ModelConfig ('fakeModel' , parameters = {'extra-attribute' : 'value' })
119
- assert model .id == 'fakeModel'
119
+ assert model .name == 'fakeModel'
120
120
assert model .get_parameter ('extra-attribute' ) == 'value'
121
121
assert model .get_parameter ('non-existent' ) is None
122
122
123
- assert model .id == model .get_parameter ('id ' )
123
+ assert model .name == model .get_parameter ('name ' )
124
124
125
125
126
126
def test_model_config_handles_custom ():
127
127
model = ModelConfig ('fakeModel' , custom = {'extra-attribute' : 'value' })
128
- assert model .id == 'fakeModel'
128
+ assert model .name == 'fakeModel'
129
129
assert model .get_parameter ('extra-attribute' ) is None
130
130
assert model .get_custom ('non-existent' ) is None
131
- assert model .get_custom ('id ' ) is None
131
+ assert model .get_custom ('name ' ) is None
132
132
133
133
134
134
def test_uses_default_on_invalid_flag (ldai_client : LDAIClient ):
@@ -148,7 +148,7 @@ def test_uses_default_on_invalid_flag(ldai_client: LDAIClient):
148
148
assert config .enabled is True
149
149
150
150
assert config .model is not None
151
- assert config .model .id == 'fakeModel'
151
+ assert config .model .name == 'fakeModel'
152
152
assert config .model .get_parameter ('temperature' ) == 0.5
153
153
assert config .model .get_parameter ('maxTokens' ) == 4096
154
154
@@ -170,7 +170,7 @@ def test_model_config_interpolation(ldai_client: LDAIClient):
170
170
assert config .enabled is True
171
171
172
172
assert config .model is not None
173
- assert config .model .id == 'fakeModel'
173
+ assert config .model .name == 'fakeModel'
174
174
assert config .model .get_parameter ('temperature' ) == 0.5
175
175
assert config .model .get_parameter ('maxTokens' ) == 4096
176
176
@@ -187,7 +187,7 @@ def test_model_config_no_variables(ldai_client: LDAIClient):
187
187
assert config .enabled is True
188
188
189
189
assert config .model is not None
190
- assert config .model .id == 'fakeModel'
190
+ assert config .model .name == 'fakeModel'
191
191
assert config .model .get_parameter ('temperature' ) == 0.5
192
192
assert config .model .get_parameter ('maxTokens' ) == 4096
193
193
@@ -200,7 +200,7 @@ def test_provider_config_handling(ldai_client: LDAIClient):
200
200
config , _ = ldai_client .config ('model-config' , context , default_value , variables )
201
201
202
202
assert config .provider is not None
203
- assert config .provider .id == 'fakeProvider'
203
+ assert config .provider .name == 'fakeProvider'
204
204
205
205
206
206
def test_context_interpolation (ldai_client : LDAIClient ):
@@ -218,7 +218,7 @@ def test_context_interpolation(ldai_client: LDAIClient):
218
218
assert config .enabled is True
219
219
220
220
assert config .model is not None
221
- assert config .model .id == 'fakeModel'
221
+ assert config .model .name == 'fakeModel'
222
222
assert config .model .get_parameter ('temperature' ) is None
223
223
assert config .model .get_parameter ('maxTokens' ) is None
224
224
assert config .model .get_parameter ('extra-attribute' ) == 'I can be anything I set my mind/type to'
@@ -241,7 +241,7 @@ def test_multi_context_interpolation(ldai_client: LDAIClient):
241
241
assert config .enabled is True
242
242
243
243
assert config .model is not None
244
- assert config .model .id == 'fakeModel'
244
+ assert config .model .name == 'fakeModel'
245
245
assert config .model .get_parameter ('temperature' ) is None
246
246
assert config .model .get_parameter ('maxTokens' ) is None
247
247
assert config .model .get_parameter ('extra-attribute' ) == 'I can be anything I set my mind/type to'
@@ -263,7 +263,7 @@ def test_model_config_multiple(ldai_client: LDAIClient):
263
263
assert config .enabled is True
264
264
265
265
assert config .model is not None
266
- assert config .model .id == 'fakeModel'
266
+ assert config .model .name == 'fakeModel'
267
267
assert config .model .get_parameter ('temperature' ) == 0.7
268
268
assert config .model .get_parameter ('maxTokens' ) == 8192
269
269
@@ -276,7 +276,7 @@ def test_model_config_disabled(ldai_client: LDAIClient):
276
276
277
277
assert config .model is not None
278
278
assert config .enabled is False
279
- assert config .model .id == 'fakeModel'
279
+ assert config .model .name == 'fakeModel'
280
280
assert config .model .get_parameter ('temperature' ) == 0.1
281
281
assert config .model .get_parameter ('maxTokens' ) is None
282
282
0 commit comments