Repository navigation
v0.2.0
Spans now say which tools the model was offered
The Python half of prism-opentelemetry#2.
on_generation_started takes an optional third argument: the tools the model was
offered.
subscriber.on_generation_started(context, input, [
AdvertisedTool("search", "sha256:…", "Search the docs", {...}),
])
AdvertisedTool is exported. description and parameters default to None --
leave them out if you never want them on a span.
llm.tools.<i>.tool.name always
prism.tools.<i>.digest always
llm.tools.<i>.tool.description capture_content only
llm.tools.<i>.tool.json_schema capture_content only
TWO HALVES, BECAUSE THEY ANSWER TWO QUESTIONS. The first pair answers "did the
tool set change between these two turns" -- asked in production, which is
exactly where the content gate is off, so a gated answer would be absent
whenever it was wanted. A name and a digest are authored by the application and
carry nothing the user wrote. The second pair answers "WHAT changed", and a tool
description is instructions to a model, so it goes through the capture gate.
A provider caches the tools array AS SERIALISED, so the same tools in a
different order is a different prefix and a cache miss. The attributes are
flattened by zero-based index -- OpenInference's own shape -- so order survives
without a list attribute to invent. A sorted list would report an unchanged tool
set for a turn that actually missed, which is the reassuring direction to be
wrong in. A test sends zebra before alpha and asserts they stay that way.
64 tools and 512 characters of name, capped separately from
max_content_length. That option exists so an operator can see more of a PROMPT
and a name has no reason to follow it. An MCP client builds tools from a REMOTE
server's advertised definitions, and since names are ungated they ride EVERY
span rather than only captured ones.
Additive: the parameter is optional and existing calls are unaffected.