RunAnywhereStructuredOutput class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
Static Methods
-
generate(String prompt, {required String jsonSchema, int maxTokens = 512, double temperature = 0.0})
→ Future<StructuredOutputResult>
-
Generate text constrained by a JSON schema string
jsonSchema using the
lifecycle-owned LLM. Commons owns the full pipeline (prepare prompt → run
LLM → strip thinking tags → extract JSON → validate). maxTokens and
temperature are accepted for cross-SDK API parity; commons currently
uses default generation parameters.
-
generateRequest(StructuredOutputRequest request)
→ Future<StructuredOutputResult>
-
Generated-proto structured output entrypoint.
-
generateStructured({required String prompt, required JSONSchema schema, LLMGenerationOptions? options})
→ Future<StructuredOutputResult>
-
Generate structured output from a typed JSON schema.
-
generateStructuredStream({required String prompt, required JSONSchema schema, LLMGenerationOptions? options})
→ Stream<StructuredOutputStreamEvent>
-
Stream-shaped structured output API. Mirrors Swift
RunAnywhere.generateStructuredStream(prompt:schema:options:) —
drives the underlying LLM token stream and re-emits one
STRUCTURED_OUTPUT_STREAM_EVENT_KIND_TOKEN event per non-empty token,
then a terminal COMPLETED event carrying the schema-validated
StructuredOutputResult parsed from the accumulated text by commons
(extractStructuredOutput). Errors surface as a single terminal
ERROR event so consumers always receive a terminal frame.
-
generateWithStructuredOutput({required String prompt, required StructuredOutputOptions structuredOutput, LLMGenerationOptions? options})
→ Future<LLMGenerationResult>
-
Apply a structured-output configuration to a normal LLM generation.
-
preparePromptForStructuredOutput({required String prompt, required String jsonSchema})
→ String
-
Two-step prompt preparation: ask commons to format
prompt with the
supplied jsonSchema BEFORE invoking the LLM. Returns the schema-
augmented system prompt. Mirrors Swift's
RunAnywhere+StructuredOutput.swift preparePrompt(prompt:options:)
helper used inside generateWithStructuredOutput.