mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-03 03:09:49 +00:00
Fix Python SDK example error. (#4263)
### What problem does this PR solve? #4253 ### Type of change - [x] Documentation Update
This commit is contained in:
parent
6f6303d017
commit
c7818770f4
@ -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)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user