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

Fix error response #3719

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/apps/chunk_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get():
kb_ids = KnowledgebaseService.get_kb_ids(tenant_id)
chunk = settings.docStoreConn.get(chunk_id, search.index_name(tenant_id), kb_ids)
if chunk is None:
return server_error_response("Chunk not found")
return server_error_response(Exception("Chunk not found"))
k = []
for n in chunk.keys():
if re.search(r"(_vec$|_sm_|_tks|_ltks)", n):
Expand Down
2 changes: 2 additions & 0 deletions rag/llm/rerank_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class XInferenceRerank(Base):
def __init__(self, key="xxxxxxx", model_name="", base_url=""):
if base_url.find("/v1") == -1:
base_url = urljoin(base_url, "/v1/rerank")
if base_url.find("/rerank") == -1:
base_url = urljoin(base_url, "/v1/rerank")
self.model_name = model_name
self.base_url = base_url
self.headers = {
Expand Down
6 changes: 5 additions & 1 deletion sdk/python/test/test_frontend_api/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import random
import string


def test_dataset(get_auth):
# create dataset
res = create_dataset(get_auth, "test_create_dataset")
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_dataset_1k_dataset(get_auth):
assert res.get("code") == 0, f"{res.get('message')}"
print(f"{len(dataset_list)} datasets are deleted")


def test_duplicated_name_dataset(get_auth):
# create dataset
for i in range(20):
Expand All @@ -69,7 +71,7 @@ def test_duplicated_name_dataset(get_auth):
data = res.get("data").get("kbs")
dataset_list = []
pattern = r'^test_create_dataset.*'
for item in data:
for item in data.get("kbs"):
KevinHuSh marked this conversation as resolved.
Show resolved Hide resolved
dataset_name = item.get("name")
dataset_id = item.get("id")
dataset_list.append(dataset_id)
Expand All @@ -81,6 +83,7 @@ def test_duplicated_name_dataset(get_auth):
assert res.get("code") == 0, f"{res.get('message')}"
print(f"{len(dataset_list)} datasets are deleted")


def test_invalid_name_dataset(get_auth):
# create dataset
# with pytest.raises(Exception) as e:
Expand All @@ -99,6 +102,7 @@ def test_invalid_name_dataset(get_auth):
assert res['code'] == 102
print(res)


def test_update_different_params_dataset(get_auth):
# create dataset
res = create_dataset(get_auth, "test_create_dataset")
Expand Down
Loading