Create Data Source
client.dataSources.create(DataSourceCreateParams { component, name, source_type, 3 more } params, RequestOptionsoptions?): DataSource { id, component, name, 6 more }
POST/api/v1/data-sources
Create a new data source.
ParametersExpand Collapse
params: DataSourceCreateParams { component, name, source_type, 3 more }
params: DataSourceCreateParams { component, name, source_type, 3 more }
component: Record<string, unknown> | CloudS3DataSource { bucket, aws_access_id, aws_access_secret, 5 more } | CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more } | 9 more
component: Record<string, unknown> | CloudS3DataSource { bucket, aws_access_id, aws_access_secret, 5 more } | CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more } | 9 more
Body param: Component that implements the data source
One of the following:
CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more }
CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more }
CloudSharepointDataSource { client_id, client_secret, tenant_id, 11 more }
CloudSharepointDataSource { client_id, client_secret, tenant_id, 11 more }
exclude_path_patterns?: Array<string> | null
exclude_path_patterns?: Array<string> | null
List of regex patterns for file paths to exclude. Files whose paths (including filename) match any pattern will be excluded. Example: [‘/temp/’, ‘/backup/’, ‘.git/’, ‘.tmp$’, ’^~’]
CloudConfluenceDataSource { authentication_mechanism, server_url, api_token, 10 more }
CloudConfluenceDataSource { authentication_mechanism, server_url, api_token, 10 more }
CloudJiraDataSource { authentication_mechanism, query, api_token, 5 more }
CloudJiraDataSource { authentication_mechanism, query, api_token, 5 more }
CloudJiraDataSourceV2 { authentication_mechanism, query, server_url, 10 more }
CloudJiraDataSourceV2 { authentication_mechanism, query, server_url, 10 more }
CloudBoxDataSource { authentication_mechanism, class_name, client_id, 6 more }
CloudBoxDataSource { authentication_mechanism, class_name, client_id, 6 more }
ReturnsExpand Collapse
DataSource { id, component, name, 6 more }
DataSource { id, component, name, 6 more }
Schema for a data source.
component: Record<string, unknown> | CloudS3DataSource { bucket, aws_access_id, aws_access_secret, 5 more } | CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more } | 9 more
component: Record<string, unknown> | CloudS3DataSource { bucket, aws_access_id, aws_access_secret, 5 more } | CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more } | 9 more
Component that implements the data source
One of the following:
CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more }
CloudAzStorageBlobDataSource { account_url, container_name, account_key, 8 more }
CloudSharepointDataSource { client_id, client_secret, tenant_id, 11 more }
CloudSharepointDataSource { client_id, client_secret, tenant_id, 11 more }
exclude_path_patterns?: Array<string> | null
exclude_path_patterns?: Array<string> | null
List of regex patterns for file paths to exclude. Files whose paths (including filename) match any pattern will be excluded. Example: [‘/temp/’, ‘/backup/’, ‘.git/’, ‘.tmp$’, ’^~’]
CloudConfluenceDataSource { authentication_mechanism, server_url, api_token, 10 more }
CloudConfluenceDataSource { authentication_mechanism, server_url, api_token, 10 more }
CloudJiraDataSource { authentication_mechanism, query, api_token, 5 more }
CloudJiraDataSource { authentication_mechanism, query, api_token, 5 more }
CloudJiraDataSourceV2 { authentication_mechanism, query, server_url, 10 more }
CloudJiraDataSourceV2 { authentication_mechanism, query, server_url, 10 more }
CloudBoxDataSource { authentication_mechanism, class_name, client_id, 6 more }
CloudBoxDataSource { authentication_mechanism, class_name, client_id, 6 more }
custom_metadata?: Record<string, Record<string, unknown> | Array<unknown> | string | 2 more | null> | null
custom_metadata?: Record<string, Record<string, unknown> | Array<unknown> | string | 2 more | null> | null
Create Data Source
import LlamaCloud from '@llamaindex/llama-cloud';
const client = new LlamaCloud({
apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});
const dataSource = await client.dataSources.create({
component: { foo: 'bar' },
name: 'name',
source_type: 'S3',
});
console.log(dataSource.id);{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"component": {
"foo": "bar"
},
"name": "name",
"project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"source_type": "S3",
"created_at": "2019-12-27T18:11:19.117Z",
"custom_metadata": {
"foo": {
"foo": "bar"
}
},
"updated_at": "2019-12-27T18:11:19.117Z",
"version_metadata": {
"reader_version": "1.0"
}
}Returns Examples
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"component": {
"foo": "bar"
},
"name": "name",
"project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"source_type": "S3",
"created_at": "2019-12-27T18:11:19.117Z",
"custom_metadata": {
"foo": {
"foo": "bar"
}
},
"updated_at": "2019-12-27T18:11:19.117Z",
"version_metadata": {
"reader_version": "1.0"
}
}