Web Search

View as Markdown

Enable your AI applications to access real-time information from the internet. NeuraAI’s web search feature allows models to find current data, verify facts, and retrieve information beyond their training data.

Overview

All NeuraAI models support web search capabilities through our proprietary search engine. This enables your applications to:

  • Answer questions about current events
  • Fetch up-to-date statistics and data
  • Verify facts and claims
  • Find recent news and information
  • Access information published after the model’s training cutoff

With Responses API

The recommended approach for most use cases:

1from openai import OpenAI
2
3client = OpenAI(
4 base_url="https://api.neura-ai.app/v1"
5)
6
7response = client.responses.create(
8 model="gpt-4o",
9 tools=[{"type": "web_search_preview"}],
10 input="What was a positive news story from today?"
11)
12
13print(response.output_text)

With Chat Completions API

For chat-based applications, add -search suffix to the model name:

1response = client.chat.completions.create(
2 model="deepseek-v3-0324-search",
3 messages=[
4 {"role": "user", "content": "What are the latest developments in quantum computing?"}
5 ]
6)
7
8print(response.choices[0].message.content)

Practical Examples

Current Events

1response = client.responses.create(
2 model="gpt-4o",
3 tools=[{"type": "web_search_preview"}],
4 input="Summarize the top technology news from this week"
5)

Market Data

1response = client.responses.create(
2 model="gpt-5",
3 tools=[{"type": "web_search_preview"}],
4 input="What is the current price of Bitcoin and what factors are influencing it?"
5)

Research Questions

1response = client.responses.create(
2 model="gemini-2.5-pro",
3 tools=[{"type": "web_search_preview"}],
4 input="""
5 What are the recent FDA approvals for Alzheimer's treatments?
6 Include drug names, approval dates, and mechanism of action.
7 """
8)

Fact Checking

1response = client.responses.create(
2 model="gpt-4o",
3 tools=[{"type": "web_search_preview"}],
4 input="Is it true that SpaceX launched a mission to Mars last month?"
5)

Product Information

1response = client.responses.create(
2 model="gpt-5",
3 tools=[{"type": "web_search_preview"}],
4 input="Compare the specs and pricing of the latest flagship smartphones from Apple and Samsung"
5)

Combining with Other Features

Web Search + Function Calling

1tools = [
2 {"type": "web_search_preview"},
3 {
4 "type": "function",
5 "function": {
6 "name": "save_to_database",
7 "description": "Save information to database",
8 "parameters": {
9 "type": "object",
10 "properties": {
11 "data": {"type": "string"}
12 }
13 }
14 }
15 }
16]
17
18response = client.responses.create(
19 model="gpt-4o",
20 tools=tools,
21 input="Find the latest Tesla stock price and save it to the database"
22)

Web Search + Code Execution

1response = client.responses.create(
2 model="gpt-4o",
3 tools=[
4 {"type": "web_search_preview"},
5 {"type": "code_interpreter", "container": {"type": "auto"}}
6 ],
7 input="""
8 Find the GDP growth rates for G7 countries in 2024,
9 then create a bar chart visualization comparing them.
10 """
11)

When using the Chat Completions endpoint, remember to add the -search suffix:

1# Without search
2model="gpt-5"
3
4# With search enabled
5model="gpt-5-search"

Example with Conversation

1messages = [
2 {"role": "system", "content": "You are a helpful assistant with access to current information."},
3 {"role": "user", "content": "Who won the latest Formula 1 race?"}
4]
5
6response = client.chat.completions.create(
7 model="gpt-5-search",
8 messages=messages
9)
10
11# Add assistant response to conversation
12messages.append(response.choices[0].message)
13
14# Continue conversation
15messages.append({"role": "user", "content": "What were the lap times?"})
16
17response = client.chat.completions.create(
18 model="gpt-5-search",
19 messages=messages
20)

Best Practices

Use web search for:

  • Current events and news
  • Recent statistics and data
  • Time-sensitive information
  • Facts that change frequently
  • Information beyond the model’s training date

Don’t use web search for:

  • General knowledge questions
  • Mathematical calculations
  • Code generation
  • Creative writing
  • Personal advice

Optimizing Queries

Be Specific

1# Less effective
2"Tell me about climate change"
3
4# More effective
5"What are the latest IPCC findings on global temperature rise published in 2024?"

Include Context

1input="Find recent peer-reviewed studies on ketogenic diets for epilepsy treatment, focusing on pediatric applications"

Specify Timeframes

1input="What were the major AI breakthroughs in the last 6 months?"

Handling Search Results

The model automatically integrates search results into its response. You don’t need to parse or handle search results separately - the AI will:

  1. Determine if a search is needed
  2. Execute the search
  3. Analyze the results
  4. Synthesize information into a coherent response
  5. Include relevant sources when appropriate

Limitations

  • Search results depend on public internet availability
  • Some paywalled or restricted content may not be accessible
  • Search quality depends on query formulation
  • Results may vary based on regional availability
  • Rate limits may apply based on your subscription tier

Tips for Better Results

  • Frame questions clearly and specifically
  • Include relevant context in your queries
  • Ask for sources when fact-checking is important
  • Combine with other tools for complex tasks
  • Use appropriate models for your use case
  • Consider using Responses API for most search tasks
  • Add -search suffix only when using Chat Completions API