Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rolling logger schema #318

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
14 changes: 10 additions & 4 deletions langkit/whylogs/rolling_logger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any, Optional
import whylogs as why
from whylogs.core.schema import DatasetSchema
from langkit import llm_metrics


class RollingLogger:
Expand All @@ -12,15 +11,22 @@ def __init__(
schema: Optional[DatasetSchema] = None,
**kwargs: Any
):
llm_schema = llm_metrics.init()
if schema is None:
from langkit import llm_metrics

schema = llm_metrics.init()
self.logger = why.logger(
mode="rolling",
interval=interval_minutes,
when="M",
base_name="langkit",
schema=llm_schema,
schema=schema,
)
self.logger.append_writer(name="whylabs", **kwargs)

if "writer" in kwargs:
self.logger.append_writer(name=None, **kwargs)
else:
self.logger.append_writer(name="whylabs", **kwargs)

def log(self, dict):
self.logger.log(dict)
Expand Down
Loading