init(prompt:instructions:generationSchema:)
Creates a model sample input with the given prompt, instructions, and schema.
Declaration
init(prompt: Prompt, instructions: Instructions? = nil, generationSchema: GenerationSchema? = nil)Parameters
- prompt:
The prompt to send to the language model.
- instructions:
Optional system instructions for the model session.
- generationSchema:
The output schema for the assistant’s response.
Discussion
@Generable
struct WeatherAnswer {
let condition: String
}
let input = ModelSampleInput(
prompt: Prompt("What's the weather like in Cupertino?"),
instructions: Instructions("Respond with the weather condition only."),
generationSchema: GenerationSchema(type: WeatherAnswer.self, properties: [])
)