Skip to content

JSON output example #21

@aborruso

Description

@aborruso

Hi @lmangani ,
in the documentation there is this example

SET VARIABLE openprompt_api_url = 'http://localhost:11434/v1/chat/completions';
SET VARIABLE openprompt_model_name = 'llama3.2:3b';

SELECT open_prompt('I want ice cream', json_schema := '{
       "type": "object",
       "properties": {
         "summary": { "type": "string" },
         "sentiment": { "type": "string", "enum": ["pos", "neg", "neutral"] }
       },
       "required": ["summary", "sentiment"],
       "additionalProperties": false
     }') output;

If I run it, it seems to me that it does not work. I have in output

output = { "Treating yourself to a cool treat sounds like a great idea! What's your favorite flavor of ice cream? We could chat about all the delicious options out there, from classic vanilla to unique flavors like matcha or strawberry balsamic. Or maybe you're in the mood for something creamy and cookie dough-filled?"

    :
            -0.0103
         }

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions