haystack-ml-stack 0.4.5a3__tar.gz → 0.4.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/PKG-INFO +1 -1
  2. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/pyproject.toml +1 -1
  3. haystack_ml_stack-0.4.6/src/haystack_ml_stack/_version.py +1 -0
  4. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/dynamo.py +24 -22
  5. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/utils.py +15 -0
  6. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack.egg-info/PKG-INFO +1 -1
  7. haystack_ml_stack-0.4.5a3/src/haystack_ml_stack/_version.py +0 -1
  8. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/README.md +0 -0
  9. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/setup.cfg +0 -0
  10. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/__init__.py +0 -0
  11. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/_kafka.py +0 -0
  12. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/_serializers.py +0 -0
  13. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/app.py +0 -0
  14. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/cache.py +0 -0
  15. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/exceptions.py +0 -0
  16. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/generated/__init__.py +0 -0
  17. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/generated/v1/__init__.py +0 -0
  18. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/generated/v1/features_pb2.py +0 -0
  19. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/generated/v1/features_pb2.pyi +0 -0
  20. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/model_store.py +0 -0
  21. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack/settings.py +0 -0
  22. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack.egg-info/SOURCES.txt +0 -0
  23. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack.egg-info/dependency_links.txt +0 -0
  24. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack.egg-info/requires.txt +0 -0
  25. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/src/haystack_ml_stack.egg-info/top_level.txt +0 -0
  26. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/tests/test_serializers.py +0 -0
  27. {haystack_ml_stack-0.4.5a3 → haystack_ml_stack-0.4.6}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haystack-ml-stack
3
- Version: 0.4.5a3
3
+ Version: 0.4.6
4
4
  Summary: Functions related to Haystack ML
5
5
  Author-email: Oscar Vega <oscar@haystack.tv>
6
6
  License: MIT
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "haystack-ml-stack"
8
- version = "0.4.5a3"
8
+ version = "0.4.6"
9
9
  description = "Functions related to Haystack ML"
10
10
  readme = "README.md"
11
11
  authors = [{ name = "Oscar Vega", email = "oscar@haystack.tv" }]
@@ -0,0 +1 @@
1
+ __version__ = "0.4.6"
@@ -9,7 +9,7 @@ from boto3.dynamodb.types import TypeDeserializer
9
9
 
10
10
  from . import exceptions
11
11
  from ._serializers import FeatureRegistryId, SerializerRegistry
12
- from .utils import _complete_features_for_channels
12
+ from .utils import _complete_features_for_channels, DEFAULT_CHANNELS
13
13
 
14
14
  logger = logging.getLogger(__name__)
15
15
 
@@ -274,7 +274,7 @@ _MOBILE_OS = {"ios", "android", "iphone", "galaxy"}
274
274
 
275
275
 
276
276
  def _get_os_cat(client_os: str) -> str:
277
- normalized = client_os.lower().replace("debug","") if client_os else ""
277
+ normalized = client_os.lower().replace("debug", "") if client_os else ""
278
278
  return "MOBILE" if normalized in _MOBILE_OS else "TV"
279
279
 
280
280
 
@@ -503,16 +503,32 @@ def _process_channels(
503
503
  for stat in playlist_stats_user.values():
504
504
  all_channels.update(stat.data.keys())
505
505
 
506
- # Get not preferred channels to be ignored
506
+ all_channels = all_channels | set(DEFAULT_CHANNELS)
507
+
508
+ # My headlines will stay on top so not part of the candidates
507
509
  # The group labels are also ignored, not real channels for UI
508
- ignore_channels = set(["national_favorite", "local_favorite"])
510
+ ignore_channels = set(["my headlines", "national_favorite", "local_favorite"])
511
+
512
+ # Rule for weather
513
+ if user.get("geo", {}).get("country") != "US":
514
+ ignore_channels.add("weather")
515
+ # Rule for live_es
516
+ if "es" not in user.get("languages", []):
517
+ ignore_channels.add("live_es")
518
+
509
519
  inserted_channel_names = set()
510
520
  if channel_candidates is not None:
511
521
  preferred = set(user.get("preferredChannels", []) or [])
512
522
  for ch in channel_candidates.data:
513
- if ch.category_group in ("national_favorite", "local_favorite"):
514
- if ch.name not in preferred:
515
- ignore_channels.add(ch.name)
523
+ # Rule for authors
524
+ if (
525
+ ch.category_group in ("national_favorite", "local_favorite")
526
+ and ch.name not in preferred
527
+ ):
528
+ ignore_channels.add(ch.name)
529
+ # Rule for shows
530
+ if ch.category_group == "show" and ch.name.split("/")[0] not in preferred:
531
+ ignore_channels.add(ch.name)
516
532
 
517
533
  for ch in channel_candidates.data:
518
534
  if ch.name not in ignore_channels:
@@ -525,21 +541,7 @@ def _process_channels(
525
541
  )
526
542
  inserted_channel_names.add(ch.name)
527
543
 
528
- DEFAULT_CHANNELS = [
529
- "local news",
530
- "science & technology",
531
- "business & finance",
532
- "entertainment news",
533
- "live",
534
- "live_es",
535
- "weather",
536
- "politics",
537
- "international",
538
- "top videos",
539
- "editor picks",
540
- ]
541
-
542
- for name in all_channels | set(DEFAULT_CHANNELS):
544
+ for name in all_channels:
543
545
  if name not in ignore_channels and name not in inserted_channel_names:
544
546
  channels.append(
545
547
  {
@@ -679,6 +679,21 @@ def _validate_pwatched_entry_context(entry_contexts: list[str]):
679
679
  raise ValueError(f"Invalid entry contexts found: {invalid_contexts}")
680
680
 
681
681
 
682
+ DEFAULT_CHANNELS = [
683
+ "local news",
684
+ "science & technology",
685
+ "business & finance",
686
+ "entertainment news",
687
+ "live",
688
+ "live_es",
689
+ "weather",
690
+ "politics",
691
+ "international",
692
+ "top videos",
693
+ "editor picks",
694
+ ]
695
+
696
+
682
697
  def _complete_features_for_channels(
683
698
  channels: list[dict],
684
699
  user_features: dict[str, UserPlaylistStats],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haystack-ml-stack
3
- Version: 0.4.5a3
3
+ Version: 0.4.6
4
4
  Summary: Functions related to Haystack ML
5
5
  Author-email: Oscar Vega <oscar@haystack.tv>
6
6
  License: MIT
@@ -1 +0,0 @@
1
- __version__ = "0.4.5a3"