Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create and update dataset #2110

Merged
merged 17 commits into from
Aug 27, 2024
Merged

create and update dataset #2110

merged 17 commits into from
Aug 27, 2024

Conversation

Feiue
Copy link
Contributor

@Feiue Feiue commented Aug 27, 2024

What problem does this PR solve?

Added the ability to create and update dataset for SDK

Type of change

  • New Feature (non-breaking change which adds functionality)

@@ -0,0 +1,72 @@
from flask import request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from flask import request
# 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.
#
from flask import request

@manager.route('/save', methods=['POST'])
def save():
req = request.json
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove try...except

else:
if req["tenant_id"] != tenant_id or req["embd_id"] != t.embd_id :
return get_data_error_result(
retmsg="Can't change tenant_id or embedding_model")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if chunk_num > 0, parser method is not changable.
count of chunk and document are constant.

"""
res_create = self.post("/create", {"name": dataset_name})
def create_dataset(self, name:str,avatar:str="",description:str="",language:str="English",permission:str="me",
document_count:int=0,chunk_count:int=0,parse_method:str="0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
document_count:int=0,chunk_count:int=0,parse_method:str="0",
document_count:int=0,chunk_count:int=0,parse_method:str="naive",

return res.json()["retmsg"]


'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

self.dataset_url = f"{self.api_url}/kb"
self.authorization_header = {"Authorization": "{}".format(self.user_key)}
self.api_url = f"{base_url}/api/{version}"
self.dataset_url = f"{self.api_url}/dataset"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.dataset_url = f"{self.api_url}/dataset"

api/apps/sdk/dataset.py Outdated Show resolved Hide resolved
@KevinHuSh KevinHuSh merged commit 0bea7f2 into infiniflow:main Aug 27, 2024
1 check passed
Halfknow pushed a commit to Halfknow/ragflow that referenced this pull request Nov 11, 2024
### What problem does this PR solve?

Added the ability to create and update dataset for SDK

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: root <root@xwg>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants