Skip to content

Implement Web Search tool in /chat/completions #5018

Open
@SuperPat45

Description

@SuperPat45

OpenAI has just unveiled a new Web Search tool for the /chat/completions API and the new ‘Response’ API:
https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat

curl -X POST "https://api.openai.com/v1/chat/completions" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -H "Content-type: application/json" \
    -d '{
        "model": "gpt-4o-search-preview",
        "web_search_options": {
            "user_location": {
                "type": "approximate",
                "approximate": {
                    "country": "GB",
                    "city": "London",
                    "region": "London",
                }
            }
        },
        "messages": [{
            "role": "user",
            "content": "What are the best restaurants around Granary Square?"
        }]
    }'


[
  {
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "the model response is here...",
      "refusal": null,
      "annotations": [
        {
          "type": "url_citation",
          "url_citation": {
            "end_index": 985,
            "start_index": 764,
            "title": "Page title...",
            "url": "https://..."
          }
        }
      ]
    },
    "finish_reason": "stop"
  }
]

It would be great if LocalAI could implement this tool, perhaps using Hugging Face's Open Deep Research implementation: https://huggingface.co/blog/open-deep-research

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions