Skip to content

Refactor LlmEvent classes to provide better abstraction/reusability #3687

@amychisholm03

Description

@amychisholm03

Description

The agent spec outlines several different objects to encapsulate LLM data that we want to record: LlmChatCompletionMessage, LlmChatCompletionSummary, LlmEmbedding, LlmErrorMessage , and with Agentic AI: LlmTool and LlmAgent.

With each different LLM/AI package (and sometimes there is nuance within the package itself), the logic to extract the required fields for these objects differs, but at the end of the day, the result needs to be the same. We should have a parent class that expects all of the required fields to be defined and then children classes that can handle the logic within the package. Some of the LLM events already do this (somewhat).

Acceptance Criteria

  • LlmChatCompletionMessage parent class is created and all relevant classes inherit from it. This will allow us to reference this data type in the now abstracted AIM subscribers.
  • LlmChatCompletionSummary ^^
  • LlmEmbedding ^^
  • LlmErrorMessage ^^
  • LlmAgent ^^ (currently only used by LangGraph)
  • LlmTool ^^ (currently only used by LangChain)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Needs PR Review

Relationships

None yet

Development

No branches or pull requests

Issue actions