Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Rename BanditData fields from model_ -> bandit_model_ prefix (#58)
Browse files Browse the repository at this point in the history
* Fixing some existing test data changes, updating generated model field names.
* Update tests' subjectAttributes to use camel cased fields
  • Loading branch information
lisaah authored Jul 3, 2024
1 parent 8462d04 commit c015c4f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions eppo_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def get_bandit_action_detail(
subject_key,
subject_attributes,
action_contexts,
bandit_data.model_data,
bandit_data.bandit_model_data,
)

# log bandit action
Expand All @@ -350,7 +350,7 @@ def get_bandit_action_detail(
"action": evaluation.action_key if evaluation else None,
"actionProbability": evaluation.action_weight if evaluation else None,
"optimalityGap": evaluation.optimality_gap if evaluation else None,
"modelVersion": bandit_data.model_version if evaluation else None,
"modelVersion": bandit_data.bandit_model_version if evaluation else None,
"timestamp": datetime.datetime.utcnow().isoformat(),
"subjectNumericAttributes": (
subject_attributes.numeric_attributes
Expand Down
7 changes: 4 additions & 3 deletions eppo_client/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime
from enum import Enum
from pydantic import Field
from typing import Dict, List, Optional

from eppo_client.base_model import SdkBaseModel
Expand Down Expand Up @@ -96,7 +97,7 @@ class BanditModelData(SdkBaseModel):

class BanditData(SdkBaseModel):
bandit_key: str
model_name: str
bandit_model_name: str = Field(alias="modelName")
bandit_model_version: str = Field(alias="modelVersion")
bandit_model_data: BanditModelData = Field(alias="modelData")
updated_at: datetime
model_version: str
model_data: BanditModelData
2 changes: 1 addition & 1 deletion eppo_client/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.3.0"
__version__ = "3.4.0"
4 changes: 2 additions & 2 deletions test/client_bandit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ def test_bandit_generic_test_cases(test_case):
flag,
subject["subjectKey"],
ContextAttributes(
numeric_attributes=subject["subjectAttributes"]["numeric_attributes"],
numeric_attributes=subject["subjectAttributes"]["numericAttributes"],
categorical_attributes=subject["subjectAttributes"][
"categorical_attributes"
"categoricalAttributes"
],
),
{
Expand Down

0 comments on commit c015c4f

Please sign in to comment.