"""Verify Dify KB configuration""" import requests, json api_key = 'dataset-xsT85hlYqhXcudorohrokWGo' base_url = 'http://dify.bianwoyou.cn' dataset_id = '3ff939b3-8686-44f6-8ef5-65b1e53b55d3' headers = {'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json'} resp = requests.get(f'{base_url}/v1/datasets/{dataset_id}', headers=headers, timeout=15) info = resp.json() rm = info.get('retrieval_model_dict', {}) print(f'KB Name: {info.get("name")}') print(f'Documents: {info.get("document_count")}') print(f'Words: {info.get("word_count", "?")}') print(f'Search: {rm.get("search_method")}') print(f'Top-K: {rm.get("top_k")}') print(f'Rerank: enabled={rm.get("reranking_enable")} model={rm.get("reranking_model", {}).get("reranking_model_name", "null")}') print(f'Threshold: enabled={rm.get("score_threshold_enabled")} value={rm.get("score_threshold")}')