> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/basic-operations/open.md).

# Open a PDF on Server/Desktop

Learn how to open a PDF document from a memory buffer with full source code examples. Explore the process of reading and writing PDF files efficiently using Apryse SDK. The Apryse Server SDK streamlin

To open a PDF document.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// open document from the filesystem
PDFDoc doc = new PDFDoc(filename);

// optionally read a PDF document from a stream
MappedFile file = new MappedFile(filename);
PDFDoc doc_stream = new PDFDoc(file);

// or pass-in a memory buffer
long file_sz = file.FileSize();
FilterReader file_reader = new FilterReader(file);
byte[] mem = new byte[(int) file_sz];
long bytes_read = file_reader.Read(mem);
PDFDoc doc_mem = new PDFDoc(mem, file_sz);

// load from a URL
Uri url = new Uri("https://myserver.com/myfile.pdf");
HttpClient client = new HttpClient();
var file_content = client.GetByteArrayAsync(url);
PDFDoc doc = new PDFDoc(new MemoryStream(file_content));
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
// open document from the filesystem
PDFDoc doc(filename);

// optionally read a PDF document from a stream
MappedFile file(filename);
PDFDoc doc_stream(file);

// or pass-in a memory buffer
size_t file_sz = file.FileSize();
FilterReader file_reader(file);
unsigned char* mem = new unsigned char[file_sz];
file_reader.Read((unsigned char*)mem, file_sz);
PDFDoc doc_mem(mem, file_sz);

// loading from a URL requires an additional
// library, e.g. "urdl" to use istream
string file_content;
int file_sz;
istream url("https://myserver.com/myfile.pdf", ios::binary);
getline(url, file_content, char_traits<char>::eof());
file_sz = url.tellg();
PDFDoc doc(file_content, file_sz);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
// open document from the filesystem
doc := NewPDFDoc(filename)

// optionally read a PDF document from a stream
file := NewMappedFile(filename)
docStream := NewPDFDoc(file)

// or pass-in a memory buffer
fileSZ := file.FileSize()
fileReader := NewFilterReader(file)
mem := fileReader.Read(fileSZ)
memBytes := make([]byte, int(mem.Size()))
for i := 0; i < int(mem.Size()); i++{
  memBytes[i] = mem.Get(i)
}
doc := NewPDFDoc(&memBytes[0], fileSZ)

// load from a URL
resp, _ := http.Get("https://myserver.com/myfile.pdf")
body, _ := ioutil.ReadAll(resp.Body)
doc := NewPDFDoc(&body[0], int64(len(body)))
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
// open document from the filesystem
PDFDoc doc = new PDFDoc(filename);

// optionally read a PDF document from a stream
MappedFile file = new MappedFile(filename);
PDFDoc doc_stream = new PDFDoc(file);

// or pass-in a memory buffer
long file_sz = file.fileSize();
FilterReader file_reader = new FilterReader(file);
byte[] mem = new byte[(int) file_sz];
long bytes_read = file_reader.read(mem);
PDFDoc doc_mem = new PDFDoc(mem, file_sz);

// load from a URL
URL url = new URL("https://myserver.com/myfile.pdf");
PDFDoc doc = new PDFDoc(url.openStream(), url.getContentLength());
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// open document from the filesystem or URL
async function main() {
  const doc = await PDFNet.PDFDoc.createFromURL(filename);

  // optionally read a PDF document from a stream
  const file = await PDFNet.Filter.createURLFilter(filename);
  const doc_stream = await PDFNet.PDFDoc.createFromFilter(file);

  // or pass-in a memory buffer
  const file_sz = await file.size();
  const file_reader = await PDFNet.FilterReader.create(file);
  const mem = await file_reader.read(file_sz);
  const doc_mem = await PDFNet.PDFDoc.createFromBuffer(mem);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
// open document from the filesystem
val doc = PDFDoc(filename)

// optionally read a PDF document from a stream
val file = MappedFile(filename)
val doc_stream = PDFDoc(file)

// or pass-in a memory buffer
val file_sz = file.fileSize()
val file_reader = FilterReader(file)
val mem = ByteArray(file_sz.toInt())
val bytes_read = file_reader.read(mem)
val doc_mem = PDFDoc(mem)

// loading from a URL requires creating
// an instance of OkHttpClient first
val request = Request.Builder().url(url).build()
val response = okHttpClient.newCall(request).execute()
val file_content = response.code
val doc = PDFDoc(file_content)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// open document from the filesystem
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];

// optionally read a PDF document from a stream
PTMappedFile *file = [[PTMappedFile alloc] initWithFilename: filename];
PTPDFDoc *doc_stream = [[PTPDFDoc alloc] initWithStream: file];

// or pass-in a memory buffer
unsigned long file_sz = [file FileSize];
PTFilterReader *file_reader = [[PTFilterReader alloc] initWithFilter: file];
NSData *mem = [file_reader Read: file_sz];
PTPDFDoc *doc_mem = [[PTPDFDoc alloc] initWithBuf: mem buf_size: file_sz];

// load from a URL
NSString *string_url = "https://myserver.com/myfile.pdf";  
NSString* url = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:string_url];
NSData* file_content = [NSData dataWithContentsOfURL:url];
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithBuf: file_content buf_size: file_content.length];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// open document from the filesystem
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)

// optionally read a PDF document from a stream
let file: PTMappedFile = PTMappedFile(filename: filename)
let doc_stream: PTPDFDoc = PTPDFDoc(stream: file)

// or pass-in a memory buffer
let file_sz: UInt = file.fileSize()
let file_reader: PTFilterReader = PTFilterReader(filter: file)
let mem: Data = file_reader.read(file_sz)
let doc_mem: PTPDFDoc = PTPDFDoc(buf: mem, buf_size: file_sz)

// load from a URL
let url = URL(string: "https://myserver.com/myfile.pdf")
let file_content = try Data(contentsOf: url)
let file_size = UInt(file_contents.count)
let doc: PTPDFDoc = PTPDFDoc(buf: file_content, buf_size: file_size)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
// open document from the filesystem
$doc = new PDFDoc($filename);

// optionally read a PDF document from a stream
$file = new MappedFile($filename);
$doc_stream = new PDFDoc($file);

// or pass-in a memory buffer
$file_sz = $file->FileSize();
$file_reader = new FilterReader($file);
$mem = $file_reader->Read($file_sz);
$doc_mem = new PDFDoc($mem, $file_sz);

// load from a URL
$url = 'https://myserver.com/myfile.pdf'
$file_content = file_get_contents($url);
$doc = new PDFDoc($file_content, strlen($file_content));
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
# open document from the filesystem
doc = PDFDoc(filename)

# optionally read a PDF document from a stream
file = MappedFile(filename)
doc_stream = PDFDoc(file)

# or pass-in a memory buffer
file_sz = file.FileSize()
file_reader = FilterReader(file)
mem = file_reader.Read(file_sz)
doc_mem = PDFDoc(bytearray(mem), file_sz)

# loading from a URL requires an additional
# module, e.g. "requests"
url = 'https://myserver.com/myfile.pdf'
file_content = requests.get(url)
doc = PDFDoc(bytearray(file_content.content), len(file_content.content))
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
# open document from the filesystem
doc = PDFDoc.new(filename)

# optionally read a PDF document from a stream
file = MappedFile(filename)
doc_stream = PDFDoc.new(file)

# or pass-in a memory buffer
file_sz = file.FileSize()
file_reader = FilterReader.new(file)
mem = file_reader.Read(file_sz)
doc_mem = PDFDoc.new(mem, file_sz)

# loading from a URL requires the
# standard module "open-uri"
file_content = open('https://myserver.com/myfile.pdf') { |f| f.read }
doc = PDFDoc.new(file_content, file_content.size);
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
' open document from the filesystem
Dim doc as PDFDoc = New PDFDoc(filename)

' optionally read a PDF document from a stream
Dim file As MappedFile = New MappedFile(filename)
Dim doc_stream As PDFDoc = New PDFDoc(file)

' or pass-in a memory buffer
Dim file_sz As Long = file.FileSize()
Dim file_reader As FilterReader = New FilterReader(file)
Dim mem(file_sz) As Byte
Dim bytes_read As Long = file_reader.Read(mem)
Dim doc_mem As PDFDoc = New PDFDoc(mem, file_sz)

' load from a URL
Dim url As String = "https://myserver.com/myfile.pdf"
Dim web_client As WebClient = New WebClient()
Dim stream_reader As StreamReader = New StreamReader(web_client.OpenRead(url))
Dim mem() As Byte = System.Text.Encoding.UTF8.GetBytes(stream_reader.ReadToEnd)
Dim doc As PDFDoc = New PDFDoc(mem, Len(mem))
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Read & write a PDF file from/to memory buffer](/core/get-started/samples/pdfdocmemorytest.md) Full source code which illustrates how to read/write a PDF document from/to memory buffer. This is useful for applications that work with dynamic PDF documents that don't need to be saved/read from a disk.

## About opening a document

The PDFDoc constructor creates a PDF document from scratch:

{% hint style="warning" %}
**PDFDoc.Close()**

When you are finished with a PDFDoc object, the PDFDoc.Close() method should be called to clean up memory, file handles, and resources.
{% endhint %}

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFDoc new_doc = new PDFDoc();
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc doc;
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
doc := NewPDFDoc()
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc();
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const doc = await PDFNet.PDFDoc.create();
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val doc = PDFDoc()
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFDoc *doc = [[PTPDFDoc alloc] init];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc()
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$doc = new PDFDoc();
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
doc = PDFDoc()
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
doc = PDFDoc.new()
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim doc As PDFDoc = New PDFDoc()
```

{% endcode %}
{% endtab %}
{% endtabs %}

A newly-created document does not yet contain any pages. See the [accessing pages](/core/basic-operations/pages.md) section for details on creating new pages and working with existing pages.

Using Apryse SDK, you can open a document from a serialized file, from a memory buffer, or from a Filter stream.

To open an existing PDF document from a file, specify its file path in the PDFDoc constructor:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFDoc new_doc = new PDFDoc(filename);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc doc(filename);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
doc := NewPDFDoc(filename)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc(filename);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const doc = await PDFNet.PDFDoc.createFromURL(filename);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val doc = PDFDoc(filename)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFDoc doc = [[PTPDFDoc alloc] initWithFilePath: filename];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$doc = new PDFDoc($filename);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
doc = PDFDoc(filename)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
doc = PDFDoc.new(filename)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim doc as PDFDoc = New PDFDoc(filename)
```

{% endcode %}
{% endtab %}
{% endtabs %}

Here's how to open an existing PDF document from a memory buffer:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
MappedFile file = new MappedFile(filename);
long file_sz = file.FileSize();
FilterReader file_reader = new FilterReader(file);
byte[] mem = new byte[(int) file_sz];
long bytes_read = file_reader.Read(mem);
PDFDoc doc_mem = new PDFDoc(mem, file_sz);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
MappedFile file(filename);
size_t file_sz = file.FileSize();
FilterReader file_reader(file);
unsigned char* mem = new unsigned char[file_sz];
file_reader.Read((unsigned char*)mem, file_sz);
PDFDoc doc(mem, file_sz);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
file := NewMappedFile(filename)
fileSZ := file.FileSize()
fileReader := NewFilterReader(file)
mem := fileReader.Read(fileSZ)
memBytes := make([]byte, int(mem.Size()))
for i := 0; i < int(mem.Size()); i++{
    memBytes[i] = mem.Get(i)
}
doc := NewPDFDoc(&memBytes[0], fileSZ)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
MappedFile file = new MappedFile(filename);
long file_sz = file.fileSize();
FilterReader file_reader = new FilterReader(file);
byte[] mem = new byte[(int) file_sz];
long bytes_read = file_reader.read(mem);
PDFDoc doc_mem = new PDFDoc(mem, file_sz);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const file = await PDFNet.Filter.createURLFilter(filename);
  const file_sz = await file.size();
  const file_reader = await PDFNet.FilterReader.create(file);
  const mem = await file_reader.read(file_sz);
  const doc_mem = await PDFNet.PDFDoc.createFromBuffer(mem);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val file = MappedFile(filename)
val file_sz = file.fileSize()
val file_reader = FilterReader(file)
val mem = ByteArray(file_sz.toInt())
val bytes_read = file_reader.read(mem)
val doc_mem = PDFDoc(mem)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTMappedFile *file = [[PTMappedFile alloc] initWithFilename: filename];
unsigned long file_sz = [file FileSize];
PTFilterReader *file_reader = [[PTFilterReader alloc] initWithFilter: file];
NSData *mem = [file_reader Read: file_sz];
PTPDFDoc *doc_mem = [[PTPDFDoc alloc] initWithBuf: mem buf_size: file_sz];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let file: PTMappedFile = PTMappedFile(filename: filename)
let file_sz: UInt = file.fileSize()
let file_reader: PTFilterReader = PTFilterReader(filter: file)
let mem: Data = file_reader.read(file_sz)
let doc_mem: PTPDFDoc = PTPDFDoc(buf: mem, buf_size: file_sz)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$file = new MappedFile($filename);
$file_sz = $file->FileSize();
$file_reader = new FilterReader($file);
$mem = $file_reader->Read($file_sz);
$doc_mem = new PDFDoc($mem, $file_sz);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
file = MappedFile(filename)
file_sz = file.FileSize()
file_reader = FilterReader(file)
mem = file_reader.Read(file_sz)
doc = PDFDoc(bytearray(mem), file_sz)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
file = MappedFile(filename)
file_sz = file.FileSize()
file_reader = FilterReader.new(file)
mem = file_reader.Read(file_sz)
doc = PDFDoc.new(mem, file_sz)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim file As MappedFile = New MappedFile(filename)
Dim file_sz As Long = file.FileSize()
Dim file_reader As FilterReader = New FilterReader(file)
Dim mem(file_sz) As Byte
Dim bytes_read As Long = file_reader.Read(mem)
Dim doc_mem As PDFDoc = New PDFDoc(mem, file_sz)
```

{% endcode %}
{% endtab %}
{% endtabs %}

It's also easy to open a PDF document from a [MemoryFilter or a custom Filter ](/core/low-level-pdf-api/filters.md).

After creating a PDFDoc object, it's good practice to call `InitSecurityHandler()` on it. If the document is encrypted, calling the method will decrypt it. If the document is not encrypted, calling the method is harmless.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFDoc doc = new PDFDoc(filename);
if (!doc.InitSecurityHandler())
{
  Console.WriteLine("Document authentication error...");
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc doc(filename);
if (!doc.InitSecurityHandler())
{
  printf("Document authentication error...");
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
doc := NewPDFDoc(filename)
if !doc.InitSecurityHandler()
{
  fmt.Println("Document authentication error...");
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc(filename);
if (!doc.initSecurityHandler())
{
  println("Document authentication error...");
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const doc = await PDFNet.PDFDoc.createFromURL(filename);
  if (!doc.initSecurityHandler()) {
    console.log("Document authentication error...");
    return;
  }
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val doc = PDFDoc(filename)
if (!doc.initSecurityHandler())
{
  println("Document authentication error...")
  return
}
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilePath: filename];
if (![doc InitSecurityHandler])
{
  printf("Document authentication error...");
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
if (!doc.InitSecurityHandler())
{
  print("Document authentication error...")
  return
}
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$doc = new PDFDoc($filename);
if (!$doc->InitSecurityHandler())
{
  echo "Document authentication error...";
  return;
}
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
doc = PDFDoc(filename)
if not doc.InitSecurityHandler():
  print("Document authentication error...")
  return
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
doc = PDFDoc.new(filename)
if !doc.InitSecurityHandler()
  puts "Document authentication error..."
  return
end
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim doc as PDFDoc = New PDFDoc(filename)
If Not doc.InitSecurityHandler() Then
  Console.Write("Document authentication error...")
  Return
End If
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/basic-operations/open.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
