Skip to content

Simpler events for recording (local) GenAI function tool calling as generalized function tracing events #2185

@michaelsafyan

Description

@michaelsafyan

Area(s)

area:gen-ai

What's missing?

Although there are existing events for tool calling (gen_ai.assistant.message, gen_ai.tool.message), these are more geared towards the Gen AI model's view of what tools should be invoked/called (rather than from the standpoint of instrumenting the tool that ultimately got invoked). Additionally, these are somewhat complicated to generate and may not always be available (if the tool calling is deeply nested inside the logic of the client).

Where the model invokes local tools, it would be useful to be able to implement recording the input/output of those tool calls by intercepting the tool registration and having a somewhat simpler interface for tracing those calls. I also think that some of this modelling could be more general than just Gen AI.

I propose that we have a more generalized representation of function tracing to events that could be used.

Describe the solution you'd like

I'd like for there to be a more general set of events associated with function tracing:

Function Start

Represents a function being invoked and provides a way to record the parameters:

  • Attributes:
    • event.name: "function_start"
    • code.function.name: the name of the function that was called
    • positional_argument_count: the count of positional args
    • keyword_argument_count: the count of keyword or optional arguments
  • Body:
    • positional_arguments: an array of the positional arguments
    • keyword_arguments: a dictionary of the keyword arguments

Function End

Represents the result of a function being invoked.

  • Attributes:
    • event.name: "function_end"
    • code.function.name: the name of the function that was called
    • error.type: if there was an error
  • Body:
    • result: JSON representation of the (succesful) result
    • error: JSON representation of the (error) result

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Needs SIG

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions