Files
2025-10-02 20:13:20 -04:00

86 lines
4.9 KiB
Swift

//
// Recipe.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
#if canImport(AnyCodable)
import AnyCodable
#endif
/** A Recipe represents a personalized, user-generated agent configuration that defines specific behaviors and capabilities within the goose system. # Fields ## Required Fields * `version` - Semantic version of the Recipe file format (defaults to \"1.0.0\") * `title` - Short, descriptive name of the Recipe * `description` - Detailed description explaining the Recipe's purpose and functionality * `Instructions` - Instructions that defines the Recipe's behavior ## Optional Fields * `prompt` - the initial prompt to the session to start with * `extensions` - List of extension configurations required by the Recipe * `context` - Supplementary context information for the Recipe * `activities` - Activity labels that appear when loading the Recipe * `author` - Information about the Recipe's creator and metadata * `parameters` - Additional parameters for the Recipe * `response` - Response configuration including JSON schema validation * `retry` - Retry configuration for automated validation and recovery # Example use goose::recipe::Recipe; // Using the builder pattern let recipe = Recipe::builder() .title(\"Example Agent\") .description(\"An example Recipe configuration\") .instructions(\"Act as a helpful assistant\") .build() .expect(\"Missing required fields\"); // Or using struct initialization let recipe = Recipe { version: \"1.0.0\".to_string(), title: \"Example Agent\".to_string(), description: \"An example Recipe configuration\".to_string(), instructions: Some(\"Act as a helpful assistant\".to_string()), prompt: None, extensions: None, context: None, activities: None, author: None, settings: None, parameters: None, response: None, sub_recipes: None, retry: None, }; */
public struct Recipe: Codable, JSONEncodable, Hashable {
public var activities: [String]?
public var author: Author?
public var context: [String]?
public var description: String
public var extensions: [ExtensionConfig]?
public var instructions: String?
public var parameters: [RecipeParameter]?
public var prompt: String?
public var response: ModelResponse?
public var retry: RetryConfig?
public var settings: Settings?
public var subRecipes: [SubRecipe]?
public var title: String
public var version: String?
public init(activities: [String]? = nil, author: Author? = nil, context: [String]? = nil, description: String, extensions: [ExtensionConfig]? = nil, instructions: String? = nil, parameters: [RecipeParameter]? = nil, prompt: String? = nil, response: ModelResponse? = nil, retry: RetryConfig? = nil, settings: Settings? = nil, subRecipes: [SubRecipe]? = nil, title: String, version: String? = nil) {
self.activities = activities
self.author = author
self.context = context
self.description = description
self.extensions = extensions
self.instructions = instructions
self.parameters = parameters
self.prompt = prompt
self.response = response
self.retry = retry
self.settings = settings
self.subRecipes = subRecipes
self.title = title
self.version = version
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case activities
case author
case context
case description
case extensions
case instructions
case parameters
case prompt
case response
case retry
case settings
case subRecipes = "sub_recipes"
case title
case version
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(activities, forKey: .activities)
try container.encodeIfPresent(author, forKey: .author)
try container.encodeIfPresent(context, forKey: .context)
try container.encode(description, forKey: .description)
try container.encodeIfPresent(extensions, forKey: .extensions)
try container.encodeIfPresent(instructions, forKey: .instructions)
try container.encodeIfPresent(parameters, forKey: .parameters)
try container.encodeIfPresent(prompt, forKey: .prompt)
try container.encodeIfPresent(response, forKey: .response)
try container.encodeIfPresent(retry, forKey: .retry)
try container.encodeIfPresent(settings, forKey: .settings)
try container.encodeIfPresent(subRecipes, forKey: .subRecipes)
try container.encode(title, forKey: .title)
try container.encodeIfPresent(version, forKey: .version)
}
}