-
Notifications
You must be signed in to change notification settings - Fork 422
Open
Labels
points: 3A few daysA few days
Description
Description
We have begun to move a few AIM packages over to subscriber-based, namely openai and @google/genai (at the time of writing). They reuse similar logic; it would be useful to have a base class that encapsulates this behavior.
Some features of this new base AIM subscriber:
Subscriber.enabledis set tosuper.enabled && this.agent?.config?.ai_monitoring?.enabledorsuper.enabled && this.agent?.config?.ai_monitoring?.streaming?.enabledfor streams- Same function names, like
instrumentStream,addLlmMeta,recordEvent, andrecordChatCompletionMessages. These can be defined in the base AIM subscriber as no-ops and then implemented in its children classes (e.g.OpenAISubscriber). handler(data,ctx)for a chat completions subscriber typically just creates a segment with nameAI_PREFIX.COMPLETION. The base AIM subscriber could default to this behavior.- Similarly for
AI_PREFIX.EMBEDDINGtoo - Previous instrumentation checked against
agent.configfor theai_monitoringvalue. Most subscribers just useconfigbecause they don't expectagent.configto change at runtime. I would suggest a getter forconfigthat equates toagent.configto avoid this potential oversight.
Acceptance Criteria
- A base subscriber for AIM is created that standardizes how we handle AI packages in subscribers.
- All instances of
agent.configare replaced withconfigto avoid redundancy - Relevant unit tests are created
Metadata
Metadata
Assignees
Labels
points: 3A few daysA few days
Type
Projects
Status
Reviewed