openai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid request: prompt is empty or malformed.', 'type': 'invalid_request_error', 'param': None, 'code': None}} #716
Labels
bug
Something isn't working
from openai import OpenAI
from openai.agent import Agent
client = OpenAI(api_key="sk-...") # Use your key here
Define a simple agent (no tools used)
agent = Agent(
name="TestAgent",
instructions="Answer questions as helpfully as possible.",
)
Try running the agent with an empty string (or malformed query)
response = agent.run("")
print(response)
OUTPUT:
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid request: prompt is empty or malformed.', 'type': 'invalid_request_error', 'param': None, 'code': None}}
The text was updated successfully, but these errors were encountered: