All URIs are relative to https://api.carbon.ai
Method | HTTP request | Description |
---|---|---|
createFileTagsCreateUserFileTagsPost | POST /create_user_file_tags | Create File Tags |
createRawTextUploadTextPost | POST /upload_text | Create Raw Text |
createUploadFileFromUrlUploadFileFromUrlPost | POST /upload_file_from_url | Create Upload File From Url |
createUploadFileUploadfilePost | POST /uploadfile | Create Upload File |
deleteFileEndpointDeletefileFileIdDelete | DELETE /deletefile/{file_id} | Delete File Endpoint |
deleteFileTagsDeleteUserFileTagsPost | POST /delete_user_file_tags | Delete File Tags |
deleteFilesEndpointDeleteFilesPost | POST /delete_files | Delete Files Endpoint |
parsedFileParsedFileFileIdGet | GET /parsed_file/{file_id} | Parsed File |
rawFileRawFileFileIdGet | GET /raw_file/{file_id} | Raw File |
resyncFileResyncFilePost | POST /resync_file | Resync File |
userFilesUserFilesPost | POST /user_files | User Files |
userFilesV2UserFilesV2Post | POST /user_files_v2 | User Files V2 |
UserFile createFileTagsCreateUserFileTagsPost(authorization, organizationUserFileTagCreate, opts)
Create File Tags
A tag is a key-value pair that can be added to a file. This pair can then be used for searches (e.g. embedding searches) in order to narrow down the scope of the search. A file can have any number of tags. The following are reserved keys that cannot be used: - db_embedding_id - organization_id - user_id - organization_user_file_id Carbon currently supports two data types for tag values - `string` and `list<string>`. Keys can only be `string`. If values other than `string` and `list<string>` are used, they're automatically converted to strings (e.g. 4 will become "4").
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let organizationUserFileTagCreate = new CarbonJsSdk.OrganizationUserFileTagCreate(); // OrganizationUserFileTagCreate |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.createFileTagsCreateUserFileTagsPost(authorization, organizationUserFileTagCreate, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
organizationUserFileTagCreate | OrganizationUserFileTagCreate | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
UserFile createRawTextUploadTextPost(authorization, rawTextInput, opts)
Create Raw Text
Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0. The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, do not set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let rawTextInput = new CarbonJsSdk.RawTextInput(); // RawTextInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.createRawTextUploadTextPost(authorization, rawTextInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
rawTextInput | RawTextInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
UserFile createUploadFileFromUrlUploadFileFromUrlPost(authorization, uploadFileFromUrlInput, opts)
Create Upload File From Url
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let uploadFileFromUrlInput = new CarbonJsSdk.UploadFileFromUrlInput(); // UploadFileFromUrlInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.createUploadFileFromUrlUploadFileFromUrlPost(authorization, uploadFileFromUrlInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
uploadFileFromUrlInput | UploadFileFromUrlInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
UserFile createUploadFileUploadfilePost(authorization, file, opts)
Create Upload File
This endpoint is used to directly upload local files to Carbon. The `POST` request should be a multipart form request. Note that the `set_page_as_boundary` query parameter is applicable only to PDFs for now. When this value is set, PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description of all possible query parameters: - `chunk_size`: the chunk size (in tokens) applied when splitting the document - `chunk_overlap`: the chunk overlap (in tokens) applied when splitting the document - `skip_embedding_generation`: whether or not to skip the generation of chunks and embeddings - `set_page_as_boundary`: described above - `embedding_model`: the model used to generate embeddings for the document chunks - `use_ocr`: whether or not to use OCR as a preprocessing step prior to generating chunks (only valid for PDFs currently) - `generate_sparse_vectors`: whether or not to generate sparse vectors for the file. Required for hybrid search. - `prepend_filename_to_chunks`: whether or not to prepend the filename to the chunk text Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0. The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, do not set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let file = null; // Object |
let opts = {
'chunkSize': 56, // Number | Chunk size in tiktoken tokens to be used when processing file.
'chunkOverlap': 56, // Number | Chunk overlap in tiktoken tokens to be used when processing file.
'skipEmbeddingGeneration': false, // Boolean | Flag to control whether or not embeddings should be generated and stored when processing file.
'setPageAsBoundary': false, // Boolean | Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information.
'embeddingModel': new CarbonJsSdk.TextEmbeddingGenerators(), // TextEmbeddingGenerators | Embedding model that will be used to embed file chunks.
'useOcr': false, // Boolean | Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text.
'generateSparseVectors': false, // Boolean | Whether or not to generate sparse vectors for the file. This is *required* for the file to be a candidate for hybrid search.
'prependFilenameToChunks': false, // Boolean | Whether or not to prepend the file's name to chunks.
'maxItemsPerChunk': 56, // Number | Number of objects per chunk. For json files only.
'customerId': "customerId_example" // String |
};
apiInstance.createUploadFileUploadfilePost(authorization, file, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
file | Object | ||
chunkSize | Number | Chunk size in tiktoken tokens to be used when processing file. | [optional] |
chunkOverlap | Number | Chunk overlap in tiktoken tokens to be used when processing file. | [optional] |
skipEmbeddingGeneration | Boolean | Flag to control whether or not embeddings should be generated and stored when processing file. | [optional] [default to false] |
setPageAsBoundary | Boolean | Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information. | [optional] [default to false] |
embeddingModel | TextEmbeddingGenerators | Embedding model that will be used to embed file chunks. | [optional] |
useOcr | Boolean | Whether or not to use OCR when processing files. Only valid for PDFs. Useful for documents with tables, images, and/or scanned text. | [optional] [default to false] |
generateSparseVectors | Boolean | Whether or not to generate sparse vectors for the file. This is required for the file to be a candidate for hybrid search. | [optional] [default to false] |
prependFilenameToChunks | Boolean | Whether or not to prepend the file's name to chunks. | [optional] [default to false] |
maxItemsPerChunk | Number | Number of objects per chunk. For json files only. | [optional] |
customerId | String | [optional] |
No authorization required
- Content-Type: multipart/form-data
- Accept: application/json
GenericSuccessResponse deleteFileEndpointDeletefileFileIdDelete(fileId, authorization, opts)
Delete File Endpoint
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let fileId = 56; // Number |
let authorization = "authorization_example"; // String |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.deleteFileEndpointDeletefileFileIdDelete(fileId, authorization, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
fileId | Number | ||
authorization | String | ||
customerId | String | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
UserFile deleteFileTagsDeleteUserFileTagsPost(authorization, organizationUserFileTagsRemove, opts)
Delete File Tags
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let organizationUserFileTagsRemove = new CarbonJsSdk.OrganizationUserFileTagsRemove(); // OrganizationUserFileTagsRemove |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.deleteFileTagsDeleteUserFileTagsPost(authorization, organizationUserFileTagsRemove, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
organizationUserFileTagsRemove | OrganizationUserFileTagsRemove | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
GenericSuccessResponse deleteFilesEndpointDeleteFilesPost(authorization, deleteFilesQueryInput, opts)
Delete Files Endpoint
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let deleteFilesQueryInput = new CarbonJsSdk.DeleteFilesQueryInput(); // DeleteFilesQueryInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.deleteFilesEndpointDeleteFilesPost(authorization, deleteFilesQueryInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
deleteFilesQueryInput | DeleteFilesQueryInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
PresignedURLResponse parsedFileParsedFileFileIdGet(fileId, authorization, opts)
Parsed File
This route is deprecated. Use `/user_files_v2` instead.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let fileId = 56; // Number |
let authorization = "authorization_example"; // String |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.parsedFileParsedFileFileIdGet(fileId, authorization, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
fileId | Number | ||
authorization | String | ||
customerId | String | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
PresignedURLResponse rawFileRawFileFileIdGet(fileId, authorization, opts)
Raw File
This route is deprecated. Use `/user_files_v2` instead.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let fileId = 56; // Number |
let authorization = "authorization_example"; // String |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.rawFileRawFileFileIdGet(fileId, authorization, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
fileId | Number | ||
authorization | String | ||
customerId | String | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
UserFile resyncFileResyncFilePost(authorization, resyncFileQueryInput, opts)
Resync File
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let resyncFileQueryInput = new CarbonJsSdk.ResyncFileQueryInput(); // ResyncFileQueryInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.resyncFileResyncFilePost(authorization, resyncFileQueryInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
resyncFileQueryInput | ResyncFileQueryInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
[UserFile] userFilesUserFilesPost(authorization, organizationUserFilesToSyncQueryInput, opts)
User Files
This route is deprecated. Use `/user_files_v2` instead.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let organizationUserFilesToSyncQueryInput = new CarbonJsSdk.OrganizationUserFilesToSyncQueryInput(); // OrganizationUserFilesToSyncQueryInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.userFilesUserFilesPost(authorization, organizationUserFilesToSyncQueryInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
organizationUserFilesToSyncQueryInput | OrganizationUserFilesToSyncQueryInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json
UserFilesV2 userFilesV2UserFilesV2Post(authorization, organizationUserFilesToSyncQueryInput, opts)
User Files V2
For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2` and `tags` are specified, `tags` is ignored. `tags_v2` enables building complex filters through the use of "AND", "OR", and negation logic. Take the below input as an example: ```json { "OR": [ { "key": "subject", "value": "holy-bible", "negate": false }, { "key": "person-of-interest", "value": "jesus christ", "negate": false }, { "key": "genre", "value": "religion", "negate": true } { "AND": [ { "key": "subject", "value": "tao-te-ching", "negate": false }, { "key": "author", "value": "lao-tzu", "negate": false } ] } ] } ``` In this case, files will be filtered such that: 1. "subject" = "holy-bible" OR 2. "person-of-interest" = "jesus christ" OR 3. "genre" != "religion" OR 4. "subject" = "tao-te-ching" AND "author" = "lao-tzu" Note that the top level of the query must be either an "OR" or "AND" array. Currently, nesting is limited to 3. For tag blocks (those with "key", "value", and "negate" keys), the following typing rules apply: 1. "key" isn't optional and must be a `string` 2. "value" isn't optional and can be `any` or list[`any`] 3. "negate" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in the resulting query. It is `false` by default.
import CarbonJsSdk from 'carbon-js-sdk';
let apiInstance = new CarbonJsSdk.FilesApi();
let authorization = "authorization_example"; // String |
let organizationUserFilesToSyncQueryInput = new CarbonJsSdk.OrganizationUserFilesToSyncQueryInput(); // OrganizationUserFilesToSyncQueryInput |
let opts = {
'customerId': "customerId_example" // String |
};
apiInstance.userFilesV2UserFilesV2Post(authorization, organizationUserFilesToSyncQueryInput, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
authorization | String | ||
organizationUserFilesToSyncQueryInput | OrganizationUserFilesToSyncQueryInput | ||
customerId | String | [optional] |
No authorization required
- Content-Type: application/json
- Accept: application/json