mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 12:25:29 +08:00
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
# Auto generated by LangBot Plugin SDK.
|
|
# Please refer to https://langbot.app/docs/en/plugin/dev/tutor.html for more details.
|
|
from __future__ import annotations
|
|
|
|
from langbot_plugin.api.definition.plugin import BasePlugin
|
|
from components.observability.installation import InstallationTelemetry
|
|
from components.offload import BoundedOffload
|
|
|
|
class LangRAG(BasePlugin):
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.offload = BoundedOffload()
|
|
self.telemetry = InstallationTelemetry(self)
|
|
|
|
async def initialize(self) -> None:
|
|
await self.telemetry.initialize()
|
|
|
|
async def on_installation_revoked(self, binding) -> None:
|
|
"""Release process-local state keyed by one revoked installation.
|
|
|
|
One object graph serves every installation of the artifact, so a revoked
|
|
installation's in-process locks and fences are only released here. Needs
|
|
an SDK whose runtime calls this hook (langbot-plugin 0.7.4 never does).
|
|
"""
|
|
|
|
for attribute in ('knowledge_engine_serial_state', 'telemetry_serial_state'):
|
|
state = getattr(self, attribute, None)
|
|
release = getattr(state, 'release_binding', None)
|
|
if release is not None:
|
|
release(binding)
|
|
|
|
def __del__(self) -> None:
|
|
pass
|