ai.FunctionSpec
One unit of model work, bound and unrun. Immutable; getters only.
Signature
class ai.FunctionSpec<Out>One unit of model work, bound and unrun. Immutable; getters only.
MyFunc@spec(args) calls the compiler-generated private MyFunc@spec
companion. Streaming calls the separate private MyFunc@stream companion,
whose return type carries the Out$stream schema. Neither companion is
public.
Source:<builtin>/ai/spec.bamlbytes 4296–6621
Fields
spec_name
stringargs
map<string, unknown>prompt_template
(ai.OutputFormat) -> ai.Prompt throws ai.errors.PromptRenderErrortoolbox
default_client
Instance methods
arguments
(self) -> map<string, unknown>build_request
(Builds the provider HTTP request shape for this spec without invoking
the model. client overrides the spec's default; null uses the default.
call
<__effect_param_0>(Runs this bound spec through the default agent. client overrides the
bound client; null keeps it. on_event observes the same journal
events a direct LLM-function call reports.
client_id
(self) -> stringname
(self) -> stringoutput_type
(self) -> reflect.Type throws reflect.errors.CompilationErrorparse
(self, json: string) -> Out throws baml.errors.ParseErrorParses an existing model reply using this spec's realized output type.