mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
from unittest.mock import patch
|
|
|
|
import litellm
|
|
|
|
from llm_gateway.callbacks import init_callbacks
|
|
from llm_gateway.callbacks.insights import InsightsCallback
|
|
from llm_gateway.config import Settings
|
|
|
|
|
|
def test_init_callbacks_forwards_the_ai_lane_setting() -> None:
|
|
# The env knob is only as real as this wiring: if init_callbacks stops forwarding
|
|
# insights_ai_lane_capture, the callback silently falls back to its default (True) and the
|
|
# setting goes dead. False is asserted because it is the only value that can catch that.
|
|
settings = Settings(insights_project_token="test-token", insights_ai_lane_capture=False)
|
|
original_callbacks = litellm.callbacks
|
|
try:
|
|
with patch("llm_gateway.callbacks.get_settings", return_value=settings):
|
|
init_callbacks()
|
|
insights_callbacks = [cb for cb in litellm.callbacks if isinstance(cb, InsightsCallback)]
|
|
assert len(insights_callbacks) == 1
|
|
assert insights_callbacks[0]._ai_lane_capture is False
|
|
finally:
|
|
litellm.callbacks = original_callbacks
|