Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix Python SDK example error. (#4263)

Kevin Huc7818770f46a
diff --git a/docs/references/python_api_reference.md b/docs/references/python_api_reference.md
index 075cd1a693..281c7bcc24 100644
--- a/docs/references/python_api_reference.md
+++ b/docs/references/python_api_reference.md
@@ -894,17 +894,12 @@ dataset = rag_object.list_datasets(name="ragflow")
dataset = dataset[0]
name = 'ragflow_test.txt'
path = './test_data/ragflow_test.txt'
-rag_object.create_document(dataset, name=name, blob=open(path, "rb").read())
-doc = dataset.list_documents(name=name)
-doc = doc[0]
-dataset.async_parse_documents([doc.id])
-for c in rag_object.retrieve(question="What's ragflow?",
- dataset_ids=[dataset.id], document_ids=[doc.id],
- page=1, page_size=30, similarity_threshold=0.2,
- vector_similarity_weight=0.3,
- top_k=1024
- ):
- print(c)
+documents =[{"displayed_name":"test_retrieve_chunks.txt","blob":open(path, "rb").read()}]
+docs = dataset.upload_documents(documents)
+doc = docs[0]
+doc.add_chunk(content="This is a chunk addition test")
+for c in rag_object.retrieve(dataset_ids=[dataset.id],document_ids=[doc.id]):
+ print(c)
```
---
diff --git a/sdk/python/ragflow_sdk/dataset.py b/sdk/python/ragflow_sdk/dataset.py
deleted file mode 100644
index 5984aa62ff..0000000000
--- a/sdk/python/ragflow_sdk/dataset.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright 2024 The InfiniFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-class DataSet:
- def __init__(self, user_key, dataset_url, uuid, name):
- self.user_key = user_key
- self.dataset_url = dataset_url
- self.uuid = uuid
- self.name = name