semantic-conventions icon indicating copy to clipboard operation
semantic-conventions copied to clipboard

Tool call arg counts for Gen AI tool call spans

Open michaelsafyan opened this issue 7 months ago • 4 comments

Area(s)

area:gen-ai

What's missing?

There isn't yet a convention for reporting a summary of the arguments.

A summary of the arguments is useful where the details might be omitted.

Describe the solution you'd like

I'd like the following span attributes defined:

  • gen_ai.tool.positional_args.count
  • gen_ai.tool.keyword_args.count

michaelsafyan avatar Apr 25 '25 20:04 michaelsafyan

There is a draft PR related to Google Gen AI SDK instrumentation that illustrates how this might be used:

  • https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3446/

michaelsafyan avatar Apr 25 '25 22:04 michaelsafyan

What if we capture the parameter names and parameter numbers.

For DB conventions, it's been like this.

aabmass avatar May 01 '25 17:05 aabmass

From footnote 5 in the db attributes:

db.operation.parameter: If a parameter has no name and instead is referenced only by index, then SHOULD be the 0-based index.

And the keys are used to make an attribute per parameter like db.query.parameter.<key>

matt-hensley avatar May 01 '25 17:05 matt-hensley

Maybe we should consider providing a signature foo(bar: string, baz: Any) ?

or

code.function.arg.{key}: code.function.arg.0 = "*" code.function.arg.foo = "*"

lmolkova avatar May 08 '25 17:05 lmolkova