Skip to content

chore/set pdf page splitting to true by default #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 17, 2024

Conversation

awalker4
Copy link
Collaborator

@awalker4 awalker4 commented Jun 17, 2024

Mirror of Unstructured-IO/unstructured-python-client#118

  • Set the split_pdf_page default to true and run make client-generate locally.
  • Update the readme, add another reference back to our docs, bring back some autogenerated sections like in the python repo
  • Change some warning logs to info. The user should not be warned about default behavior for non pdf files

Testing

Use the client locally and verify that split mode is the default, and that the dev experience is good

  • Create a new test dir and run npm init -y; npm install typescript tsx
  • Check out this branch and install from your test dir: npm i file:~/repos/unstructured-js-client
  • Run this sample script. Try some different files in and verify that the logging and results look acceptable.

npx tsx unstructured.ts

import { UnstructuredClient } from "unstructured-client";
import { PartitionResponse } from "unstructured-client/sdk/models/operations";
import { Strategy } from "unstructured-client/sdk/models/shared";
import * as fs from "fs";

const key = "free-api-key";

const client = new UnstructuredClient({
    security: {
        apiKeyAuth: key,
    },
});

const filename = "fake-html.html";
const data = fs.readFileSync(filename);

client.general.partition({
    partitionParameters: {
        files: {
            content: data,
            fileName: filename,
        },
        strategy: Strategy.Auto,
    }
}).then((res: PartitionResponse) => {
    if (res.statusCode == 200) {
        console.log(res.elements);
    }
}).catch((e) => {
    if (e.statusCode) {
      console.log(e.statusCode);
      console.log(e.body);
    } else {
      console.log(e);
    }
});

awalker4 added 3 commits June 17, 2024 14:36
This avoids an import error for me locally, so it may help other users.
Add links back to our docs, and reintroduce some autogenerated readme sections.
@awalker4 awalker4 force-pushed the chore/splitting-default branch from 49e2d01 to 9189e1d Compare June 17, 2024 19:11
Copy link
Contributor

@christinestraub christinestraub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@awalker4 awalker4 enabled auto-merge (squash) June 17, 2024 23:26
@awalker4 awalker4 merged commit 78b5d57 into main Jun 17, 2024
2 checks passed
@awalker4 awalker4 deleted the chore/splitting-default branch June 17, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants