# Web Search 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 ## Using Web Search ### With Responses API The recommended approach for most use cases: ```python from openai import OpenAI client = OpenAI( base_url="https://api.neura-ai.app/v1" ) response = client.responses.create( model="gpt-4o", tools=[{"type": "web_search_preview"}], input="What was a positive news story from today?" ) print(response.output_text) ``` ### With Chat Completions API For chat-based applications, add `-search` suffix to the model name: ```python response = client.chat.completions.create( model="deepseek-v3-0324-search", messages=[ {"role": "user", "content": "What are the latest developments in quantum computing?"} ] ) print(response.choices[0].message.content) ``` ## Practical Examples ### Current Events ```python response = client.responses.create( model="gpt-4o", tools=[{"type": "web_search_preview"}], input="Summarize the top technology news from this week" ) ``` ### Market Data ```python response = client.responses.create( model="gpt-5", tools=[{"type": "web_search_preview"}], input="What is the current price of Bitcoin and what factors are influencing it?" ) ``` ### Research Questions ```python response = client.responses.create( model="gemini-2.5-pro", tools=[{"type": "web_search_preview"}], input=""" What are the recent FDA approvals for Alzheimer's treatments? Include drug names, approval dates, and mechanism of action. """ ) ``` ### Fact Checking ```python response = client.responses.create( model="gpt-4o", tools=[{"type": "web_search_preview"}], input="Is it true that SpaceX launched a mission to Mars last month?" ) ``` ### Product Information ```python response = client.responses.create( model="gpt-5", tools=[{"type": "web_search_preview"}], input="Compare the specs and pricing of the latest flagship smartphones from Apple and Samsung" ) ``` ## Combining with Other Features ### Web Search + Function Calling ```python tools = [ {"type": "web_search_preview"}, { "type": "function", "function": { "name": "save_to_database", "description": "Save information to database", "parameters": { "type": "object", "properties": { "data": {"type": "string"} } } } } ] response = client.responses.create( model="gpt-4o", tools=tools, input="Find the latest Tesla stock price and save it to the database" ) ``` ### Web Search + Code Execution ```python response = client.responses.create( model="gpt-4o", tools=[ {"type": "web_search_preview"}, {"type": "code_interpreter", "container": {"type": "auto"}} ], input=""" Find the GDP growth rates for G7 countries in 2024, then create a bar chart visualization comparing them. """ ) ``` ## Chat Completions with Search When using the Chat Completions endpoint, remember to add the `-search` suffix: ```python # Without search model="gpt-5" # With search enabled model="gpt-5-search" ``` ### Example with Conversation ```python messages = [ {"role": "system", "content": "You are a helpful assistant with access to current information."}, {"role": "user", "content": "Who won the latest Formula 1 race?"} ] response = client.chat.completions.create( model="gpt-5-search", messages=messages ) # Add assistant response to conversation messages.append(response.choices[0].message) # Continue conversation messages.append({"role": "user", "content": "What were the lap times?"}) response = client.chat.completions.create( model="gpt-5-search", messages=messages ) ``` ## Best Practices ### When to Use Web Search 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** ```python # Less effective "Tell me about climate change" # More effective "What are the latest IPCC findings on global temperature rise published in 2024?" ``` **Include Context** ```python input="Find recent peer-reviewed studies on ketogenic diets for epilepsy treatment, focusing on pediatric applications" ``` **Specify Timeframes** ```python input="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