from textwrap import dedent
function_data = {
"name": "Sentiment Analysis",
"description": "Analyze the sentiment of a given text.",
"prompt": dedent("""Analyze the sentiment of the given text.
Determine if the sentiment is positive, negative, or neutral.
Definitions:
- Positive: The text expresses a favorable or happy sentiment.
- Negative: The text expresses an unfavorable or unhappy sentiment.
- Neutral: The text does not express a clearly positive or negative sentiment.
"""),
"input_schema": SentimentInput.model_json_schema(),
"output_schema": SentimentOutput.model_json_schema(),
"api_key": os.environ.get("OPENAI_API_KEY"),
"model": "gpt-4o-mini"
}
function = api_call("POST", "functions/", function_data)
function_id = function.json()['id']