Giter VIP home page Giter VIP logo

Comments (3)

dosubot avatar dosubot commented on June 30, 2024 2

Hello, @andrewdoro! I'm here to help you with any bugs, questions, or contributions. Let's work together to resolve your issue.

To address the issue of the default API option when running UnstructuredLoader locally, you can add the following code snippet to the local setup section of the documentation:

/**
 * Local setup for UnstructuredLoader with default API option.
 * Ensure the `apiUrl` is set to "http://localhost:8000/general/v0/general".
 * @example
 * ```typescript
 * const loader = new UnstructuredLoader("path/to/file", {
 *   apiUrl: "http://localhost:8000/general/v0/general",
 *   apiKey: "YOUR_API_KEY", // Optional if your local setup requires it
 * });
 * const docs = await loader.load();
 * ```
 */

This snippet ensures that the apiUrl points to the local server, avoiding the default API and preventing the "API key is malformed" error [1][2].

Details

About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

from langchainjs.

bracesproul avatar bracesproul commented on June 30, 2024

You're still required to provide an API key even if running locally. Sign up for one here (free), and they'll send you an email with a key.

from langchainjs.

andrewdoro avatar andrewdoro commented on June 30, 2024

I understand that I need the key to use their API.

For the local instance I was able to run it locally without an API Key by using the docker setup. I literally just used stuff, it's not a placeholder.

 const loader = new UnstructuredLoader(`pdfs/${randomName}.pdf`, {
   apiUrl: "http://localhost:8000/general/v0/general",
   apiKey: "stuff",
   strategy: "hi_res",
 });

This issue was related to the local setup of Unstructured. According to docs you can run this docker command to start a local instance.

docker run -p 8000:8000 -d --rm --name unstructured-api quay.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0

To actually consume this instance you also have to add the apiUrl. I'm proposing adding this to the docs for people wanting to run unstructured locally:
apiUrl: "http://localhost:8000/general/v0/general",

from langchainjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.