Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
create_knowledge_base_upload_response = client.knowledge_bases.uploads.create(
knowledge_base_id="knowledge_base_id",
data_source_config={
"aws_account_id": "aws_account_id",
"aws_region": "aws_region",
"s3_bucket": "s3_bucket",
"source": "S3",
},
)
print(create_knowledge_base_upload_response.upload_id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
createKnowledgeBaseUploadResponse, err := client.KnowledgeBases.Uploads.New(
context.TODO(),
"knowledge_base_id",
sgp.KnowledgeBaseUploadNewParams{
Body: sgp.KnowledgeBaseUploadNewParamsBodyDataSourceUploadRequest{
DataSourceConfig: sgp.F[sgp.KnowledgeBaseUploadNewParamsBodyDataSourceUploadRequestDataSourceConfigUnion](sgp.S3DataSourceConfigParam{
AwsAccountID: sgp.F("aws_account_id"),
AwsRegion: sgp.F("aws_region"),
S3Bucket: sgp.F("s3_bucket"),
Source: sgp.F(sgp.S3DataSourceConfigSourceS3),
}),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", createKnowledgeBaseUploadResponse.UploadID)
}curl --request POST \
--url https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"data_source_config": {
"source": "<string>",
"s3_bucket": "<string>",
"aws_region": "<string>",
"aws_account_id": "<string>",
"s3_prefix": ""
},
"data_source_auth_config": {
"source": "<string>",
"client_secret": "<string>",
"encrypted": false
},
"chunking_strategy_config": {
"strategy": "<string>",
"separator": "\n\n",
"chunk_size": 1000,
"chunk_overlap": 200
},
"force_reupload": false,
"tagging_information": {
"type": "per_file",
"tags_to_apply": {}
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data_source_config: {
source: '<string>',
s3_bucket: '<string>',
aws_region: '<string>',
aws_account_id: '<string>',
s3_prefix: ''
},
data_source_auth_config: {source: '<string>', client_secret: '<string>', encrypted: false},
chunking_strategy_config: {strategy: '<string>', separator: '\n\n', chunk_size: 1000, chunk_overlap: 200},
force_reupload: false,
tagging_information: {type: 'per_file', tags_to_apply: {}}
})
};
fetch('https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data_source_config' => [
'source' => '<string>',
's3_bucket' => '<string>',
'aws_region' => '<string>',
'aws_account_id' => '<string>',
's3_prefix' => ''
],
'data_source_auth_config' => [
'source' => '<string>',
'client_secret' => '<string>',
'encrypted' => false
],
'chunking_strategy_config' => [
'strategy' => '<string>',
'separator' => '
',
'chunk_size' => 1000,
'chunk_overlap' => 200
],
'force_reupload' => false,
'tagging_information' => [
'type' => 'per_file',
'tags_to_apply' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data_source_config\": {\n \"source\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"aws_region\": \"<string>\",\n \"aws_account_id\": \"<string>\",\n \"s3_prefix\": \"\"\n },\n \"data_source_auth_config\": {\n \"source\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"encrypted\": false\n },\n \"chunking_strategy_config\": {\n \"strategy\": \"<string>\",\n \"separator\": \"\\n\\n\",\n \"chunk_size\": 1000,\n \"chunk_overlap\": 200\n },\n \"force_reupload\": false,\n \"tagging_information\": {\n \"type\": \"per_file\",\n \"tags_to_apply\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data_source_config\": {\n \"source\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"aws_region\": \"<string>\",\n \"aws_account_id\": \"<string>\",\n \"s3_prefix\": \"\"\n },\n \"data_source_auth_config\": {\n \"source\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"encrypted\": false\n },\n \"chunking_strategy_config\": {\n \"strategy\": \"<string>\",\n \"separator\": \"\\n\\n\",\n \"chunk_size\": 1000,\n \"chunk_overlap\": 200\n },\n \"force_reupload\": false,\n \"tagging_information\": {\n \"type\": \"per_file\",\n \"tags_to_apply\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"upload_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Knowledge Bases
Submit Upload Job
POST
/
v4
/
knowledge-bases
/
{knowledge_base_id}
/
uploads
Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
create_knowledge_base_upload_response = client.knowledge_bases.uploads.create(
knowledge_base_id="knowledge_base_id",
data_source_config={
"aws_account_id": "aws_account_id",
"aws_region": "aws_region",
"s3_bucket": "s3_bucket",
"source": "S3",
},
)
print(create_knowledge_base_upload_response.upload_id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
createKnowledgeBaseUploadResponse, err := client.KnowledgeBases.Uploads.New(
context.TODO(),
"knowledge_base_id",
sgp.KnowledgeBaseUploadNewParams{
Body: sgp.KnowledgeBaseUploadNewParamsBodyDataSourceUploadRequest{
DataSourceConfig: sgp.F[sgp.KnowledgeBaseUploadNewParamsBodyDataSourceUploadRequestDataSourceConfigUnion](sgp.S3DataSourceConfigParam{
AwsAccountID: sgp.F("aws_account_id"),
AwsRegion: sgp.F("aws_region"),
S3Bucket: sgp.F("s3_bucket"),
Source: sgp.F(sgp.S3DataSourceConfigSourceS3),
}),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", createKnowledgeBaseUploadResponse.UploadID)
}curl --request POST \
--url https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"data_source_config": {
"source": "<string>",
"s3_bucket": "<string>",
"aws_region": "<string>",
"aws_account_id": "<string>",
"s3_prefix": ""
},
"data_source_auth_config": {
"source": "<string>",
"client_secret": "<string>",
"encrypted": false
},
"chunking_strategy_config": {
"strategy": "<string>",
"separator": "\n\n",
"chunk_size": 1000,
"chunk_overlap": 200
},
"force_reupload": false,
"tagging_information": {
"type": "per_file",
"tags_to_apply": {}
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data_source_config: {
source: '<string>',
s3_bucket: '<string>',
aws_region: '<string>',
aws_account_id: '<string>',
s3_prefix: ''
},
data_source_auth_config: {source: '<string>', client_secret: '<string>', encrypted: false},
chunking_strategy_config: {strategy: '<string>', separator: '\n\n', chunk_size: 1000, chunk_overlap: 200},
force_reupload: false,
tagging_information: {type: 'per_file', tags_to_apply: {}}
})
};
fetch('https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data_source_config' => [
'source' => '<string>',
's3_bucket' => '<string>',
'aws_region' => '<string>',
'aws_account_id' => '<string>',
's3_prefix' => ''
],
'data_source_auth_config' => [
'source' => '<string>',
'client_secret' => '<string>',
'encrypted' => false
],
'chunking_strategy_config' => [
'strategy' => '<string>',
'separator' => '
',
'chunk_size' => 1000,
'chunk_overlap' => 200
],
'force_reupload' => false,
'tagging_information' => [
'type' => 'per_file',
'tags_to_apply' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data_source_config\": {\n \"source\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"aws_region\": \"<string>\",\n \"aws_account_id\": \"<string>\",\n \"s3_prefix\": \"\"\n },\n \"data_source_auth_config\": {\n \"source\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"encrypted\": false\n },\n \"chunking_strategy_config\": {\n \"strategy\": \"<string>\",\n \"separator\": \"\\n\\n\",\n \"chunk_size\": 1000,\n \"chunk_overlap\": 200\n },\n \"force_reupload\": false,\n \"tagging_information\": {\n \"type\": \"per_file\",\n \"tags_to_apply\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/knowledge-bases/{knowledge_base_id}/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data_source_config\": {\n \"source\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"aws_region\": \"<string>\",\n \"aws_account_id\": \"<string>\",\n \"s3_prefix\": \"\"\n },\n \"data_source_auth_config\": {\n \"source\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"encrypted\": false\n },\n \"chunking_strategy_config\": {\n \"strategy\": \"<string>\",\n \"separator\": \"\\n\\n\",\n \"chunk_size\": 1000,\n \"chunk_overlap\": 200\n },\n \"force_reupload\": false,\n \"tagging_information\": {\n \"type\": \"per_file\",\n \"tags_to_apply\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"upload_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
Path Parameters
Body
application/json
- DataSource Upload Request
- Local Chunks Upload Request
- DataSource Upload Request
Configuration for the data source which describes where to find the data.
- S3 DataSource Config
- SharePoint DataSource Config
- SharePoint Page DataSource Config
- Google Drive DataSource Config
- Azure Blob Storage DataSource Config
- Google Cloud Storage DataSource Config
- Confluence DataSource Config
- Slack DataSource Config
- Snowflake DataSource Config
- Databricks DataSource Config
- SQL Database DataSource Config
- MongoDB DataSource Config
- BigQuery DataSource Config
Show child attributes
Show child attributes
Configuration for the data source which describes how to authenticate to the data source.
- SharePoint DataSource Auth Config
- SharePoint Page DataSource Auth Config
- Azure DataSource Auth Config
- Google Cloud Storage DataSource Auth Config
- Google Drive DataSource Auth Config
- S3 DataSource Auth Config
- Confluence DataSource Auth Config
- Slack DataSource Auth Config
- Snowflake DataSource Auth Config
- Databricks DataSource Auth Config
- SQL Database DataSource Auth Config
- MongoDB DataSource Auth Config
- BigQuery DataSource Auth Config
Show child attributes
Show child attributes
Configuration for the chunking strategy which describes how to chunk the data.
- CharacterChunkingStrategyConfig
- TokenChunkingStrategyConfig
- CustomChunkingStrategyConfig
- PreChunkedStrategyConfig
- EnhancedChunkingStrategyConfig
Show child attributes
Show child attributes
Force reingest, regardless the change of the source file.
A dictionary of tags to apply to all artifacts added from the data source.
- TaggingInformationPerFile
- TaggingInformationAll
Show child attributes
Show child attributes
Response
Successful Response
ID of the created knowledge base upload job.
⌘I

