[Python] How to call OpenAi function from python

Discussão em 'Python' iniciado por Stack, Dezembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I generated a function using OpenAI as below: [​IMG]

    So the function definition is (json schema):

    {
    "name": "generate_jokes",
    "description": "Generate 3 jokes based on input text",
    "strict": true,
    "parameters": {
    "type": "object",
    "required": [
    "input_text",
    "number_of_jokes"
    ],
    "properties": {
    "input_text": {
    "type": "string",
    "description": "The text or context based on which jokes will be generated"
    },
    "number_of_jokes": {
    "type": "number",
    "description": "The number of jokes to generate; default is 3"
    }
    },
    "additionalProperties": false
    }
    }


    How can I call it in python 3.X?

    Continue reading...

Compartilhe esta Página