To use this loader, you’ll need to have Unstructured already set up and ready to use at an available URL endpoint. It can also be configured to run locally.See the docs here for information on how to do that.You’ll also need to install the official Google Cloud Storage SDK:
Once Unstructured is configured, you can use the Google Cloud Storage loader to load files and then convert them into a Document.In addition, you can optionally provide a storageOptions parameter to specify not only your storage options but also other authentication ways if you don’t want Application Default Credentials(ADC) as default manner.
Copy
Ask AI
import { GoogleCloudStorageLoader } from "@langchain/community/document_loaders/web/google_cloud_storage";const loader = new GoogleCloudStorageLoader({ bucket: "my-bucket-123", file: "path/to/file.pdf", storageOptions: { keyFilename: "/path/to/keyfile.json", }, unstructuredLoaderOptions: { apiUrl: "http://localhost:8000/general/v0/general", apiKey: "", // this will be soon required },});const docs = await loader.load();console.log(docs);
Assistant
Responses are generated using AI and may contain mistakes.