소스 검색

Updated dataset APIs (#2820)

### What problem does this PR solve?


### Type of change


- [x] Documentation Update
tags/v0.13.0
writinwaters 1 년 전
부모
커밋
8e5efcc47f
No account linked to committer's email address
2개의 변경된 파일174개의 추가작업 그리고 156개의 파일을 삭제
  1. 54
    54
      api/http_api.md
  2. 120
    102
      api/python_api_reference.md

+ 54
- 54
api/http_api.md 파일 보기

@@ -5,7 +5,7 @@

**POST** `/api/v1/dataset`

Creates a dataset.
Creates a knowledge base (dataset).

### Request

@@ -31,11 +31,11 @@ Creates a dataset.
#### Request example

```bash
# "id": id must not be provided.
# "name": name is required and can't be duplicated.
# "id": "id" must not be provided.
# "name": name is required and cannot be duplicated.
# "tenant_id": tenant_id must not be provided.
# "embedding_model": embedding_model must not be provided.
# "navie" means general.
# "embedding_model": REQUIRED.
# "naive": general.
curl --request POST \
--url http://{address}/api/v1/dataset \
--header 'Content-Type: application/json' \
@@ -51,21 +51,21 @@ curl --request POST \
#### Request parameters

- `"id"`: (*Body parameter*)
The ID of the created dataset used to uniquely identify different datasets.
- If creating a dataset, `id` must not be provided.
The unique identifier of each created dataset.
- When creating a dataset, `id` must not be provided.

- `"name"`: (*Body parameter*)
The name of the dataset, which must adhere to the following requirements:
- Required when creating a dataset and must be unique.
- If updating a dataset, `name` must still be unique.
- When updating a dataset, `name` must still be unique.

- `"avatar"`: (*Body parameter*)
Base64 encoding of the avatar.

- `"tenant_id"`: (*Body parameter*)
The ID of the tenant associated with the dataset, used to link it with specific users.
- If creating a dataset, `tenant_id` must not be provided.
- If updating a dataset, `tenant_id` cannot be changed.
- When creating a dataset, `tenant_id` must not be provided.
- When updating a dataset, `tenant_id` cannot be changed.

- `"description"`: (*Body parameter*)
The description of the dataset.
@@ -74,31 +74,31 @@ curl --request POST \
The language setting for the dataset.

- `"embedding_model"`: (*Body parameter*)
Embedding model used in the dataset to generate vector embeddings.
- If creating a dataset, `embedding_model` must not be provided.
- If updating a dataset, `embedding_model` cannot be changed.
Embedding model used in the dataset for generating vector embeddings.
- When creating a dataset, `embedding_model` must not be provided.
- When updating a dataset, `embedding_model` cannot be changed.

- `"permission"`: (*Body parameter*)
Specifies who can manipulate the dataset.

- `"document_count"`: (*Body parameter*)
Document count of the dataset.
- If updating a dataset, `document_count` cannot be changed.
- When updating a dataset, `document_count` cannot be changed.

- `"chunk_count"`: (*Body parameter*)
Chunk count of the dataset.
- If updating a dataset, `chunk_count` cannot be changed.
- When updating a dataset, `chunk_count` cannot be changed.

- `"parse_method"`: (*Body parameter*)
Parsing method of the dataset.
- If updating `parse_method`, `chunk_count` must be greater than 0.
- When updating `parse_method`, `chunk_count` must be greater than 0.

- `"parser_config"`: (*Body parameter*)
The configuration settings for the dataset parser.

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```json
{
@@ -139,8 +139,7 @@ The successful response includes a JSON object like the following:
- `"error_code"`: `integer`
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```json
{
@@ -153,7 +152,7 @@ The error response includes a JSON object like the following:

**DELETE** `/api/v1/dataset`

Deletes datasets by ids.
Deletes datasets by their IDs.

### Request

@@ -169,7 +168,7 @@ Deletes datasets by ids.
#### Request example

```bash
# Either id or name must be provided, but not both.
# Specify either "ids" or "names", NOT both.
curl --request DELETE \
--url http://{address}/api/v1/dataset \
--header 'Content-Type: application/json' \
@@ -181,13 +180,13 @@ curl --request DELETE \

#### Request parameters

- `"ids"`: (*Body parameter*)
Dataset IDs to delete.
- `"ids"`: (*Body parameter*)
IDs of the datasets to delete.


### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```json
{
@@ -199,7 +198,7 @@ The successful response includes a JSON object like the following:
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```json
{
@@ -212,7 +211,7 @@ The error response includes a JSON object like the following:

**PUT** `/api/v1/dataset/{dataset_id}`

Updates a dataset by its id.
Updates a dataset by its ID.

### Request

@@ -227,14 +226,14 @@ Updates a dataset by its id.
#### Request example

```bash
# "id": id is required.
# "name": If you update name, it can't be duplicated.
# "tenant_id": If you update tenant_id, it can't be changed
# "embedding_model": If you update embedding_model, it can't be changed.
# "chunk_count": If you update chunk_count, it can't be changed.
# "document_count": If you update document_count, it can't be changed.
# "parse_method": If you update parse_method, chunk_count must be 0.
# "navie" means general.
# "id": REQUIRED
# "name": If you update "name", it cannot be duplicated.
# "tenant_id": If you update "tenant_id", it cannot be changed
# "embedding_model": If you update "embedding_model", it cannot be changed.
# "chunk_count": If you update "chunk_count", it cannot be changed.
# "document_count": If you update "document_count", it cannot be changed.
# "parse_method": If you update "parse_method", "chunk_count" must be 0.
# "naive": General.
curl --request PUT \
--url http://{address}/api/v1/dataset/{dataset_id} \
--header 'Content-Type: application/json' \
@@ -245,17 +244,18 @@ curl --request PUT \
"embedding_model": "BAAI/bge-zh-v1.5",
"chunk_count": 0,
"document_count": 0,
"parse_method": "navie"
"parse_method": "naive"
}'
```

#### Request parameters
(Refer to the "Create Dataset" for the complete structure of the request parameters.)

See the "Create Dataset" for the complete structure of the request parameters.


### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```json
{
@@ -267,7 +267,7 @@ The successful response includes a JSON object like the following:
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```json
{
@@ -321,7 +321,7 @@ curl --request GET \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```json
{
@@ -365,7 +365,7 @@ The successful response includes a JSON object like the following:
```

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```json
{
@@ -409,7 +409,7 @@ curl --request POST \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -421,7 +421,7 @@ The successful response includes a JSON object like the following:
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -464,7 +464,7 @@ curl --request GET \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -476,7 +476,7 @@ The successful response includes a JSON object like the following:
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -528,7 +528,7 @@ curl --request GET \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -605,7 +605,7 @@ The successful response includes a JSON object like the following:
`0`: The operation succeeds.

The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -659,7 +659,7 @@ curl --request PUT \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -667,7 +667,7 @@ The successful response includes a JSON object like the following:
}
```
The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -710,7 +710,7 @@ curl --request POST \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -718,7 +718,7 @@ The successful response includes a JSON object like the following:
}
```
The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -761,7 +761,7 @@ curl --request DELETE \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -769,7 +769,7 @@ The successful response includes a JSON object like the following:
}
```
The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{
@@ -808,7 +808,7 @@ curl --request GET \

### Response

The successful response includes a JSON object like the following:
A successful response includes a JSON object like the following:

```shell
{
@@ -863,7 +863,7 @@ The successful response includes a JSON object like the following:
}
```
The error response includes a JSON object like the following:
An error response includes a JSON object like the following:

```shell
{

+ 120
- 102
api/python_api_reference.md 파일 보기

@@ -24,7 +24,7 @@ Creates a knowledge base (dataset).

### Parameters

#### name: `str`, *Required*
#### name: *Required*

The unique name of the dataset to create. It must adhere to the following requirements:

@@ -36,70 +36,81 @@ The unique name of the dataset to create. It must adhere to the following requir
- Maximum 65,535 characters.
- Case-insensitive.

#### avatar: `str`
#### avatar

Base64 encoding of the avatar. Defaults to `""`

#### tenant_id: `str`
#### tenant_id

The id of the tenant associated with the created dataset is used to identify different users. Defaults to `None`.

- If creating a dataset, tenant_id must not be provided.
- If updating a dataset, tenant_id can't be changed.
- When creating a dataset, `tenant_id` must not be provided.
- When updating a dataset, `tenant_id` cannot be changed.

#### description: `str`
#### description

The description of the created dataset. Defaults to `""`.

#### language: `str`
#### language

The language setting of the created dataset. Defaults to `"English"`. ????????????
The language setting of the created dataset. Defaults to `"English"`.

#### embedding_model: `str`
#### embedding_model

The specific model used by the dataset to generate vector embeddings. Defaults to `""`.

- If creating a dataset, embedding_model must not be provided.
- If updating a dataset, embedding_model can't be changed.
- When creating a dataset, `embedding_model` must not be provided.
- When updating a dataset, `embedding_model` cannot be changed.

#### permission: `str`
#### permission

Specify who can operate on the dataset. Defaults to `"me"`.
The person who can operate on the dataset. Defaults to `"me"`.

#### document_count: `int`
#### document_count

The number of documents associated with the dataset. Defaults to `0`.

- If updating a dataset, `document_count` can't be changed.
:::tip NOTE
When updating a dataset, `document_count` cannot be changed.
:::

#### chunk_count: `int`
#### chunk_count

The number of data chunks generated or processed by the created dataset. Defaults to `0`.

- If updating a dataset, chunk_count can't be changed.
:::tip NOTE
When updating a dataset, `chunk_count` cannot be changed.
:::

#### parse_method

#### parse_method, `str`
The method used by the dataset to parse and process data. Defaults to `"naive"`.

The method used by the dataset to parse and process data.
:::tip NOTE
When updating `parse_method` in a dataset, `chunk_count` must be greater than 0.
:::

- If updating parse_method in a dataset, chunk_count must be greater than 0. Defaults to `"naive"`.
#### parser_config

#### parser_config, `Dataset.ParserConfig`
The parser configuration of the dataset. A `ParserConfig` object contains the following attributes:

The configuration settings for the parser used by the dataset.
- `chunk_token_count`: Defaults to `128`.
- `layout_recognize`: Defaults to `True`.
- `delimiter`: Defaults to `'\n!?。;!?'`.
- `task_page_size`: Defaults to `12`.

### Returns
```python
DataSet
description: dataset object
```
- Success: A `dataset` object.
- Failure: `Exception`
### Examples

```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
ds = rag.create_dataset(name="kb_1")
rag_object = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
ds = rag_object.create_dataset(name="kb_1")
```

---
@@ -107,28 +118,27 @@ ds = rag.create_dataset(name="kb_1")
## Delete knowledge bases

```python
RAGFlow.delete_datasets(ids: List[str] = None)
RAGFlow.delete_datasets(ids: list[str] = None)
```
Deletes knowledge bases.
### Parameters

#### ids: `List[str]`
Deletes knowledge bases by name or ID.

### Parameters

The ids of the datasets to be deleted.
#### ids

The IDs of the knowledge bases to delete.

### Returns

```python
no return
```
- Success: No value is returned.
- Failure: `Exception`

### Examples

```python
from ragflow import RAGFlow
#### Delete knowledge bases by name

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
```python
rag.delete_datasets(ids=["id_1","id_2"])
```

@@ -144,76 +154,84 @@ RAGFlow.list_datasets(
desc: bool = True,
id: str = None,
name: str = None
) -> List[DataSet]
) -> list[DataSet]
```

Lists all knowledge bases in the RAGFlow system.
Lists all knowledge bases.

### Parameters

#### page: `int`
#### page

The current page number to retrieve from the paginated data. This parameter determines which set of records will be fetched. Defaults to `1`.

#### page_size: `int`
#### page_size

The number of records to retrieve per page. This controls how many records will be included in each page. Defaults to `1024`.

#### order_by: `str`
#### order_by

The field by which the records should be sorted. This specifies the attribute or column used to order the results. Defaults to `"create_time"`.
The attribute by which the results are sorted. Defaults to `"create_time"`.

#### desc: `bool`
#### desc

Whether the sorting should be in descending order. Defaults to `True`.
Indicates whether to sort the results in descending order. Defaults to `True`.

#### id: `str`
#### id

The id of the dataset to be got. Defaults to `None`.
The ID of the dataset to retrieve. Defaults to `None`.

#### name: `str`
#### name

The name of the dataset to be got. Defaults to `None`.
The name of the dataset to retrieve. Defaults to `None`.

### Returns

```python
List[DataSet]
description:the list of datasets.
```
- Success: A list of `DataSet` objects representing the retrieved knowledge bases.
- Failure: `Exception`.

### Examples

#### Retrieve a list of knowledge bases associated with the current user

```python
from ragflow import RAGFlow
for ds in rag_object.list_datasets():
print(ds.name)
```

#### Retrieve a knowledge base by ID

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
for ds in rag.list_datasets():
print(ds)
```python
ds = rag_object.list_datasets(id = "id_1")
print(ds.name)
```

---


## Update knowledge base
## Update knowledge base

```python
DataSet.update(update_message: dict)
```

Updates the current knowledge base.

### Parameters

#### update_message

### Returns

```python
no return
```
- Success: No value is returned.
- Failure: `Exception`

### Examples

```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
ds = rag.get_dataset(name="kb_1")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
ds = rag.list_datasets(name="kb_1")
ds.update({"parse_method":"manual", ...}}
```

@@ -336,7 +354,7 @@ Duration of the processing in seconds or minutes. Defaults to `0.0`.
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d",name='testdocument.txt')
print(doc)
```
@@ -358,7 +376,7 @@ bool
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d")
doc.parser_method= "manual"
doc.save()
@@ -381,7 +399,7 @@ bytes of the document.
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d")
open("~/ragflow.txt", "w+").write(doc.download())
print(doc)
@@ -392,7 +410,7 @@ print(doc)
## List documents

```python
Dataset.list_docs(keywords: str=None, offset: int=0, limit:int = -1) -> List[Document]
Dataset.list_docs(keywords: str=None, offset: int=0, limit:int = -1) -> list[Document]
```

### Parameters
@@ -407,18 +425,18 @@ The beginning number of records for paging. Defaults to `0`.

#### limit: `int`

Records number to return, -1 means all of them. Records number to return, -1 means all of them.
Records number to return, -1 means all of them.

### Returns

List[Document]
list[Document]

### Examples

```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
ds = rag.create_dataset(name="kb_1")

filename1 = "~/ragflow.txt"
@@ -448,7 +466,7 @@ description: delete success or not
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
ds = rag.create_dataset(name="kb_1")

filename1 = "~/ragflow.txt"
@@ -581,7 +599,7 @@ chunk
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d")
chunk = doc.add_chunk(content="xxxxxxx")
```
@@ -603,7 +621,7 @@ bool
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d")
chunk = doc.add_chunk(content="xxxxxxx")
chunk.delete()
@@ -626,7 +644,7 @@ bool
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
doc = rag.get_document(id="wdfxb5t547d")
chunk = doc.add_chunk(content="xxxxxxx")
chunk.content = "sdfx"
@@ -638,7 +656,7 @@ chunk.save()
## Retrieval

```python
RAGFlow.retrieval(question:str, datasets:List[Dataset], document=List[Document]=None, offset:int=0, limit:int=6, similarity_threshold:float=0.1, vector_similarity_weight:float=0.3, top_k:int=1024) -> List[Chunk]
RAGFlow.retrieval(question:str, datasets:list[Dataset], document=list[Document]=None, offset:int=0, limit:int=6, similarity_threshold:float=0.1, vector_similarity_weight:float=0.3, top_k:int=1024) -> list[Chunk]
```

### Parameters
@@ -647,11 +665,11 @@ RAGFlow.retrieval(question:str, datasets:List[Dataset], document=List[Document]=

The user query or query keywords. Defaults to `""`.

#### datasets: `List[Dataset]`, *Required*
#### datasets: `list[Dataset]`, *Required*

The scope of datasets.

#### document: `List[Document]`
#### document: `list[Document]`

The scope of document. `None` means no limitation. Defaults to `None`.

@@ -677,14 +695,14 @@ Number of records engaged in vector cosine computaton. Defaults to `1024`.

### Returns

List[Chunk]
list[Chunk]

### Examples

```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
ds = rag.get_dataset(name="ragflow")
name = 'ragflow_test.txt'
path = 'test_data/ragflow_test.txt'
@@ -715,7 +733,7 @@ Chat APIs
RAGFlow.create_chat(
name: str = "assistant",
avatar: str = "path",
knowledgebases: List[DataSet] = ["kb1"],
knowledgebases: list[DataSet] = ["kb1"],
llm: Chat.LLM = None,
prompt: Chat.Prompt = None
) -> Chat
@@ -736,7 +754,7 @@ The name of the created chat. Defaults to `"assistant"`.

The icon of the created chat. Defaults to `"path"`.

#### knowledgebases: `List[DataSet]`
#### knowledgebases: `list[DataSet]`

Select knowledgebases associated. Defaults to `["kb1"]`.

@@ -778,7 +796,7 @@ You are an intelligent assistant. Please summarize the content of the knowledge
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
kb = rag.get_dataset(name="kb_1")
assi = rag.create_chat("Miss R", knowledgebases=[kb])
```
@@ -802,7 +820,7 @@ no return
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
kb = rag.get_knowledgebase(name="kb_1")
assi = rag.create_chat("Miss R", knowledgebases=[kb])
assi.update({"temperature":0.8})
@@ -813,7 +831,7 @@ assi.update({"temperature":0.8})
## Delete chats

```python
RAGFlow.delete_chats(ids: List[str] = None)
RAGFlow.delete_chats(ids: list[str] = None)
```
### Parameters

@@ -833,7 +851,7 @@ no return
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
rag.delete_chats(ids=["id_1","id_2"])
```

@@ -849,7 +867,7 @@ RAGFlow.list_chats(
desc: bool = True,
id: str = None,
name: str = None
) -> List[Chat]
) -> list[Chat]
```

### Parameters
@@ -892,7 +910,7 @@ A list of chat objects.
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
for assi in rag.list_chats():
print(assi)
```
@@ -922,7 +940,7 @@ The id of the created session is used to identify different sessions.

The name of the created session. Defaults to `"New session"`.

#### messages: `List[Message]`
#### messages: `list[Message]`

The messages of the created session.
- messages cannot be provided.
@@ -945,7 +963,7 @@ The id of associated chat
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
assi = rag.list_chats(name="Miss R")
assi = assi[0]
sess = assi.create_session()
@@ -967,7 +985,7 @@ no return
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
assi = rag.list_chats(name="Miss R")
assi = assi[0]
sess = assi.create_session("new_session")
@@ -1005,7 +1023,7 @@ The id of the message. `id` is automatically generated. Defaults to `None`. ????

The content of the message. Defaults to `"Hi! I am your assistant, can I help you?"`.

#### reference: `List[Chunk]`
#### reference: `list[Chunk]`

The auto-generated reference of the message. Each `chunk` object includes the following attributes:

@@ -1027,7 +1045,7 @@ The auto-generated reference of the message. Each `chunk` object includes the fo
A similarity score based on vector representations. This score is obtained by converting texts, words, or objects into vectors and then calculating the cosine similarity or other distance measures between these vectors to determine the similarity in vector space. A higher value indicates greater similarity in the vector space. Defaults to `None`. ?????????????????????????????????
- **term_similarity**: `float`
The similarity score based on terms or keywords. This score is calculated by comparing the similarity of key terms between texts or datasets, typically measuring how similar two words or phrases are in meaning or context. A higher value indicates a stronger similarity between terms. Defaults to `None`. ???????????????????
- **position**: `List[string]`
- **position**: `list[string]`
Indicates the position or index of keywords or specific terms within the text. An array is typically used to mark the location of keywords or specific elements, facilitating precise operations or analysis of the text. Defaults to `None`. ??????????????

### Examples
@@ -1035,7 +1053,7 @@ The auto-generated reference of the message. Each `chunk` object includes the fo
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
assi = rag.list_chats(name="Miss R")
assi = assi[0]
sess = assi.create_session()
@@ -1066,12 +1084,12 @@ Chat.list_sessions(
desc: bool = True,
id: str = None,
name: str = None
) -> List[Session]
) -> list[Session]
```

### Returns

List[Session]
list[Session]
description: the List contains information about multiple assistant object, with each dictionary containing information about one assistant.

### Examples
@@ -1079,7 +1097,7 @@ description: the List contains information about multiple assistant object, with
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
assi = rag.list_chats(name="Miss R")
assi = assi[0]
for sess in assi.list_sessions():
@@ -1122,7 +1140,7 @@ The name of the chat to be retrieved.
## Delete session

```python
Chat.delete_sessions(ids:List[str] = None)
Chat.delete_sessions(ids:list[str] = None)
```

### Returns
@@ -1134,13 +1152,13 @@ no return
```python
from ragflow import RAGFlow

rag = RAGFlow(api_key="xxxxxx", base_url="http://xxx.xx.xx.xxx:9380")
rag = RAGFlow(api_key="<YOUR_API_KEY>", base_url="http://<YOUR_BASE_URL>:9380")
assi = rag.list_chats(name="Miss R")
assi = assi[0]
assi.delete_sessions(ids=["id_1","id_2"])
```
### Parameters
#### ids: `List[string]`
#### ids: `list[string]`
IDs of the sessions to be deleted.
- `None`


Loading…
취소
저장