parse

suspend fun <T> parse(executor: PromptExecutor, structure: StructuredData<T, *>, content: String): T(source)

Parses the given content string into an instance of the specified type using the provided structured data schema. If the initial parsing fails, attempts to fix the content based on the error and retries parsing.

Parameters

executor

Executor to preform requests to fixingModel

structure

The structured data schema and serializer to use for parsing the content.

content

The string content to parse into the structured data type.

Throws

If parsing fails both initially and after attempting to fix the content.