Skip to content

Commit 111eac5

Browse files
committed
refactor!: Change version_key_to variation_key
1 parent 388330e commit 111eac5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

ldai/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def config(
185185

186186
tracker = LDAIConfigTracker(
187187
self.client,
188-
variation.get('_ldMeta', {}).get('versionKey', ''),
188+
variation.get('_ldMeta', {}).get('variationKey', ''),
189189
key,
190190
context,
191191
)

ldai/testing/test_model_config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def td() -> TestData:
1515
'model': {'name': 'fakeModel', 'parameters': {'temperature': 0.5, 'maxTokens': 4096}, 'custom': {'extra-attribute': 'value'}},
1616
'provider': {'name': 'fakeProvider'},
1717
'messages': [{'role': 'system', 'content': 'Hello, {{name}}!'}],
18-
'_ldMeta': {'enabled': True, 'versionKey': 'abcd'},
18+
'_ldMeta': {'enabled': True, 'variationKey': 'abcd'},
1919
},
2020
"green",
2121
)
@@ -31,7 +31,7 @@ def td() -> TestData:
3131
{'role': 'system', 'content': 'Hello, {{name}}!'},
3232
{'role': 'user', 'content': 'The day is, {{day}}!'},
3333
],
34-
'_ldMeta': {'enabled': True, 'versionKey': 'abcd'},
34+
'_ldMeta': {'enabled': True, 'variationKey': 'abcd'},
3535
},
3636
"green",
3737
)
@@ -44,7 +44,7 @@ def td() -> TestData:
4444
{
4545
'model': {'name': 'fakeModel', 'parameters': {'extra-attribute': 'I can be anything I set my mind/type to'}},
4646
'messages': [{'role': 'system', 'content': 'Hello, {{ldctx.name}}! Is your last name {{ldctx.last}}?'}],
47-
'_ldMeta': {'enabled': True, 'versionKey': 'abcd'},
47+
'_ldMeta': {'enabled': True, 'variationKey': 'abcd'},
4848
}
4949
)
5050
.variation_for_all(0)
@@ -56,7 +56,7 @@ def td() -> TestData:
5656
{
5757
'model': {'name': 'fakeModel', 'parameters': {'extra-attribute': 'I can be anything I set my mind/type to'}},
5858
'messages': [{'role': 'system', 'content': 'Hello, {{ldctx.user.name}}! Do you work for {{ldctx.org.shortname}}?'}],
59-
'_ldMeta': {'enabled': True, 'versionKey': 'abcd'},
59+
'_ldMeta': {'enabled': True, 'variationKey': 'abcd'},
6060
}
6161
)
6262
.variation_for_all(0)
@@ -68,7 +68,7 @@ def td() -> TestData:
6868
{
6969
'model': {'name': 'fakeModel', 'parameters': {'temperature': 0.1}},
7070
'messages': [{'role': 'system', 'content': 'Hello, {{name}}!'}],
71-
'_ldMeta': {'enabled': False, 'versionKey': 'abcd'},
71+
'_ldMeta': {'enabled': False, 'variationKey': 'abcd'},
7272
}
7373
)
7474
.variation_for_all(0)

ldai/tracker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,29 @@ class LDAIConfigTracker:
137137
"""
138138

139139
def __init__(
140-
self, ld_client: LDClient, version_key: str, config_key: str, context: Context
140+
self, ld_client: LDClient, variation_key: str, config_key: str, context: Context
141141
):
142142
"""
143143
Initialize an AI configuration tracker.
144144
145145
:param ld_client: LaunchDarkly client instance.
146-
:param version_key: Version key for tracking.
146+
:param variation_key: Variation key for tracking.
147147
:param config_key: Configuration key for tracking.
148148
:param context: Context for evaluation.
149149
"""
150150
self.ld_client = ld_client
151-
self.version_key = version_key
151+
self.variation_key = variation_key
152152
self.config_key = config_key
153153
self.context = context
154154

155155
def __get_track_data(self):
156156
"""
157157
Get tracking data for events.
158158
159-
:return: Dictionary containing version and config keys.
159+
:return: Dictionary containing variation and config keys.
160160
"""
161161
return {
162-
'versionKey': self.version_key,
162+
'variationKey': self.variation_key,
163163
'configKey': self.config_key,
164164
}
165165

0 commit comments

Comments
 (0)