Web Search Not Working - Post Following All Open AI Docuementation. Please HELP

Truly have no idea what is happening. I have read all the documentation very thoroughly and am getting the wrong result. If there is any prompt in the world that should trigger auto web search it’s this one -.- (Ignore dates being different I ran 2 tests to patch this post together, outcomes were the exact same)


{
  "id":"resp_67e02f169e708190b97cb0ebdbd411680438b96baf82bb82",
  "object":"response",
  "created_at":1742745366.0,
   "status":"completed",
    "output":  

[{
"type":"message", 
"id":"msg_67e02f16f4048190a3ac2762a18f1ab80438b96baf82bb82",
"status":"completed",
"role":"assistant",
"content":

[{
"type":"output_text",
"text":"Today's date is October 3, 2023."
,"annotations":[]

}]

}]
    response = self.client.responses.create(
            model="gpt-4o",
            input=messages,
            previous_response_id=previous_response_id,
            tools=[{"type": "web_search_preview"}],  # Enable web search
        )
     # Convert response to a serializable dictionary
        response_dict = {
            "id": response.id,
            "object": response.object,
            "created_at": response.created_at,
            "status": response.status,
            "output": [{
                "type": item.type,
                "id": item.id,
                "status": item.status,
                **({"role": item.role} if hasattr(item, "role") else {}),
                **({"content": [{
                    "type": content.type,
                    "text": content.text,
                    "annotations": [dict(a) for a in content.annotations] if hasattr(content, "annotations") else []
                } for content in item.content]} if hasattr(item, "content") else {})
            } for item in response.output]
        }
        
        return response_dict

Just put a Date/Time stamp in your system prompt.

The LLM is not the expert on the current date!

1 Like

Well this was just an example, if I ask it anything, it does not return web results.

you don’t search the web to determine the date or the time!

If the LLM is using that tool, try to give it a better reason not to.

2 Likes

btw, I agree it’s a dumb choice of tool on the part of the LLM! :smile: