Skip to content

Commit

Permalink
[Docs] making documentation consistent (#15069)
Browse files Browse the repository at this point in the history
  • Loading branch information
barduinor authored Jul 31, 2024
1 parent ade38d9 commit 33774fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ ccg_conf = CCGConfig(
)
auth = BoxCCGAuth(ccg_conf)
client = BoxClient(auth)
reader = BoxReader(box_client=client)

box_client = BoxClient(auth)
reader = BoxReader(box_client=client)
```

### Load data
Expand Down Expand Up @@ -58,10 +57,10 @@ processes them into a structured format using a SimpleDirectoryReader.

```python
# Using a list of file ids
docs = reader.load_data(file_ids=[test_data["test_csv_id"]])
docs = reader.load_data(file_ids=["test_csv_id"])

# Using a folder id
docs = reader.load_data(folder_id=test_data["test_folder_id"])
docs = reader.load_data(folder_id="test_folder_id")
```

### Load resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A reader class for loading data from Box files using Box AI Extract.

This class inherits from the `BoxReaderBase` class and specializes in
processing data from Box files using Box AI Extract. It utilizes the
provided BoxClient object to interact with the Box API and extracts
provided `BoxClient` object to interact with the Box API and extracts
data based on a specified AI prompt.

> [!IMPORTANT]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ reader = BoxReaderAIPrompt(box_client=client)

Extracts data from Box files using a custom AI prompt and creates Document objects.

This method utilizes a user-provided AI prompt to potentially extract
more specific data from the Box files compared to pre-configured AI
services like Box AI Extract. It then creates Document objects containing
the extracted data along with file metadata.
This method utilizes a user-provided AI prompt to extract data from the Box files.
It then creates Document objects containing the extracted data along with file metadata.

#### Args:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ Load data from a specific resource.
#### Args:

- **`resource (str)`**: The resource identifier.
- **`ai_prompt (str)`**: The custom AI prompt that specifies what data to
extract from the files.

#### Returns:

Expand Down Expand Up @@ -186,45 +184,3 @@ resource = reader.get_resource_info(file_id=test_data["test_csv_id"])
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index).

## Parameters

### box_client

The Box Client represent the set for a Box API connection. It can be created using either the Client Credential Grant (CCG) or JSON Web Tokens (JWT).

It will cache the access tokens, reusing them for subsequent requests, and automatically refresh them when they expire.

### folder_id

You can extract a folder_id directly from its drive URL.

For example, the folder_id of `https://app.box.com/folder/273980493541` is `273980493541`.

### is_recursive

The reader can transverse the folder recursively to get all the files inside the folder, and its sub-folders.

> [!WARNING]
> There can be an overwhelming amount of files and folders, at which point the reader becomes impractical.
### file_ids

You can extract a file_id directly from its sharable drive URL.

For example, the file_id of `https://app.box.com/file/1584054196674` is `1584054196674`.

The reader expects a list of file ids as strings to load the files.

<!---
### query_string
You can also filter the files by the query string e.g.: `query_string="name contains 'test'"`
It gives more flexibility to filter the documents. More info: https://developers.google.com/drive/api/v3/search-files
--->

## Usage

#### With CCG authentication

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index).

0 comments on commit 33774fb

Please sign in to comment.