Skip to content

docs: describe gen_ai.tool.definitions in the conventions' shape - #114

Merged
PabloPardoGarcia merged 2 commits into
mainfrom
pablo/rius-1879-tool-definitions-note
Nov 16, 2026
Merged

PabloPardoGarcia merged 2 commits into
mainfrom
pablo/rius-1879-tool-definitions-note

Conversation

@PabloPardoGarcia

@PabloPardoGarcia PabloPardoGarcia commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

The rationale of gen_ai.tool.definitions said definitions are "serialized verbatim". Both SDKs now record them in the conventions' shape (semantic-conventions-genai #608) where they recognise the provider's spelling: a function tool from OpenAI, Anthropic, Bedrock (toolSpec), Gemini (function declarations) or the Vercel AI SDK becomes {type: "function", name, description, parameters}, and a provider's built-in tool keeps its fields with its type prefixed by the provider name (anthropic.web_search_20250305). The rationale now says so, and says two limits:

  • A built-in tool without a name (OpenAI's web_search, Gemini's google_search) stays nameless on purpose. An invented name would read as a tool that was offered and never called.
  • A definition in a shape the SDKs do not recognise is recorded as given, so not every entry validates against the upstream schema.

Rationale text only; out/, model/ and docs/registry/ regenerated from it (check_registry, generators.generate --check, generators.registry_docs --check clean; pytest 1171 passed).

SDK PRs: glassflow/rius-sdk-python#286, glassflow/rius-sdk-typescript#251.

Not in this PR: the shared fixtures' expected results still hold the provider shapes for gen_ai.tool.definitions (12 OpenInference families, plus vercel-ai-v5/v6 on the TypeScript side). They need regenerating with tools/expect_python.py / tools/expect_typescript.mts once the SDK change is released; both SDKs list them as known differences until then.

Related: RIUS-1879

The SDKs now record tool definitions as conventions function tools, with
provider built-in tool types prefixed by the provider, instead of the
provider's own shape. The rationale said verbatim.
@PabloPardoGarcia
PabloPardoGarcia requested a review from a team as a code owner November 16, 2026 16:37
@PabloPardoGarcia

Copy link
Copy Markdown
Member Author

Automated review

No blocking issues. The change is rationale text only. The generated out/, model/ and docs/registry/ copies match the source edit, and CI (weaver, parity, live-check, test) is green.

Nits

  • The rationale overclaims slightly. "a function tool is {type: function, name, description, parameters} whatever the provider's spelling": both SDK PRs keep shapes they don't recognise unchanged, including Bedrock toolSpec, Gemini function_declarations containers and non-object entries. I'd add something like "; a definition in a shape the SDKs do not recognise is recorded as given", so readers of the registry don't assume every entry validates. Drop the clause if the SDK PRs later cover those shapes.
  • "Content, not identity, so it is listed in CONTENT_ATTRIBUTES." Upstream #543 (content capture configuration) explicitly says that "attributes providing schemas rather than user/model payload content (such as gen_ai.tool.definitions) are not governed by this configuration." Our choice is stricter, which is defensible. With RIUS-1883 we now honour OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT, so a user who sets NO_CONTENT expecting upstream behaviour will also lose tool definitions, and with them the amnesia detector's ToolDefinitionNames. Not for this PR, but the rationale could say this is a deliberate deviation.
  • The re-sync plan in the body (regenerate the expected results with expect_python.py / expect_typescript.mts after the SDK release, then drop the known_differences entries) is clear. Worth a tracked follow-up so the entries don't linger.

Bedrock toolSpec and Gemini function declarations are now converted too.
A built-in tool without a name stays without one on purpose, and a shape
the SDKs do not recognise is recorded as given.
@PabloPardoGarcia

Copy link
Copy Markdown
Member Author

Addressed in ec2225e. The rationale no longer claims every spelling is converted. It lists the recognised function-tool spellings, which now include Bedrock toolSpec and Gemini function declarations (rius-sdk-python#286 / rius-sdk-typescript#251). It says a built-in tool without a name stays nameless on purpose, because an invented name would read as a tool offered and never called. It also says an unrecognised shape is recorded as given. out/, model/ and docs/registry/ are regenerated. The CONTRIBUTING checks pass locally (pytest 1171 passed, Weaver and registry_docs clean).

Not changed here: the CONTENT_ATTRIBUTES deviation from upstream #543 for tool definitions is tracked separately. The expected-results re-sync after the SDK release still stands as described in the body.

@PabloPardoGarcia
PabloPardoGarcia merged commit f48e13a into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant