fix: imports

This commit is contained in:
NanoCode012
2025-10-27 16:01:27 +07:00
parent 4193c4bdcb
commit d4f50806cd
2 changed files with 7 additions and 5 deletions

View File

@@ -72,6 +72,6 @@ axolotl-contribs-mit==0.0.3
axolotl-contribs-mit==0.0.5 axolotl-contribs-mit==0.0.5
# telemetry # telemetry
posthog>=4.2.0 posthog==6.7.10
mistral-common==1.8.5 mistral-common==1.8.5

View File

@@ -10,10 +10,10 @@ import uuid
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
import posthog
import psutil import psutil
import torch import torch
import yaml import yaml
from posthog import PostHog
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -240,7 +240,9 @@ class TelemetryManager:
def _init_posthog(self): def _init_posthog(self):
"""Initialize PostHog client""" """Initialize PostHog client"""
self.posthog = PostHog(POSTHOG_WRITE_KEY, host=POSTHOG_HOST) posthog.api_key = POSTHOG_WRITE_KEY
posthog.project_api_key = POSTHOG_WRITE_KEY
posthog.host = POSTHOG_HOST
def _redact_paths(self, properties: dict[str, Any]) -> dict[str, Any]: def _redact_paths(self, properties: dict[str, Any]) -> dict[str, Any]:
""" """
@@ -389,7 +391,7 @@ class TelemetryManager:
# Wrap PostHog errors in try / except to not raise errors during Axolotl usage # Wrap PostHog errors in try / except to not raise errors during Axolotl usage
try: try:
# Send event via PostHog # Send event via PostHog
self.posthog.capture( posthog.capture(
distinct_id=self.run_id, distinct_id=self.run_id,
event=event_type, event=event_type,
properties=properties, properties=properties,
@@ -411,4 +413,4 @@ class TelemetryManager:
def shutdown(self): def shutdown(self):
"""Ensure all queued events are processed before shutdown""" """Ensure all queued events are processed before shutdown"""
if self.enabled: if self.enabled:
self.posthog.shutdown() posthog.shutdown()