DirectoryThe following code demonstrates how to load objects from the Huawei OBS (Object Storage Service) as documents.# Install the required package# pip install esdk-obs-pythonfrom langchain.document_loaders import OBSDirectoryLoaderendpoint = "your-endpoint"# Configure your access credentials\nconfig = {    "ak": "your-access-key",    "sk": "your-secret-key"}loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config)loader.load()Specify a Prefix for Loading‚ÄãIf you want to load objects with a specific prefix from the bucket, you can use the following code:loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config, prefix="test_prefix")loader.load()Get Authentication Information from ECS‚ÄãIf your langchain is deployed on Huawei Cloud ECS and Agency is set up, the loader can directly get the security token from ECS without needing access key and secret key. config = {"get_token_from_ecs": True}loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config)loader.load()Use a Public Bucket‚ÄãIf your bucket's bucket policy allows anonymous access (anonymous users have listBucket and GetObject permissions), you can directly load the objects without configuring the config parameter.loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint)loader.load()PreviousHacker NewsNextHuawei OBS FileSpecify a Prefix for LoadingGet Authentication Information from ECSUse a Public BucketCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
The following code demonstrates how to load objects from the Huawei OBS (Object Storage Service) as documents.
The following code demonstrates how to load objects from the Huawei OBS (Object Storage Service) as documents. ->: DirectoryThe following code demonstrates how to load objects from the Huawei OBS (Object Storage Service) as documents.# Install the required package# pip install esdk-obs-pythonfrom langchain.document_loaders import OBSDirectoryLoaderendpoint = "your-endpoint"# Configure your access credentials\nconfig = {    "ak": "your-access-key",    "sk": "your-secret-key"}loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config)loader.load()Specify a Prefix for Loading‚ÄãIf you want to load objects with a specific prefix from the bucket, you can use the following code:loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config, prefix="test_prefix")loader.load()Get Authentication Information from ECS‚ÄãIf your langchain is deployed on Huawei Cloud ECS and Agency is set up, the loader can directly get the security token from ECS without needing access key and secret key. config = {"get_token_from_ecs": True}loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint, config=config)loader.load()Use a Public Bucket‚ÄãIf your bucket's bucket policy allows anonymous access (anonymous users have listBucket and GetObject permissions), you can directly load the objects without configuring the config parameter.loader = OBSDirectoryLoader("your-bucket-name", endpoint=endpoint)loader.load()PreviousHacker NewsNextHuawei OBS FileSpecify a Prefix for LoadingGet Authentication Information from ECSUse a Public BucketCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.