following code demonstrates how to load an object from the Huawei OBS (Object Storage Service) as document.# Install the required package# pip install esdk-obs-pythonfrom langchain.document_loaders.obs_file import OBSFileLoaderendpoint = "your-endpoint"from obs import ObsClientobs_client = ObsClient(access_key_id="your-access-key", secret_access_key="your-secret-key", server=endpoint)loader = OBSFileLoader("your-bucket-name", "your-object-key", client=obs_client)loader.load()Each Loader with Separate Authentication Information‚ÄãIf you don't need to reuse OBS connections between different loaders, you can directly configure the config. The loader will use the config information to initialize its own OBS client.# Configure your access credentials\nconfig = {    "ak": "your-access-key",    "sk": "your-secret-key"}loader = OBSFileLoader("your-bucket-name", "your-object-key",endpoint=endpoint, config=config)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 = OBSFileLoader("your-bucket-name", "your-object-key", endpoint=endpoint, config=config)loader.load()Access a Publicly Accessible Object‚ÄãIf the object you want to access allows anonymous user access (anonymous users have GetObject permission), you can directly load the object without configuring the config parameter.loader = OBSFileLoader("your-bucket-name", "your-object-key", endpoint=endpoint)loader.load()PreviousHuawei OBS DirectoryNextHuggingFace datasetEach Loader with Separate Authentication InformationGet Authentication Information from ECSAccess a Publicly Accessible ObjectCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
The following code demonstrates how to load an object from the Huawei OBS (Object Storage Service) as document.
The following code demonstrates how to load an object from the Huawei OBS (Object Storage Service) as document. ->: following code demonstrates how to load an object from the Huawei OBS (Object Storage Service) as document.# Install the required package# pip install esdk-obs-pythonfrom langchain.document_loaders.obs_file import OBSFileLoaderendpoint = "your-endpoint"from obs import ObsClientobs_client = ObsClient(access_key_id="your-access-key", secret_access_key="your-secret-key", server=endpoint)loader = OBSFileLoader("your-bucket-name", "your-object-key", client=obs_client)loader.load()Each Loader with Separate Authentication Information‚ÄãIf you don't need to reuse OBS connections between different loaders, you can directly configure the config. The loader will use the config information to initialize its own OBS client.# Configure your access credentials\nconfig = {    "ak": "your-access-key",    "sk": "your-secret-key"}loader = OBSFileLoader("your-bucket-name", "your-object-key",endpoint=endpoint, config=config)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 = OBSFileLoader("your-bucket-name", "your-object-key", endpoint=endpoint, config=config)loader.load()Access a Publicly Accessible Object‚ÄãIf the object you want to access allows anonymous user access (anonymous users have GetObject permission), you can directly load the object without configuring the config parameter.loader = OBSFileLoader("your-bucket-name", "your-object-key", endpoint=endpoint)loader.load()PreviousHuawei OBS DirectoryNextHuggingFace datasetEach Loader with Separate Authentication InformationGet Authentication Information from ECSAccess a Publicly Accessible ObjectCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.