class DefaultStructuredPromptFactory implements StructuredPromptFactory {
    private static final Gson GSON = new GsonBuilder().setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE).create();

    /**
     * Create a default structured prompt factory.
     */
    public DefaultStructuredPromptFactory() {}

    @Override
    public Prompt toPrompt(Object structuredPrompt) {<FILL_FUNCTION_BODY>}

    /**
     * Extracts the variables from the structured prompt.
     * @param structuredPrompt The structured prompt.
     * @return The variables map.
     */
    private static Map<String, Object> extractVariables(Object structuredPrompt) {
        String json = GSON.toJson(structuredPrompt);
        TypeToken<Map<String, Object>> mapType = new TypeToken<Map<String, Object>>() {};
        return GSON.fromJson(json, mapType);
    }
}

        StructuredPrompt annotation = StructuredPrompt.Util.validateStructuredPrompt(structuredPrompt);

        String promptTemplateString = StructuredPrompt.Util.join(annotation);
        PromptTemplate promptTemplate = PromptTemplate.from(promptTemplateString);

        Map<String, Object> variables = extractVariables(structuredPrompt);

        return promptTemplate.apply(variables);
    
<no_super_class>