Stringify structured output schema as an attribute #3058
dinmukhamedm
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Fair point, I'd use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
It's very useful, when tracing complex apps, to see the structured output schema definition as an attribute. Most major provider SDKs support passing the pydantic (or zod in js) schema to the request, which directs the model to produce the valid JSON and parses the output back to pydantic object upon response. For example:
Motivation
Proposed solution
Attributes
I'd probably call the attribute something like
llm.request.schema
orllm.request.structured_output_schema
and put a stringified schema value into there.Implementation
This generally should be as simple as using
pydantic.schema_json_of()
. https://docs.pydantic.dev/1.10/usage/schema/#getting-schema-of-a-specified-typeBeta Was this translation helpful? Give feedback.
All reactions