# What is WAIL (Widely Applicable Interface Language)

WAIL is a DSL (Domain Specific Lanaguage) for writing type validated LLM prompts. 

wail'''
    # Define our Person type
    object Person {
        name: String
        age: Number
        interests: String[]
    }

    object Success {
        message: String
    }

    object Error {
        code: Number
        message: String
    }


    # Unions are supported.
    # So are comments.
    union Response = Success | Error;

    # Define a template for generating a person from a description
    template GetPersonFromDescription(description: String) -> Person {
        prompt: """
        Given this description of a person: "{{description}}"

        Create a Person object with their name, age, and interests.
        Return in this format: 
        {{return_type}}
        """
    }


    template GetResponse() -> Response {
        prompt """
        Give me a response of your choosing

        {{return_type}}
        """
    }

    template GetAdhocUnionResponse -> Success | Error {
        prompt """
        We support adhoc union types in template response types.

        {{return_type}}
        """
    }


    template GetArrayResponses -> Response[] {
        prompt """
        We support arrays for all supported types.
        """
    }

    main {
        template_args {
            description: String
        }
        # This is a comment
        let person_prompt = GetPersonFromDescription(
            description: $description
        );

        # This is the prompt we'll send to the LLM
        prompt {
            This is an example of a prompt generated by WAIL:
            {{person_prompt}}
        }
    }
    '''