Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api-reference/partition/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Here's how you can modify partition strategy for a PDF file, and select an alter
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down Expand Up @@ -321,7 +321,7 @@ For better OCR results, you can specify what languages your document is in using
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down Expand Up @@ -488,7 +488,7 @@ Set the `coordinates` parameter to `true` to add this field to the elements in t
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down Expand Up @@ -663,7 +663,7 @@ This can be helpful if you'd like to use the IDs as a primary key in a database,
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down Expand Up @@ -839,7 +839,7 @@ By default, the `chunking_strategy` is set to `None`, and no chunking is perform
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down
6 changes: 3 additions & 3 deletions api-reference/partition/get-elements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The programmatic approach you take to get these document elements will depend on
}).then((res) => {
if (res.statusCode == 200) {
// Do something with the elements, for example:
saveElementsToFile(res.elements)
saveElementsToFile(res)
}
} // ...
```
Expand All @@ -124,7 +124,7 @@ The programmatic approach you take to get these document elements will depend on
}
}).then((res) => {
if (res.statusCode == 200) {
res.elements?.forEach(element => {
res.forEach(element => {
// Do something with each element, for example:
saveElementToDatabase(`${element["element_id"]}`)
saveElementToDatabase(`${element["text"]}`)
Expand Down Expand Up @@ -152,7 +152,7 @@ The programmatic approach you take to get these document elements will depend on
}
}).then((res) => {
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)

fs.writeFileSync(outputFilepath, jsonElements)
}
Expand Down
4 changes: 2 additions & 2 deletions api-reference/partition/sdk-jsts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import GetStartedSimpleAPIOnly from '/snippets/general-shared-text/get-started-s
console.log(res.elements?.[0])

// Write the processed data to a local file.
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)

fs.writeFileSync("PATH_TO_OUTPUT_FILE", jsonElements)
}
Expand Down Expand Up @@ -257,7 +257,7 @@ import GetStartedSimpleAPIOnly from '/snippets/general-shared-text/get-started-s
// If successfully processed, write the processed data to
// the destination directory.
if (res.statusCode == 200) {
const jsonElements = JSON.stringify(res.elements, null, 2)
const jsonElements = JSON.stringify(res, null, 2)
fs.writeFileSync(outputPath + ".json", jsonElements)
}
}).catch((e) => {
Expand Down
4 changes: 2 additions & 2 deletions snippets/examples/huggingchat.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ client.general.partition({
if (res.statusCode == 200) {
let voting_texts = ""

if (res.elements)
for (const element of res.elements) {
if (res)
for (const element of res) {
if (element.text.includes("vot")) {
voting_texts += " " + element.text;
}
Expand Down