创建知识库
curl --request POST \
--url https://open.bigmodel.cn/api/llm-application/open/knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"background": "<string>",
"icon": "<string>"
}
'import requests
url = "https://open.bigmodel.cn/api/llm-application/open/knowledge"
payload = {
"name": "<string>",
"description": "<string>",
"background": "<string>",
"icon": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
background: '<string>',
icon: '<string>'
})
};
fetch('https://open.bigmodel.cn/api/llm-application/open/knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/llm-application/open/knowledge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"background\": \"<string>\",\n \"icon\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/llm-application/open/knowledge"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"background\": \"<string>\",\n \"icon\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/llm-application/open/knowledge",
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([
'name' => '<string>',
'description' => '<string>',
'background' => '<string>',
'icon' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"id": "<string>"
},
"code": 123,
"message": "<string>",
"timestamp": 123
}{
"code": 123,
"message": "<string>"
}知识库 API
创建知识库
用于创建个人知识库,支持绑定向量化模型、设置名称、描述、背景色和图标。点击 Try it 按钮可快速试用。
POST
/
llm-application
/
open
/
knowledge
创建知识库
curl --request POST \
--url https://open.bigmodel.cn/api/llm-application/open/knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"background": "<string>",
"icon": "<string>"
}
'import requests
url = "https://open.bigmodel.cn/api/llm-application/open/knowledge"
payload = {
"name": "<string>",
"description": "<string>",
"background": "<string>",
"icon": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
background: '<string>',
icon: '<string>'
})
};
fetch('https://open.bigmodel.cn/api/llm-application/open/knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/llm-application/open/knowledge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"background\": \"<string>\",\n \"icon\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/llm-application/open/knowledge"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"background\": \"<string>\",\n \"icon\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/llm-application/open/knowledge",
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([
'name' => '<string>',
'description' => '<string>',
'background' => '<string>',
'icon' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"id": "<string>"
},
"code": 123,
"message": "<string>",
"timestamp": 123
}{
"code": 123,
"message": "<string>"
}Body
application/json
知识库绑定的向量化模型ID。可选值:
- 3: Embedding-2
- 11: Embedding-3
- 12: Embedding-3-pro
Available options:
3, 11, 12 知识库名称
知识库绑定的向量化模型code。可选值:
- Embedding-2
- Embedding-3
- Embedding-3-pro
Available options:
Embedding-2, Embedding-3, Embedding-3-pro 是否开启上下文增强
Available options:
0, 1 知识库描述
背景颜色,可选:blue, red, orange, purple, sky, green, yellow,默认blue
知识库图标,可选:question, book, seal, wrench, tag, horn, house,默认question
Was this page helpful?
⌘I