Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions eppo_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def get_bandit_action(
self,
flag_key: str,
subject_key: str,
subject_attributes: Attributes,
subject_context: Attributes,
actions_with_contexts: List[ActionContext],
default: str,
) -> BanditResult:
Expand All @@ -244,7 +244,7 @@ def get_bandit_action(
Args:
flag_key (str): The feature flag key that contains the bandit as one of the variations.
subject_key (str): The key identifying the subject.
subject_attributes (Attributes): The attributes of the subject.
subject_context (Attributes): The subject context
actions_with_contexts (List[ActionContext]): The list of actions with their contexts.

Returns:
Expand All @@ -257,7 +257,7 @@ def get_bandit_action(
return self.get_bandit_action_detail(
flag_key,
subject_key,
subject_attributes,
subject_context,
actions_with_contexts,
default,
)
Expand All @@ -271,14 +271,14 @@ def get_bandit_action_detail(
self,
flag_key: str,
subject_key: str,
subject_attributes: Attributes,
subject_context: Attributes,
actions_with_contexts: List[ActionContext],
default: str,
) -> BanditResult:
# get experiment assignment
# ignoring type because Dict[str, str] satisfies Dict[str, str | ...] but mypy does not understand
variation = self.get_string_assignment(
flag_key, subject_key, subject_attributes.categorical_attributes, default # type: ignore
flag_key, subject_key, subject_context.categorical_attributes, default # type: ignore
)

# if the variation is not the bandit key, then the subject is not allocated in the bandit
Expand All @@ -297,7 +297,7 @@ def get_bandit_action_detail(
evaluation = self.__bandit_evaluator.evaluate_bandit(
flag_key,
subject_key,
subject_attributes,
subject_context,
actions_with_contexts,
bandit_data.model_data,
)
Expand All @@ -312,12 +312,12 @@ def get_bandit_action_detail(
"modelVersion": bandit_data.model_version if evaluation else None,
"timestamp": datetime.datetime.utcnow().isoformat(),
"subjectNumericAttributes": (
subject_attributes.numeric_attributes
subject_context.numeric_attributes
if evaluation.subject_attributes
else {}
),
"subjectCategoricalAttributes": (
subject_attributes.categorical_attributes
subject_context.categorical_attributes
if evaluation.subject_attributes
else {}
),
Expand Down
2 changes: 1 addition & 1 deletion eppo_client/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.1.0"
__version__ = "3.1.1"
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"

[tool.mypy]
exclude = ['example/']