Implement Web Search tool in /chat/completions
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 49.2k
- Forks
- 4.5k
- Avg merge
- 1d 3m
- Merged PRs (30d)
- 239
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at LocalAI's /chat/completions endpoint and review the linked OpenAI web-search documentation and Hugging Face Open Deep Research implementation. Done should include support for the shown web_search_options request and the resulting URL citation annotations, with behavior matching the documented response shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100