
Knowledge Base API
API Overview
Our own services
API Console
Log in to explore more features! Click to Log In
API Reference (9)
| API Description | API Endpoint | Request Method | Stability | Parameter Description |
|---|---|---|---|---|
Create(Knowledge Base) | POST | Stable | View Details | |
Document Details For Knowledge Base conversations, the API Key of the Knowledge Base robot will be automatically bound to the Knowledge Base selected in the background, and kb_id does not need to be passed when using this type of key Price List: https://302.ai/price Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body application/jsonkb_idintegerRequired Knowledge base id model_namestringRequired Need for models for chat use querystringRequired Current chat streambooleanRequired Streaming or not, default streaming response historyarray[object]Required historical chat rolestringRequired contentstringRequired top_kintegerRequired Get top n from the vector library to use as a contextual dialog score_thresholdintegerRequired Filter weights, only records greater than this value will be used temperaturenumberRequired Model stochasticity | ||||
Delete(Knowledge Base) | DELETE | Stable | View Details | |
Document Details Delete the specified knowledge base Price:0PTC/call Request Parameters Path Parameterskb_idintegerRequired Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}} | ||||
Upload | POST | Stable | View Details | |
Document Details Uploading files to a specified knowledge base Price list: https://302.ai/price Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body multipart/form-datafilesstringRequired List of array files kb_idintegerRequired Specify the knowledge base to be uploaded chunk_sizeintegerOptional Maximum length of a single paragraph of text in the knowledge base Example Value: 250chunk_overlapintegerOptional Adjacent text overlap length in the knowledge base Example Value: 50split_modestringOptional Specify the participle pattern, either leave it blank or fill it with jina. max_chunk_lengthintegerOptional Effective when jina is specified as the lexical mode. Example Value: 4000 | ||||
Create(Knowledge Base) | POST | Stable | View Details | |
Document Details Create a Knowledge Base model_id: llm_model_id: Price:0PTC/call Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body application/jsonkb_namestringOptional Name of the knowledge base kb_infostringOptional Knowledge Base Description kb_typestringOptional chatchat or rag_nano model_idintegerOptional optional;embedding data processing model llm_model_idintegerOptional optional;LLM model | ||||
List(KB) | GET | Stable | View Details | |
Document Details Get a list of knowledge bases Price:0PTC/call Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Query ParameterspageintegerOptional Example Value: 1page_sizeintegerOptional Example Value: 10 | ||||
Info | GET | Stable | View Details | |
Document Details Access to Knowledge Base Details Price:0PTC/call Request Parameters Path Parameterskb_idstringRequired Example Value: 0Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}} | ||||
Chat(with KB-OpenAI compatible) | POST | Stable | View Details | |
Document Details API Key needs to be filled with the key corresponding to the Knowledge Base robot Price List: https://302.ai/price Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body application/jsonmodelstringRequired The ID of the model to be used. For detailed information on which models are applicable to the chat API, please view Model endpoint compatibility messagesarray[object]Required Generate messages in chat format for chat completions. rolestringOptional contentstringOptional temperatureintegerOptional What sampling temperature to use, ranging from 0 to 2. Higher values, such as 0.8, will make the output more random, while lower values, like 0.2, will make it more focused and deterministic. We generally recommend adjusting either this or top_pintegerOptional An alternative to temperature sampling is nucleus sampling, where the model considers tokens within the top_p probability mass. For instance, top_p = 0.1 means only tokens within the top 10% probability mass are considered. We recommend adjusting either this or nintegerOptional How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs. streambooleanOptional If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by stopstringOptional Up to 4 sequences where the API will stop generating further tokens. max_tokensintegerOptional The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model’s context length. presence_penaltynumberOptional Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics. See more information about frequency and presence penalties. frequency_penaltynumberOptional Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim. See more information about frequency and presence penalties. logit_biasnullOptional Modify the likelihood of specific tokens appearing in the completion. This can be done by providing a JSON object that maps tokens (identified by their token IDs in the tokenizer) to a bias value ranging from -100 to 100. Mathematically, this bias is added to the logits generated by the model before sampling. The exact effect varies depending on the model, but values between -1 and 1 will slightly decrease or increase the likelihood of selection, while values like -100 or 100 will either ban or exclusively select the relevant token. userstringOptional A unique identifier representing your end users, which helps OpenAI monitor and detect abuse. View more | ||||
Meta-Chunking(Text LLM slices) | POST | Stable | View Details | |
Document Details Use LLM’s text comprehension to segment content, ensuring the slices maintain coherent context Price List: https://302.ai/price Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body multipart/form-datatextstringRequired model_namestringOptional LLM name for meta chunking Example Value: gpt-4o-minilanguagestringOptional File language, options are zh/en, default is zh Example Value: zhdynamic_mergestringOptional Whether to merge dynamically, options are yes/no, default is no Example Value: no | ||||
Meta-Chunking(File LLM slices) | POST | Stable | View Details | |
Document Details Use LLM’s text comprehension to segment content, ensuring the slices maintain coherent context Price List: https://302.ai/price Request Parameters Header ParametersAuthorizationstringOptional Example Value: Bearer {{YOUR_API_KEY}}Request Body multipart/form-datafilesstringRequired Upload files, multiple files supported model_namestringOptional LLM names for meta_chunking slicing Example Value: gpt-4o-minilanguagestringOptional File language, options are zh/en, default is zh Example Value: zhdynamic_mergestringOptional Whether to merge dynamically, options are yes/no, default is no Example Value: no | ||||
API Pricing
| Model | Description | 302.AI Price |
|---|
Chat(with KB) | Chat with KB |
|
Chat(with KB-OpenAI compatible) | Chat with KB-OpenAI compatible |
|
Create(Knowledge Base) | Create Knowledge Base |
|
Delete(Knowledge Base) | Delete Knowledge Base |
|
Upload | Upload |
|
List(KB) | Get List |
|
Info | Get Info |
|
Meta-Chunking(Text LLM slices) | Text LLM slices |
|
Meta-Chunking(File LLM slices) | File LLM slices |
|