| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945 |
- {/**
- * @typedef Props
- * @property {string} apiBaseUrl
- */}
-
- import { CodeGroup } from '@/app/components/develop/code.tsx'
- import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'
-
- # Knowledge API
-
- <div>
- ### Authentication
-
- Service API authenticates using an `API-Key`.
-
- It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss.
-
- All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below:
-
- <CodeGroup title="Code">
- ```javascript
- Authorization: Bearer {API_KEY}
-
- ```
- </CodeGroup>
- </div>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/document/create-by-text'
- method='POST'
- title='Create a Document from Text'
- name='#create-by-text'
- />
- <Row>
- <Col>
- This API is based on an existing knowledge and creates a new document through text based on this knowledge.
-
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='name' type='string' key='name'>
- Document name
- </Property>
- <Property name='text' type='string' key='text'>
- Document content
- </Property>
- <Property name='indexing_technique' type='string' key='indexing_technique'>
- Index mode
- - <code>high_quality</code> High quality: Embedding using embedding model, built as vector database index
- - <code>economy</code> Economy: Build using inverted index of keyword table index
- </Property>
- <Property name='doc_form' type='string' key='doc_form'>
- Format of indexed content
- - <code>text_model</code> Text documents are directly embedded; `economy` mode defaults to using this form
- - <code>hierarchical_model</code> Parent-child mode
- - <code>qa_model</code> Q&A Mode: Generates Q&A pairs for segmented documents and then embeds the questions
- </Property>
- <Property name='doc_language' type='string' key='doc_language'>
- In Q&A mode, specify the language of the document, for example: <code>English</code>, <code>Chinese</code>
- </Property>
- <Property name='process_rule' type='object' key='process_rule'>
- Processing rules
- - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
- - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
- - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
- - <code>id</code> (string) Unique identifier for the preprocessing rule
- - enumerate
- - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
- - <code>remove_urls_emails</code> Delete URL, email address
- - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
- - <code>segmentation</code> (object) Segmentation rules
- - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
- - <code>max_tokens</code> Maximum length (token) defaults to 1000
- - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
- - <code>subchunk_segmentation</code> (object) Child chunk rules
- - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
- - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
- - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
- </Property>
- <PropertyInstruction>When no parameters are set for the knowledge base, the first upload requires the following parameters to be provided; if not provided, the default parameters will be used.</PropertyInstruction>
- <Property name='retrieval_model' type='object' key='retrieval_model'>
- Retrieval model
- - <code>search_method</code> (string) Search method
- - <code>hybrid_search</code> Hybrid search
- - <code>semantic_search</code> Semantic search
- - <code>full_text_search</code> Full-text search
- - <code>reranking_enable</code> (bool) Whether to enable reranking
- - <code>reranking_mode</code> (object) Rerank model configuration
- - <code>reranking_provider_name</code> (string) Rerank model provider
- - <code>reranking_model_name</code> (string) Rerank model name
- - <code>top_k</code> (int) Number of results to return
- - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
- - <code>score_threshold</code> (float) Score threshold
- </Property>
- <Property name='embedding_model' type='string' key='embedding_model'>
- Embedding model name
- </Property>
- <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
- Embedding model provider
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/document/create-by-text"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "text","text": "text","indexing_technique": "high_quality","process_rule": {"mode": "automatic"}}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "name": "text",
- "text": "text",
- "indexing_technique": "high_quality",
- "process_rule": {
- "mode": "automatic"
- }
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "document": {
- "id": "",
- "position": 1,
- "data_source_type": "upload_file",
- "data_source_info": {
- "upload_file_id": ""
- },
- "dataset_process_rule_id": "",
- "name": "text.txt",
- "created_from": "api",
- "created_by": "",
- "created_at": 1695690280,
- "tokens": 0,
- "indexing_status": "waiting",
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false,
- "display_status": "queuing",
- "word_count": 0,
- "hit_count": 0,
- "doc_form": "text_model"
- },
- "batch": ""
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/document/create-by-file'
- method='POST'
- title='Create a Document from a File'
- name='#create-by-file'
- />
- <Row>
- <Col>
- This API is based on an existing knowledge and creates a new document through a file based on this knowledge.
-
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='data' type='multipart/form-data json string' key='data'>
- - <code>original_document_id</code> Source document ID (optional)
- - Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document
- - The source document cannot be an archived document
- - When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by default
- - When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required
-
- - <code>indexing_technique</code> Index mode
- - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index
- - <code>economy</code> Economy: Build using inverted index of keyword table index
-
- - <code>doc_form</code> Format of indexed content
- - <code>text_model</code> Text documents are directly embedded; `economy` mode defaults to using this form
- - <code>hierarchical_model</code> Parent-child mode
- - <code>qa_model</code> Q&A Mode: Generates Q&A pairs for segmented documents and then embeds the questions
-
- - <code>doc_language</code> In Q&A mode, specify the language of the document, for example: <code>English</code>, <code>Chinese</code>
-
- - <code>process_rule</code> Processing rules
- - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
- - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
- - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
- - <code>id</code> (string) Unique identifier for the preprocessing rule
- - enumerate
- - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
- - <code>remove_urls_emails</code> Delete URL, email address
- - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
- - <code>segmentation</code> (object) Segmentation rules
- - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
- - <code>max_tokens</code> Maximum length (token) defaults to 1000
- - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
- - <code>subchunk_segmentation</code> (object) Child chunk rules
- - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
- - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
- - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
- </Property>
- <Property name='file' type='multipart/form-data' key='file'>
- Files that need to be uploaded.
- </Property>
- <PropertyInstruction>When no parameters are set for the knowledge base, the first upload requires the following parameters to be provided; if not provided, the default parameters will be used.</PropertyInstruction>
- <Property name='retrieval_model' type='object' key='retrieval_model'>
- Retrieval model
- - <code>search_method</code> (string) Search method
- - <code>hybrid_search</code> Hybrid search
- - <code>semantic_search</code> Semantic search
- - <code>full_text_search</code> Full-text search
- - <code>reranking_enable</code> (bool) Whether to enable reranking
- - <code>reranking_mode</code> (object) Rerank model configuration
- - <code>reranking_provider_name</code> (string) Rerank model provider
- - <code>reranking_model_name</code> (string) Rerank model name
- - <code>top_k</code> (int) Number of results to return
- - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
- - <code>score_threshold</code> (float) Score threshold
- </Property>
- <Property name='embedding_model' type='string' key='embedding_model'>
- Embedding model name
- </Property>
- <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
- Embedding model provider
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/document/create-by-file"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \
- --header 'Authorization: Bearer {api_key}' \
- --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
- --form 'file=@"/path/to/file"'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "document": {
- "id": "",
- "position": 1,
- "data_source_type": "upload_file",
- "data_source_info": {
- "upload_file_id": ""
- },
- "dataset_process_rule_id": "",
- "name": "Dify.txt",
- "created_from": "api",
- "created_by": "",
- "created_at": 1695308667,
- "tokens": 0,
- "indexing_status": "waiting",
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false,
- "display_status": "queuing",
- "word_count": 0,
- "hit_count": 0,
- "doc_form": "text_model"
- },
- "batch": ""
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets'
- method='POST'
- title='Create an Empty Knowledge Base'
- name='#create_empty_dataset'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='name' type='string' key='name'>
- Knowledge name
- </Property>
- <Property name='description' type='string' key='description'>
- Knowledge description (optional)
- </Property>
- <Property name='indexing_technique' type='string' key='indexing_technique'>
- Index technique (optional)
- If this is not set, embedding_model, embedding_model_provider and retrieval_model will be set to null
- - <code>high_quality</code> High quality
- - <code>economy</code> Economy
- </Property>
- <Property name='permission' type='string' key='permission'>
- Permission
- - <code>only_me</code> Only me
- - <code>all_team_members</code> All team members
- - <code>partial_members</code> Partial members
- </Property>
- <Property name='provider' type='string' key='provider'>
- Provider (optional, default: vendor)
- - <code>vendor</code> Vendor
- - <code>external</code> External knowledge
- </Property>
- <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
- External knowledge API ID (optional)
- </Property>
- <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
- External knowledge ID (optional)
- </Property>
- <Property name='embedding_model' type='str' key='embedding_model'>
- Embedding model name (optional)
- </Property>
- <Property name='embedding_model_provider' type='str' key='embedding_model_provider'>
- Embedding model provider name (optional)
- </Property>
- <Property name='retrieval_model' type='object' key='retrieval_model'>
- Retrieval model (optional)
- - <code>search_method</code> (string) Search method
- - <code>hybrid_search</code> Hybrid search
- - <code>semantic_search</code> Semantic search
- - <code>full_text_search</code> Full-text search
- - <code>reranking_enable</code> (bool) Whether to enable reranking
- - <code>reranking_model</code> (object) Rerank model configuration
- - <code>reranking_provider_name</code> (string) Rerank model provider
- - <code>reranking_model_name</code> (string) Rerank model name
- - <code>top_k</code> (int) Number of results to return
- - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
- - <code>score_threshold</code> (float) Score threshold
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name", "permission": "only_me"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${apiBaseUrl}/v1/datasets' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "name": "name",
- "permission": "only_me"
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "",
- "name": "name",
- "description": null,
- "provider": "vendor",
- "permission": "only_me",
- "data_source_type": null,
- "indexing_technique": null,
- "app_count": 0,
- "document_count": 0,
- "word_count": 0,
- "created_by": "",
- "created_at": 1695636173,
- "updated_by": "",
- "updated_at": 1695636173,
- "embedding_model": null,
- "embedding_model_provider": null,
- "embedding_available": null
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets'
- method='GET'
- title='Get Knowledge Base List'
- name='#dataset_list'
- />
- <Row>
- <Col>
- ### Query
- <Properties>
- <Property name='keyword' type='string' key='keyword'>
- Search keyword, optional
- </Property>
- <Property name='tag_ids' type='array[string]' key='tag_ids'>
- Tag ID list, optional
- </Property>
- <Property name='page' type='string' key='page'>
- Page number, optional, default 1
- </Property>
- <Property name='limit' type='string' key='limit'>
- Number of items returned, optional, default 20, range 1-100
- </Property>
- <Property name='include_all' type='boolean' key='include_all'>
- Whether to include all datasets (only effective for owners), optional, defaults to false
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [
- {
- "id": "",
- "name": "name",
- "description": "desc",
- "permission": "only_me",
- "data_source_type": "upload_file",
- "indexing_technique": "",
- "app_count": 2,
- "document_count": 10,
- "word_count": 1200,
- "created_by": "",
- "created_at": "",
- "updated_by": "",
- "updated_at": ""
- },
- ...
- ],
- "has_more": true,
- "limit": 20,
- "total": 50,
- "page": 1
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}'
- method='GET'
- title='Get knowledge base details by knowledge base ID'
- name='#view_dataset'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge Base ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
- "name": "Test Knowledge Base",
- "description": "",
- "provider": "vendor",
- "permission": "only_me",
- "data_source_type": null,
- "indexing_technique": null,
- "app_count": 0,
- "document_count": 0,
- "word_count": 0,
- "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
- "created_at": 1735620612,
- "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
- "updated_at": 1735620612,
- "embedding_model": null,
- "embedding_model_provider": null,
- "embedding_available": true,
- "retrieval_model_dict": {
- "search_method": "semantic_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 2,
- "score_threshold_enabled": false,
- "score_threshold": null
- },
- "tags": [],
- "doc_form": null,
- "external_knowledge_info": {
- "external_knowledge_id": null,
- "external_knowledge_api_id": null,
- "external_knowledge_api_name": null,
- "external_knowledge_api_endpoint": null
- },
- "external_retrieval_model": {
- "top_k": 2,
- "score_threshold": 0.0,
- "score_threshold_enabled": null
- }
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}'
- method='PATCH'
- title='Update knowledge base'
- name='#update_dataset'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge Base ID
- </Property>
- <Property name='indexing_technique' type='string' key='indexing_technique'>
- Index technique (optional)
- - <code>high_quality</code> High quality
- - <code>economy</code> Economy
- </Property>
- <Property name='permission' type='string' key='permission'>
- Permission
- - <code>only_me</code> Only me
- - <code>all_team_members</code> All team members
- - <code>partial_members</code> Partial members
- </Property>
- <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
- Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional)
- </Property>
- <Property name='embedding_model' type='string' key='embedding_model'>
- Specified embedding model, corresponding to the model field(Optional)
- </Property>
- <Property name='retrieval_model' type='object' key='retrieval_model'>
- Retrieval model (optional, if not filled, it will be recalled according to the default method)
- - <code>search_method</code> (text) Search method: One of the following four keywords is required
- - <code>keyword_search</code> Keyword search
- - <code>semantic_search</code> Semantic search
- - <code>full_text_search</code> Full-text search
- - <code>hybrid_search</code> Hybrid search
- - <code>reranking_enable</code> (bool) Whether to enable reranking, required if the search mode is semantic_search or hybrid_search (optional)
- - <code>reranking_mode</code> (object) Rerank model configuration, required if reranking is enabled
- - <code>reranking_provider_name</code> (string) Rerank model provider
- - <code>reranking_model_name</code> (string) Rerank model name
- - <code>weights</code> (float) Semantic search weight setting in hybrid search mode
- - <code>top_k</code> (integer) Number of results to return (optional)
- - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
- - <code>score_threshold</code> (float) Score threshold
- </Property>
- <Property name='partial_member_list' type='array' key='partial_member_list'>
- Partial member list(Optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="PATCH"
- label="/datasets/{dataset_id}"
- targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{
- "name": "Test Knowledge Base",
- "indexing_technique": "high_quality",
- "permission": "only_me",
- "embedding_model_provider": "zhipuai",
- "embedding_model": "embedding-3",
- "retrieval_model": {
- "search_method": "keyword_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 1,
- "score_threshold_enabled": false,
- "score_threshold": null
- },
- "partial_member_list": []
- }'
- `}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "name": "Test Knowledge Base",
- "indexing_technique": "high_quality",
- "permission": "only_me",
- "embedding_model_provider": "zhipuai",
- "embedding_model": "embedding-3",
- "retrieval_model": {
- "search_method": "keyword_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 1,
- "score_threshold_enabled": false,
- "score_threshold": null
- },
- "partial_member_list": []
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
- "name": "Test Knowledge Base",
- "description": "",
- "provider": "vendor",
- "permission": "only_me",
- "data_source_type": null,
- "indexing_technique": "high_quality",
- "app_count": 0,
- "document_count": 0,
- "word_count": 0,
- "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
- "created_at": 1735620612,
- "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
- "updated_at": 1735622679,
- "embedding_model": "embedding-3",
- "embedding_model_provider": "zhipuai",
- "embedding_available": null,
- "retrieval_model_dict": {
- "search_method": "semantic_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 2,
- "score_threshold_enabled": false,
- "score_threshold": null
- },
- "tags": [],
- "doc_form": null,
- "external_knowledge_info": {
- "external_knowledge_id": null,
- "external_knowledge_api_id": null,
- "external_knowledge_api_name": null,
- "external_knowledge_api_endpoint": null
- },
- "external_retrieval_model": {
- "top_k": 2,
- "score_threshold": 0.0,
- "score_threshold_enabled": null
- },
- "partial_member_list": []
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}'
- method='DELETE'
- title='Delete a Knowledge Base'
- name='#delete_dataset'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/{dataset_id}"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```text {{ title: 'Response' }}
- 204 No Content
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
- method='POST'
- title='Update a Document with Text'
- name='#update-by-text'
- />
- <Row>
- <Col>
- This API is based on an existing knowledge and updates the document through text based on this knowledge.
-
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='name' type='string' key='name'>
- Document name (optional)
- </Property>
- <Property name='text' type='string' key='text'>
- Document content (optional)
- </Property>
- <Property name='process_rule' type='object' key='process_rule'>
- Processing rules
- - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
- - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
- - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
- - <code>id</code> (string) Unique identifier for the preprocessing rule
- - enumerate
- - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
- - <code>remove_urls_emails</code> Delete URL, email address
- - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
- - <code>segmentation</code> (object) Segmentation rules
- - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
- - <code>max_tokens</code> Maximum length (token) defaults to 1000
- - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
- - <code>subchunk_segmentation</code> (object) Child chunk rules
- - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
- - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
- - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/{document_id}/update-by-text"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name","text": "text"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "name": "name",
- "text": "text"
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "document": {
- "id": "",
- "position": 1,
- "data_source_type": "upload_file",
- "data_source_info": {
- "upload_file_id": ""
- },
- "dataset_process_rule_id": "",
- "name": "name.txt",
- "created_from": "api",
- "created_by": "",
- "created_at": 1695308667,
- "tokens": 0,
- "indexing_status": "waiting",
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false,
- "display_status": "queuing",
- "word_count": 0,
- "hit_count": 0,
- "doc_form": "text_model"
- },
- "batch": ""
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
- method='POST'
- title='Update a Document with a File'
- name='#update-by-file'
- />
- <Row>
- <Col>
- This API is based on an existing knowledge, and updates documents through files based on this knowledge
-
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='name' type='string' key='name'>
- Document name (optional)
- </Property>
- <Property name='file' type='multipart/form-data' key='file'>
- Files to be uploaded
- </Property>
- <Property name='process_rule' type='object' key='process_rule'>
- Processing rules
- - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom / hierarchical
- - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
- - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
- - <code>id</code> (string) Unique identifier for the preprocessing rule
- - enumerate
- - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
- - <code>remove_urls_emails</code> Delete URL, email address
- - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
- - <code>segmentation</code> (object) Segmentation rules
- - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
- - <code>max_tokens</code> Maximum length (token) defaults to 1000
- - <code>parent_mode</code> Retrieval mode of parent chunks: <code>full-doc</code> full text retrieval / <code>paragraph</code> paragraph retrieval
- - <code>subchunk_segmentation</code> (object) Child chunk rules
- - <code>separator</code> Segmentation identifier. Currently, only one delimiter is allowed. The default is <code>***</code>
- - <code>max_tokens</code> The maximum length (tokens) must be validated to be shorter than the length of the parent chunk
- - <code>chunk_overlap</code> Define the overlap between adjacent chunks (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/{document_id}/update-by-file"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
- --header 'Authorization: Bearer {api_key}' \
- --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
- --form 'file=@"/path/to/file"'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "document": {
- "id": "",
- "position": 1,
- "data_source_type": "upload_file",
- "data_source_info": {
- "upload_file_id": ""
- },
- "dataset_process_rule_id": "",
- "name": "Dify.txt",
- "created_from": "api",
- "created_by": "",
- "created_at": 1695308667,
- "tokens": 0,
- "indexing_status": "waiting",
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false,
- "display_status": "queuing",
- "word_count": 0,
- "hit_count": 0,
- "doc_form": "text_model"
- },
- "batch": "20230921150427533684"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
- method='GET'
- title='Get Document Embedding Status (Progress)'
- name='#indexing_status'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='batch' type='string' key='batch'>
- Batch number of uploaded documents
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
- --header 'Authorization: Bearer {api_key}' \
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data":[{
- "id": "",
- "indexing_status": "indexing",
- "processing_started_at": 1681623462.0,
- "parsing_completed_at": 1681623462.0,
- "cleaning_completed_at": 1681623462.0,
- "splitting_completed_at": 1681623462.0,
- "completed_at": null,
- "paused_at": null,
- "error": null,
- "stopped_at": null,
- "completed_segments": 24,
- "total_segments": 100
- }]
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}'
- method='DELETE'
- title='Delete a Document'
- name='#delete_document'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/{dataset_id}/documents/{document_id}"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
- --header 'Authorization: Bearer {api_key}' \
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```text {{ title: 'Response' }}
- 204 No Content
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents'
- method='GET'
- title='Get the Document List of a Knowledge Base'
- name='#dataset_document_list'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Query
- <Properties>
- <Property name='keyword' type='string' key='keyword'>
- Search keywords, currently only search document names (optional)
- </Property>
- <Property name='page' type='string' key='page'>
- Page number (optional)
- </Property>
- <Property name='limit' type='string' key='limit'>
- Number of items returned, default 20, range 1-100 (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
- --header 'Authorization: Bearer {api_key}' \
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [
- {
- "id": "",
- "position": 1,
- "data_source_type": "file_upload",
- "data_source_info": null,
- "dataset_process_rule_id": null,
- "name": "dify",
- "created_from": "",
- "created_by": "",
- "created_at": 1681623639,
- "tokens": 0,
- "indexing_status": "waiting",
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false
- },
- ],
- "has_more": false,
- "limit": 20,
- "total": 9,
- "page": 1
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}'
- method='GET'
- title='Get Document Detail'
- name='#get-document-detail'
- />
- <Row>
- <Col>
- Get a document's detail.
- ### Path
- - `dataset_id` (string) Dataset ID
- - `document_id` (string) Document ID
-
- ### Query
- - `metadata` (string) Metadata filter, can be `all`, `only`, or `without`. Default is `all`.
-
- ### Response
- Returns the document's detail.
- </Col>
- <Col sticky>
- ### Request Example
- <CodeGroup title="Request" tag="GET" label="/datasets/{dataset_id}/documents/{document_id}" targetCode={`curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n-H 'Authorization: Bearer {api_key}'`}>
- ```bash {{ title: 'cURL' }}
- curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
- -H 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
-
- ### Response Example
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "f46ae30c-5c11-471b-96d0-464f5f32a7b2",
- "position": 1,
- "data_source_type": "upload_file",
- "data_source_info": {
- "upload_file": {
- ...
- }
- },
- "dataset_process_rule_id": "24b99906-845e-499f-9e3c-d5565dd6962c",
- "dataset_process_rule": {
- "mode": "hierarchical",
- "rules": {
- "pre_processing_rules": [
- {
- "id": "remove_extra_spaces",
- "enabled": true
- },
- {
- "id": "remove_urls_emails",
- "enabled": false
- }
- ],
- "segmentation": {
- "separator": "**********page_ending**********",
- "max_tokens": 1024,
- "chunk_overlap": 0
- },
- "parent_mode": "paragraph",
- "subchunk_segmentation": {
- "separator": "\n",
- "max_tokens": 512,
- "chunk_overlap": 0
- }
- }
- },
- "document_process_rule": {
- "id": "24b99906-845e-499f-9e3c-d5565dd6962c",
- "dataset_id": "48a0db76-d1a9-46c1-ae35-2baaa919a8a9",
- "mode": "hierarchical",
- "rules": {
- "pre_processing_rules": [
- {
- "id": "remove_extra_spaces",
- "enabled": true
- },
- {
- "id": "remove_urls_emails",
- "enabled": false
- }
- ],
- "segmentation": {
- "separator": "**********page_ending**********",
- "max_tokens": 1024,
- "chunk_overlap": 0
- },
- "parent_mode": "paragraph",
- "subchunk_segmentation": {
- "separator": "\n",
- "max_tokens": 512,
- "chunk_overlap": 0
- }
- }
- },
- "name": "xxxx",
- "created_from": "web",
- "created_by": "17f71940-a7b5-4c77-b60f-2bd645c1ffa0",
- "created_at": 1750464191,
- "tokens": null,
- "indexing_status": "waiting",
- "completed_at": null,
- "updated_at": 1750464191,
- "indexing_latency": null,
- "error": null,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "archived": false,
- "segment_count": 0,
- "average_segment_length": 0,
- "hit_count": null,
- "display_status": "queuing",
- "doc_form": "hierarchical_model",
- "doc_language": "Chinese Simplified"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
- ___
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/status/{action}'
- method='PATCH'
- title='Update Document Status'
- name='#batch_document_status'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='action' type='string' key='action'>
- - `enable` - Enable document
- - `disable` - Disable document
- - `archive` - Archive document
- - `un_archive` - Unarchive document
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='document_ids' type='array[string]' key='document_ids'>
- List of document IDs
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="PATCH"
- label="/datasets/{dataset_id}/documents/status/{action}"
- targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "document_ids": ["doc-id-1", "doc-id-2"]\n}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "document_ids": ["doc-id-1", "doc-id-2"]
- }'
- ```
- </CodeGroup>
-
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "result": "success"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments'
- method='POST'
- title='Add Chunks to a Document'
- name='#create_new_segment'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='segments' type='object list' key='segments'>
- - <code>content</code> (text) Text content / question content, required
- - <code>answer</code> (text) Answer content, if the mode of the knowledge is Q&A mode, pass the value (optional)
- - <code>keywords</code> (list) Keywords (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/{document_id}/segments"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"segments": [{"content": "1","answer": "1","keywords": ["a"]}]}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "segments": [
- {
- "content": "1",
- "answer": "1",
- "keywords": ["a"]
- }
- ]
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [{
- "id": "",
- "position": 1,
- "document_id": "",
- "content": "1",
- "answer": "1",
- "word_count": 25,
- "tokens": 0,
- "keywords": [
- "a"
- ],
- "index_node_id": "",
- "index_node_hash": "",
- "hit_count": 0,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- }],
- "doc_form": "text_model"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments'
- method='GET'
- title='Get Chunks from a Document'
- name='#get_segment'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
-
- ### Query
- <Properties>
- <Property name='keyword' type='string' key='keyword'>
- Keyword (optional)
- </Property>
- <Property name='status' type='string' key='status'>
- Search status, completed
- </Property>
- <Property name='page' type='string' key='page'>
- Page number (optional)
- </Property>
- <Property name='limit' type='string' key='limit'>
- Number of items returned, default 20, range 1-100 (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents/{document_id}/segments"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [{
- "id": "",
- "position": 1,
- "document_id": "",
- "content": "1",
- "answer": "1",
- "word_count": 25,
- "tokens": 0,
- "keywords": [
- "a"
- ],
- "index_node_id": "",
- "index_node_hash": "",
- "hit_count": 0,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- }],
- "doc_form": "text_model",
- "has_more": false,
- "limit": 20,
- "total": 9,
- "page": 1
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
- method='GET'
- title='Get a Chunk Details in a Document'
- name='#view_document_chunk'
- />
- <Row>
- <Col>
- Get details of a specific document segment in the specified knowledge base
-
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge Base ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Segment ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": {
- "id": "chunk_id",
- "position": 2,
- "document_id": "document_id",
- "content": "Segment content text",
- "sign_content": "Signature content text",
- "answer": "Answer content (if in Q&A mode)",
- "word_count": 470,
- "tokens": 382,
- "keywords": ["keyword1", "keyword2"],
- "index_node_id": "index_node_id",
- "index_node_hash": "index_node_hash",
- "hit_count": 0,
- "enabled": true,
- "status": "completed",
- "created_by": "creator_id",
- "created_at": creation_timestamp,
- "updated_at": update_timestamp,
- "indexing_at": indexing_timestamp,
- "completed_at": completion_timestamp,
- "error": null,
- "child_chunks": []
- },
- "doc_form": "text_model"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
- method='DELETE'
- title='Delete a Chunk in a Document'
- name='#delete_segment'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Document Segment ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```text {{ title: 'Response' }}
- 204 No Content
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
- method='POST'
- title='Update a Chunk in a Document'
- name='#update_segment'
- />
- <Row>
- <Col>
- ### POST
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Document Segment ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='segment' type='object' key='segment'>
- - <code>content</code> (text) Text content / question content, required
- - <code>answer</code> (text) Answer content, passed if the knowledge is in Q&A mode (optional)
- - <code>keywords</code> (list) Keyword (optional)
- - <code>enabled</code> (bool) False / true (optional)
- - <code>regenerate_child_chunks</code> (bool) Whether to regenerate child chunks (optional)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{\"segment\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "segment": {
- "content": "1",
- "answer": "1",
- "keywords": ["a"],
- "enabled": false
- }
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": {
- "id": "",
- "position": 1,
- "document_id": "",
- "content": "1",
- "answer": "1",
- "word_count": 25,
- "tokens": 0,
- "keywords": [
- "a"
- ],
- "index_node_id": "",
- "index_node_hash": "",
- "hit_count": 0,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- },
- "doc_form": "text_model"
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
- method='POST'
- title='Create Child Chunk'
- name='#create_child_chunk'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Segment ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='content' type='string' key='content'>
- Child chunk content
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "Child chunk content"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "content": "Child chunk content"
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": {
- "id": "",
- "segment_id": "",
- "content": "Child chunk content",
- "word_count": 25,
- "tokens": 0,
- "index_node_id": "",
- "index_node_hash": "",
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- }
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
- method='GET'
- title='Get Child Chunks'
- name='#get_child_chunks'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Segment ID
- </Property>
- </Properties>
-
- ### Query
- <Properties>
- <Property name='keyword' type='string' key='keyword'>
- Search keyword (optional)
- </Property>
- <Property name='page' type='integer' key='page'>
- Page number (optional, default: 1)
- </Property>
- <Property name='limit' type='integer' key='limit'>
- Items per page (optional, default: 20, max: 100)
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [{
- "id": "",
- "segment_id": "",
- "content": "Child chunk content",
- "word_count": 25,
- "tokens": 0,
- "index_node_id": "",
- "index_node_hash": "",
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- }],
- "total": 1,
- "total_pages": 1,
- "page": 1,
- "limit": 20
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
- method='DELETE'
- title='Delete Child Chunk'
- name='#delete_child_chunk'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Segment ID
- </Property>
- <Property name='child_chunk_id' type='string' key='child_chunk_id'>
- Child Chunk ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
- --header 'Authorization: Bearer {api_key}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```text {{ title: 'Response' }}
- 204 No Content
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
- method='PATCH'
- title='Update Child Chunk'
- name='#update_child_chunk'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- <Property name='segment_id' type='string' key='segment_id'>
- Segment ID
- </Property>
- <Property name='child_chunk_id' type='string' key='child_chunk_id'>
- Child Chunk ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='content' type='string' key='content'>
- Child chunk content
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="PATCH"
- label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
- targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "Updated child chunk content"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "content": "Updated child chunk content"
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": {
- "id": "",
- "segment_id": "",
- "content": "Updated child chunk content",
- "word_count": 25,
- "tokens": 0,
- "index_node_id": "",
- "index_node_hash": "",
- "status": "completed",
- "created_by": "",
- "created_at": 1695312007,
- "indexing_at": 1695312007,
- "completed_at": 1695312007,
- "error": null,
- "stopped_at": null
- }
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
- method='GET'
- title='Get Upload File'
- name='#get_upload_file'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='document_id' type='string' key='document_id'>
- Document ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "file_id",
- "name": "file_name",
- "size": 1024,
- "extension": "txt",
- "url": "preview_url",
- "download_url": "download_url",
- "mime_type": "text/plain",
- "created_by": "user_id",
- "created_at": 1728734540,
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/retrieve'
- method='POST'
- title='Retrieve Chunks from a Knowledge Base'
- name='#dataset_retrieval'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='query' type='string' key='query'>
- Query keyword
- </Property>
- <Property name='retrieval_model' type='object' key='retrieval_model'>
- Retrieval parameters (optional, if not filled, it will be recalled according to the default method)
- - <code>search_method</code> (text) Search method: One of the following four keywords is required
- - <code>keyword_search</code> Keyword search
- - <code>semantic_search</code> Semantic search
- - <code>full_text_search</code> Full-text search
- - <code>hybrid_search</code> Hybrid search
- - <code>reranking_enable</code> (bool) Whether to enable reranking, required if the search mode is semantic_search or hybrid_search (optional)
- - <code>reranking_mode</code> (object) Rerank model configuration, required if reranking is enabled
- - <code>reranking_provider_name</code> (string) Rerank model provider
- - <code>reranking_model_name</code> (string) Rerank model name
- - <code>weights</code> (float) Semantic search weight setting in hybrid search mode
- - <code>top_k</code> (integer) Number of results to return (optional)
- - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
- - <code>score_threshold</code> (float) Score threshold
- - <code>metadata_filtering_conditions</code> (object) Metadata filtering conditions
- - <code>logical_operator</code> (string) Logical operator: <code>and</code> | <code>or</code>
- - <code>conditions</code> (array[object]) Conditions list
- - <code>name</code> (string) Metadata field name
- - <code>comparison_operator</code> (string) Comparison operator, allowed values:
- - String comparison:
- - <code>contains</code>: Contains
- - <code>not contains</code>: Does not contain
- - <code>start with</code>: Starts with
- - <code>end with</code>: Ends with
- - <code>is</code>: Equals
- - <code>is not</code>: Does not equal
- - <code>empty</code>: Is empty
- - <code>not empty</code>: Is not empty
- - Numeric comparison:
- - <code>=</code>: Equals
- - <code>≠</code>: Does not equal
- - <code>></code>: Greater than
- - <code>< </code>: Less than
- - <code>≥</code>: Greater than or equal
- - <code>≤</code>: Less than or equal
- - Time comparison:
- - <code>before</code>: Before
- - <code>after</code>: After
- - <code>value</code> (string|number|null) Comparison value
- </Property>
- <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
- Unused field
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/retrieve"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \\\n--header 'Authorization: Bearer {api_key}'\\\n--header 'Content-Type: application/json'\\\n--data-raw '{
- "query": "test",
- "retrieval_model": {
- "search_method": "keyword_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 1,
- "score_threshold_enabled": false,
- "score_threshold": null,
- "metadata_filtering_conditions": {
- "logical_operator": "and",
- "conditions": [
- {
- "name": "document_name",
- "comparison_operator": "contains",
- "value": "test"
- }
- ]
- }
- }
- }'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{
- "query": "test",
- "retrieval_model": {
- "search_method": "keyword_search",
- "reranking_enable": false,
- "reranking_mode": null,
- "reranking_model": {
- "reranking_provider_name": "",
- "reranking_model_name": ""
- },
- "weights": null,
- "top_k": 2,
- "score_threshold_enabled": false,
- "score_threshold": null
- }
- }'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "query": {
- "content": "test"
- },
- "records": [
- {
- "segment": {
- "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
- "position": 1,
- "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
- "content": "Operation guide",
- "answer": null,
- "word_count": 847,
- "tokens": 280,
- "keywords": [
- "install",
- "java",
- "base",
- "scripts",
- "jdk",
- "manual",
- "internal",
- "opens",
- "add",
- "vmoptions"
- ],
- "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
- "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
- "hit_count": 0,
- "enabled": true,
- "disabled_at": null,
- "disabled_by": null,
- "status": "completed",
- "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
- "created_at": 1728734540,
- "indexing_at": 1728734552,
- "completed_at": 1728734584,
- "error": null,
- "stopped_at": null,
- "document": {
- "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
- "data_source_type": "upload_file",
- "name": "readme.txt",
- }
- },
- "score": 3.730463140527718e-05,
- "tsne_position": null
- }
- ]
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/metadata'
- method='POST'
- title='Create a Knowledge Metadata'
- name='#create_metadata'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='segment' type='object' key='segment'>
- - <code>type</code> (string) Metadata type, required
- - <code>name</code> (string) Metadata name, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/metadata"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"type": "string", "name": "test"}'`}
- >
- ```bash {{ title: 'cURL' }}
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "abc",
- "type": "string",
- "name": "test",
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/metadata/{metadata_id}'
- method='PATCH'
- title='Update a Knowledge Metadata'
- name='#update_metadata'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='metadata_id' type='string' key='metadata_id'>
- Metadata ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='segment' type='object' key='segment'>
- - <code>name</code> (string) Metadata name, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="PATCH"
- label="/datasets/{dataset_id}/metadata/{metadata_id}"
- targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"name": "test"}'`}
- >
- ```bash {{ title: 'cURL' }}
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "abc",
- "type": "string",
- "name": "test",
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/metadata/{metadata_id}'
- method='DELETE'
- title='Delete a Knowledge Metadata'
- name='#delete_metadata'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='metadata_id' type='string' key='metadata_id'>
- Metadata ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/{dataset_id}/metadata/{metadata_id}"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/metadata/built-in/{action}'
- method='POST'
- title='Disable Or Enable Built-in Metadata'
- name='#toggle_metadata'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- <Property name='action' type='string' key='action'>
- disable/enable
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/metadata/built-in/{action}"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/documents/metadata'
- method='POST'
- title='Update Documents Metadata'
- name='#update_documents_metadata'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
-
- ### Request Body
- <Properties>
- <Property name='operation_data' type='object list' key='segments'>
- - <code>document_id</code> (string) Document ID
- - <code>metadata_list</code> (list) Metadata list
- - <code>id</code> (string) Metadata ID
- - <code>value</code> (string) Metadata value
- - <code>name</code> (string) Metadata name
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/{dataset_id}/documents/metadata"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"operation_data": [{"document_id": "document_id", "metadata_list": [{"id": "id", "value": "value", "name": "name"}]}]}'`}
- >
- ```bash {{ title: 'cURL' }} </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/{dataset_id}/metadata'
- method='GET'
- title='Get Knowledge Metadata List'
- name='#dataset_metadata_list'
- />
- <Row>
- <Col>
- ### Params
- <Properties>
- <Property name='dataset_id' type='string' key='dataset_id'>
- Knowledge ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}/metadata"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
- >
- ```bash {{ title: 'cURL' }}
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "doc_metadata": [
- {
- "id": "",
- "name": "name",
- "type": "string",
- "use_count": 0,
- },
- ...
- ],
- "built_in_field_enabled": true
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/workspaces/current/models/model-types/text-embedding'
- method='GET'
- title='Get available embedding models'
- name='#model_type_list'
- />
- <Row>
- <Col>
- ### Query
- <Properties>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/{dataset_id}"
- targetCode={`curl --location --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' `}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data": [
- {
- "provider": "zhipuai",
- "label": {
- "zh_Hans": "智谱 AI",
- "en_US": "ZHIPU AI"
- },
- "icon_small": {
- "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
- "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
- },
- "icon_large": {
- "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
- "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
- },
- "status": "active",
- "models": [
- {
- "model": "embedding-3",
- "label": {
- "zh_Hans": "embedding-3",
- "en_US": "embedding-3"
- },
- "model_type": "text-embedding",
- "features": null,
- "fetch_from": "predefined-model",
- "model_properties": {
- "context_size": 8192
- },
- "deprecated": false,
- "status": "active",
- "load_balancing_enabled": false
- },
- {
- "model": "embedding-2",
- "label": {
- "zh_Hans": "embedding-2",
- "en_US": "embedding-2"
- },
- "model_type": "text-embedding",
- "features": null,
- "fetch_from": "predefined-model",
- "model_properties": {
- "context_size": 8192
- },
- "deprecated": false,
- "status": "active",
- "load_balancing_enabled": false
- },
- {
- "model": "text_embedding",
- "label": {
- "zh_Hans": "text_embedding",
- "en_US": "text_embedding"
- },
- "model_type": "text-embedding",
- "features": null,
- "fetch_from": "predefined-model",
- "model_properties": {
- "context_size": 512
- },
- "deprecated": false,
- "status": "active",
- "load_balancing_enabled": false
- }
- ]
- }
- ]
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
- Okay, I will translate the Chinese text in your document while keeping all formatting and code content unchanged.
-
- <Heading
- url='/datasets/tags'
- method='POST'
- title='Create New Knowledge Base Type Tag'
- name='#create_new_knowledge_tag'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='name' type='string'>
- (text) New tag name, required, maximum length 50
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/tags"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag1"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{"name": "testtag1"}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
- "name": "testtag1",
- "type": "knowledge",
- "binding_count": 0
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/tags'
- method='GET'
- title='Get Knowledge Base Type Tags'
- name='#get_knowledge_type_tags'
- />
- <Row>
- <Col>
- ### Request Body
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="GET"
- label="/datasets/tags"
- targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- [
- {
- "id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
- "name": "testtag1",
- "type": "knowledge",
- "binding_count": "0"
- },
- ...
- ]
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/tags'
- method='PATCH'
- title='Modify Knowledge Base Type Tag Name'
- name='#modify_knowledge_tag_name'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='name' type='string'>
- (text) Modified tag name, required, maximum length 50
- </Property>
- <Property name='tag_id' type='string'>
- (text) Tag ID, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="PATCH"
- label="/datasets/tags"
- targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
- "name": "tag-renamed",
- "type": "knowledge",
- "binding_count": 0
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
-
- <Heading
- url='/datasets/tags'
- method='DELETE'
- title='Delete Knowledge Base Type Tag'
- name='#delete_knowledge_tag'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='tag_id' type='string'>
- (text) Tag ID, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="DELETE"
- label="/datasets/tags"
- targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
-
- {"result": "success"}
-
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/tags/binding'
- method='POST'
- title='Bind Dataset to Knowledge Base Type Tag'
- name='#bind_dataset_to_knowledge_tag'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='tag_ids' type='list'>
- (list) List of Tag IDs, required
- </Property>
- <Property name='target_id' type='string'>
- (text) Dataset ID, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/tags/binding"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {"result": "success"}
- ```
- </CodeGroup>
- </Col>
- </Row>
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/tags/unbinding'
- method='POST'
- title='Unbind Dataset and Knowledge Base Type Tag'
- name='#unbind_dataset_and_knowledge_tag'
- />
- <Row>
- <Col>
- ### Request Body
- <Properties>
- <Property name='tag_id' type='string'>
- (text) Tag ID, required
- </Property>
- <Property name='target_id' type='string'>
- (text) Dataset ID, required
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/tags/unbinding"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- --data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {"result": "success"}
- ```
- </CodeGroup>
- </Col>
- </Row>
-
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
- <Heading
- url='/datasets/<uuid:dataset_id>/tags'
- method='POST'
- title='Query Tags Bound to a Dataset'
- name='#query_dataset_tags'
- />
- <Row>
- <Col>
- ### Path
- <Properties>
- <Property name='dataset_id' type='string'>
- (text) Dataset ID
- </Property>
- </Properties>
- </Col>
- <Col sticky>
- <CodeGroup
- title="Request"
- tag="POST"
- label="/datasets/<uuid:dataset_id>/tags"
- targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n`}
- >
- ```bash {{ title: 'cURL' }}
- curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
- --header 'Authorization: Bearer {api_key}' \
- --header 'Content-Type: application/json' \
- ```
- </CodeGroup>
- <CodeGroup title="Response">
- ```json {{ title: 'Response' }}
- {
- "data":
- [
- {"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
- "name": "123"
- },
- ...
- ],
- "total": 3
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
-
-
- <hr style={{ marginLeft: 0, marginRight: 0, width: '100%', maxWidth: '100%' }} />
-
-
- <Row>
- <Col>
- ### Error message
- <Properties>
- <Property name='code' type='string' key='code'>
- Error code
- </Property>
- </Properties>
- <Properties>
- <Property name='status' type='number' key='status'>
- Error status
- </Property>
- </Properties>
- <Properties>
- <Property name='message' type='string' key='message'>
- Error message
- </Property>
- </Properties>
- </Col>
- <Col>
- <CodeGroup title="Example">
- ```json {{ title: 'Response' }}
- {
- "code": "no_file_uploaded",
- "message": "Please upload your file.",
- "status": 400
- }
- ```
- </CodeGroup>
- </Col>
- </Row>
- <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
- <thead style={{ background: '#f9fafc' }}>
- <tr>
- <th className="p-2 border border-slate-300">code</th>
- <th className="p-2 border border-slate-300">status</th>
- <th className="p-2 border border-slate-300">message</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td className="p-2 border border-slate-300">no_file_uploaded</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">Please upload your file.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">too_many_files</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">Only one file is allowed.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">file_too_large</td>
- <td className="p-2 border border-slate-300">413</td>
- <td className="p-2 border border-slate-300">File size exceeded.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">unsupported_file_type</td>
- <td className="p-2 border border-slate-300">415</td>
- <td className="p-2 border border-slate-300">File type not allowed.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">dataset_not_initialized</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">archived_document_immutable</td>
- <td className="p-2 border border-slate-300">403</td>
- <td className="p-2 border border-slate-300">The archived document is not editable.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
- <td className="p-2 border border-slate-300">409</td>
- <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">invalid_action</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">Invalid action.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">document_already_finished</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">document_indexing</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
- </tr>
- <tr>
- <td className="p-2 border border-slate-300">invalid_metadata</td>
- <td className="p-2 border border-slate-300">400</td>
- <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
- </tr>
- </tbody>
- </table>
- <div className="pb-4" />
|