You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ,
I am using the openai gpt 4 o mini with pydantic model . But I keep getting this error.
{
"detail": "500: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'default': In context=(), 'additionalProperties' is required to be supplied and to be false.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}"
}
My Code :
model = models.openai(
"gpt-4o-mini",
api_key=get_env_variable("OpenAI-Key-v2"),
)
generator = generate.json(model, SkillInto)
prompt = f"""
Create a skill template for a new skill with the following description:
{query.skillDescription}
Please provide the following details:
- skillName
- skillDescription
- category (must be one of: Sports, Music, Other)
"""
result = generator(prompt)
from enum import Enum
from pydantic import BaseModel, conint, constr
class SkillCategory(str, Enum):
sports = "Sports"
music = "Music"
other = "Other"
class SkillInto(BaseModel):
skillName: str
skillDesc: str
category: SkillCategory
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi ,
I am using the openai gpt 4 o mini with pydantic model . But I keep getting this error.
{
"detail": "500: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'default': In context=(), 'additionalProperties' is required to be supplied and to be false.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}"
}
My Code :
model = models.openai(
"gpt-4o-mini",
api_key=get_env_variable("OpenAI-Key-v2"),
)
generator = generate.json(model, SkillInto)
prompt = f"""
Create a skill template for a new skill with the following description:
{query.skillDescription}
from enum import Enum
from pydantic import BaseModel, conint, constr
class SkillCategory(str, Enum):
sports = "Sports"
music = "Music"
other = "Other"
class SkillInto(BaseModel):
skillName: str
skillDesc: str
category: SkillCategory
Beta Was this translation helpful? Give feedback.
All reactions