Skip to content

Commit 49e2d01

Browse files
committed
Update readme for split page being true by default
Add links back to our docs, and reintroduce some autogenerated readme sections.
1 parent 59d21c4 commit 49e2d01

File tree

1 file changed

+18
-63
lines changed

1 file changed

+18
-63
lines changed

README.md

Lines changed: 18 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
1010
</div>
1111

12-
<h2 align="center">
13-
<p>Typescript SDK for the Unstructured API</p>
14-
</h2>
15-
16-
This is a Typescript client for the [Unstructured API](https://unstructured-io.github.io/unstructured/api.html).
17-
1812
<div align="center">
1913

2014
<a
@@ -24,6 +18,13 @@ This is a Typescript client for the [Unstructured API](https://unstructured-io.g
2418

2519
</div>
2620

21+
<h2 align="center">
22+
<p>Typescript SDK for the Unstructured API</p>
23+
</h2>
24+
25+
This is a Typescript client for the [Unstructured API](https://unstructured-io.github.io/unstructured/api.html).
26+
27+
Please refer to the [Unstructured docs](https://docs.unstructured.io/api-reference/api-services/sdk) for a full guide to using the client.
2728

2829
## SDK Installation
2930

@@ -40,45 +41,10 @@ yarn add unstructured-client --dev
4041
```
4142
<!-- No SDK Installation -->
4243

43-
## SDK Example Usage
44-
Only the `files` parameter is required for partition. See the [general partition](docs/sdks/general/README.md) page for all available parameters.
45-
46-
```typescript
47-
import { UnstructuredClient } from "unstructured-client";
48-
import { PartitionResponse } from "unstructured-client/dist/sdk/models/operations";
49-
import * as fs from "fs";
50-
51-
const key = "YOUR-API-KEY";
52-
53-
const client = new UnstructuredClient({
54-
security: {
55-
apiKeyAuth: key,
56-
},
57-
// uncomment and change the URL below depending on which services you use or hosting locally; see below for more details
58-
// by default it will make requests againt the url for the freemium (https://unstructured.io/api-key-free) API service
59-
// serverURL: "http://localhost:8000",
60-
});
44+
<!-- Start SDK Example Usage [usage] -->
45+
<!-- End SDK Example Usage [usage] -->
6146

62-
const filename = "sample-docs/layout-parser-paper.pdf";
63-
const data = fs.readFileSync(filename);
64-
65-
client.general.partition({
66-
// Note that this currently only supports a single file
67-
files: {
68-
content: data,
69-
fileName: filename,
70-
},
71-
// Other partition params
72-
strategy: "fast",
73-
}).then((res: PartitionResponse) => {
74-
if (res.statusCode == 200) {
75-
console.log(res.elements);
76-
}
77-
}).catch((e) => {
78-
console.log(e.statusCode);
79-
console.log(e.body);
80-
});
81-
```
47+
Refer to the [API parameters page](https://docs.unstructured.io/api-reference/api-services/api-parameters) for all available parameters.
8248

8349
## Change the base URL
8450

@@ -157,24 +123,19 @@ httpClient.addHook("requestError", (error, request) => {
157123
const sdk = new UnstructuredClient({ httpClient });
158124
```
159125
<!-- End Custom HTTP Client [http-client] -->
160-
<!-- No Retries -->
161-
<!-- No Authentication -->
162126

163-
## PartitionParameters
164-
165-
See the [general partition](docs/sdk/models/shared/partitionparameters.md) page for all available parameters.
127+
<!-- Start Retries [retries] -->
128+
<!-- End Retries [retries] -->
166129

167130
### Splitting PDF by pages
168131

169-
In order to speed up processing of long PDF files, set `splitPdfPage` parameter to `true`. It will cause the PDF to be split into smaller batches at client side, before sending to API, and combining individual responses as single result. This will work only for PDF files, so don't set it for other types of files. Size of each batch is determined internally and it can vary between 2 and 20 pages per split.
170-
171-
The amount of parallel requests is controlled by `splitPdfConcurrencyLevel` parameter. By default it equals to 5. It can't be more than 15, to avoid too high resource usage and costs.
132+
See [page splitting](https://docs.unstructured.io/api-reference/api-services/sdk#page-splitting) for more details.
172133

173-
```typescript
174-
import { SplitPdfHook } from "unstructured-client/hooks/custom/SplitPdfHook";
134+
In order to speed up processing of large PDF files, the client splits up PDFs into smaller files, sends these to the API concurrently, and recombines the results. `splitPdfPage` can be set to `false` to disable this.
175135

176-
...
136+
The amount of parallel requests is controlled by `splitPdfConcurrencyLevel` parameter. By default it equals to 5. It can't be more than 15, to avoid too high resource usage and costs. The size of each batch is determined internally and it can vary between 2 and 20 pages per split.
177137

138+
```typescript
178139
client.general.partition({
179140
partitionParameters: {
180141
files: {
@@ -186,14 +147,7 @@ client.general.partition({
186147
// Modify splitPdfConcurrencyLevel to change the limit of parallel requests
187148
splitPdfConcurrencyLevel: 10,
188149
},
189-
}).then((res: PartitionResponse) => {
190-
if (res.statusCode == 200) {
191-
console.log(res.elements);
192-
}
193-
}).catch((e) => {
194-
console.log(e.statusCode);
195-
console.log(e.body);
196-
});
150+
}};
197151
```
198152
199153
<!-- Start Requirements [requirements] -->
@@ -244,6 +198,7 @@ run();
244198
```
245199
<!-- End File uploads [file-upload] -->
246200
201+
<!-- No Authentication -->
247202
<!-- Placeholder for Future Speakeasy SDK Sections -->
248203
249204
### Maturity

0 commit comments

Comments
 (0)