# Internet Search

The `internet_search` tool is a **built-in tool** automatically available on all `/v1/chat/completions` requests. It uses **Perplexity AI Sonar** under the hood to search the live web and return a synthesized answer with citations. You don't configure it — the model invokes it automatically when the prompt requires real-time or current information.

### How It Works

1. You send a normal chat request with a question that needs current data
2. The LLM detects it needs fresh web data and calls `internet_search` internally
3. The tool queries **Perplexity Sonar** (`temperature: 0.1` for accuracy) with your query
4. Perplexity returns a synthesized answer + citation URLs
5. The model wraps the answer into a standard chat completion response

#### Streaming Behavior

Unlike image generation (which delivers the result at the end), internet search **integrates naturally with streaming**. The stream shows:

1. A `tool_calls` chunk announcing `internet_search` was invoked
2. Immediately followed by content chunks streaming the answer word-by-word
3. A final `[DONE]` chunk
4. A trailing `usage` data chunk (if `stream_options.include_usage: true`)

```json
data: {"delta":{"tool_calls":[{"function":{"name":"internet_search",...}}]}}
data: {"delta":{"content":"As"}}
data: {"delta":{"content":" of"}}
...
data: [DONE]
data: {"usage":{...}}

```

### Use Cases & Examples

#### 1. Breaking News / Current Events

```json
{
  "model": "google/gemini-2.5-flash",
  "messages": [
    { "role": "user", "content": "What are the latest AI news today?" }
  ]
}
```

#### 2. Live Price / Market Data

```json
{
  "model": "google/gemini-2.5-flash",
  "messages": [
    { "role": "user", "content": "What is the current price of Bitcoin?" }
  ]
}

```

#### 3. Combining Search + Reasoning&#xD;&#x20;&#xD;

```json
{
  "model": "google/gemini-2.5-flash",
  "messages": [
    {
      "role": "user",
      "content": "Search for the latest GPT-5 benchmarks and summarize how it compares to Claude Sonnet"
    }
  ]
}

```

#### 4. Technical / Developer Queries&#xD;&#x20;&#xD;

```json
{
  "model": "google/gemini-2.5-flash",
  "messages": [
    { "role": "user", "content": "What are the breaking changes in Bun 2.0?" }
  ]
}

```

### Tips & Best Practices

| Tip                          | Details                                                                           |
| ---------------------------- | --------------------------------------------------------------------------------- |
| **Ask naturally**            | No special syntax needed — the model detects when to search automatically         |
| **Be specific**              | "Latest React 19 release notes" works better than "React news"                    |
| **Date context helps**       | Adding "as of today" or "current" reinforces real-time lookup                     |
| **Streaming for UX**         | Use `stream: true` — answers start flowing within \~1s while search runs          |
| **Cost vs knowledge cutoff** | For questions within the model's training data, search won't trigger (saves cost) |
| **Citations in output**      | The model includes source links inline — these are real URLs from Perplexity      |

***

### Limitations

* Powered by `perplexity/sonar` — accuracy depends on Perplexity's index freshness
* No control over `numResults` from the request body — handled internally (default 5 citations)
* Does not return raw search results, only the synthesized Perplexity answer
* Adds latency (\~1–3s) compared to non-search requests
* `temperature` is fixed at `0.1` internally for factual accuracy — not overridable


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qolaba.ai/api-platform/api-platform/openai-compatible-chat/built-in-tools/internet-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
