Chunks hinzufügen (Text).md
Chunks hinzufügen (Text).md
Fügen Sie Wissensblöcke zu Textdokumenten hinzu. Das System führt das Chunking/Slicing, das Embedding/Vektorisieren und das Hinzufügen neuer Wissensblöcke zum Dokument nacheinander durch.
Hinweis: Das verwendete Embedding-Modell ist das Standardmodell und kann innerhalb der API nicht definiert werden.
Anfragemethode
POST
Anfrage-URL
https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add
Authentifizierung der Anfrage
Siehe Übersicht für Details zur Authentifizierung.
Anfrage
Beispielanfrage
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"doc_id": "675174292b8b977ba6316191",
"chunks": [
{
"content": "Dies ist ein Chunk.",
"keywords": ["Dies","Chunk"]
}
]
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/chunks/add' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"doc_id": "675174292b8b977ba6316191",
"chunks": [
{
"content": "Dies ist ein Chunk.",
"keywords": ["Dies","Chunk"]
}
]
}'
Dieser Codeblock im schwebenden Fenster
Anfrage-Header
| Feld | Typ | Beschreibung |
|---|---|---|
| Authorization | Bearer ${API Key} | Verwenden Sie Authorization: Bearer ${API Key} zur Authentifizierung. Den API Key erhalten Sie auf der API-Key-Seite. |
| Content-Type | application/json | Datentyp, auf application/json setzen. |
Anfrageparameter
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| doc_id | String | Ja | Die ID des Dokuments, zu dem der Wissensblock hinzugefügt werden soll. |
| chunks | Array<Object> | Ja | Die Inhalte der Wissensblöcke. |
| content | String | Ja | Der Inhalt des Wissensblocks, maximal 1.000 Tokens lang. |
| keywords | Array<String> | Nein | Die Schlüsselwörter für den Wissensblock. |
Antwort
Beispielantwort
{
"code": 0,
"message": "OK"
}
{
"code": 0,
"message": "OK"
}
Dieser Codeblock im schwebenden Fenster
Erfolgsantwort
| Feld | Typ | Beschreibung |
|---|---|---|
| code | Int | Antwortcode. |
| message | String | Beschreibung. |
Fehlerantwort
| Feld | Typ | Beschreibung |
|---|---|---|
| code | Int | Fehlercode. |
| message | String | Fehlerdetails. |
