Skip to content

Commit

Permalink
code merge error (#8183)
Browse files Browse the repository at this point in the history
Co-authored-by: crazywoola <[email protected]>
  • Loading branch information
JohnJyong and crazywoola authored Sep 10, 2024
1 parent c8df92d commit 85ff82a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions api/controllers/console/datasets/datasets_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,17 @@ def post(self):
"doc_language", type=str, default="English", required=False, nullable=False, location="json"
)
parser.add_argument("retrieval_model", type=dict, required=False, nullable=False, location="json")
parser.add_argument("embedding_model", type=str, required=False, nullable=True, location="json")
parser.add_argument("embedding_model_provider", type=str, required=False, nullable=True, location="json")
args = parser.parse_args()

# The role of the current user in the ta table must be admin, owner, or editor, or dataset_operator
if not current_user.is_dataset_editor:
raise Forbidden()

if args["indexing_technique"] == "high_quality":
if args["embedding_model"] is None or args["embedding_model_provider"] is None:
raise ValueError("embedding model and embedding model provider are required for high quality indexing.")
try:
model_manager = ModelManager()
model_manager.get_default_model_instance(
Expand Down
6 changes: 1 addition & 5 deletions api/services/dataset_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,12 +1057,8 @@ def save_document_without_dataset_id(tenant_id: str, document_data: dict, accoun
dataset_collection_binding_id = None
retrieval_model = None
if document_data["indexing_technique"] == "high_quality":
model_manager = ModelManager()
embedding_model = model_manager.get_default_model_instance(
tenant_id=current_user.current_tenant_id, model_type=ModelType.TEXT_EMBEDDING
)
dataset_collection_binding = DatasetCollectionBindingService.get_dataset_collection_binding(
embedding_model.provider, embedding_model.model
document_data["embedding_model_provider"], document_data["embedding_model"]
)
dataset_collection_binding_id = dataset_collection_binding.id
if document_data.get("retrieval_model"):
Expand Down

0 comments on commit 85ff82a

Please sign in to comment.