INNER CODE UNIT · Python

_message_logger_via_pubsub

GoogleCloudPlatform/vertex-ai-samples · community-content/tf_agents_bandits_movie_recommendation_with_kfp_and_vertex_sdk/mlops_pipeline_tf_agents_bandits_movie_recommendation/src/prediction_container/main.py:64

def _message_logger_via_pubsub(
    project_id: str,
    logger_pubsub_topic: str,
    observations: List[Dict[str, List[List[float]]]],
    predicted_actions: List[Dict[str, List[float]]]) -> None:
  """Send a message to the Pub/Sub topic which triggers the Logger.

  Package observations and the corresponding predicted actions in a message JSON
  and send to Pub/Sub topic.

  Args:
    project_id: GCP project ID.
    logger_pubsub_topic: Name of Pub/Sub topic that triggers the Logger.
    observations: List of `{"observation": <observation>}` in the prediction
      request.
    predicted_actions: List of `{"predicted_action": <predicted_action>}`
      corresponding to the observations.
  """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…