Metadata-Version: 2.5
Name: ikc-open-platform-sdk
Version: 0.1.0
Summary: ikc-open-platform 第三方开发者 SDK：API Key 认证 + 统一壳解包 + 四类业务域（知识库/文档/解析/检索），业务模型复用 ikc-sdk-lib
Author: SITECH-iKM
Requires-Python: >=3.12
Requires-Dist: httpx<1.0,>=0.27
Requires-Dist: ikc-sdk-lib==0.6.1
Requires-Dist: pydantic<3.0,>=2.7
Description-Content-Type: text/markdown

# ikc-open-platform-sdk

ikc-open-platform 第三方开发者 SDK（导入包 `ikc_open_platform_sdk`）。

- 认证：应用 API Key（`Authorization: Bearer <api-key>`，由管理面 `/admin/apps/{appId}/keys` 创建）。
- 协议：统一响应壳 `errCode/errMsg/data/traceId/reqId` 解包；业务模型一律复用 `ikc-sdk-lib`（本 SDK 不自定义业务模型）。
- 追踪：每请求注入 23 位纯数字 `X-Request-Id`；`reqId` 可显式传入，缺省 SDK 生成 `req_` 前缀值并随壳回显。
- 能力面（四类业务域）：
  - `client.knowledge_bases`：create / update / query / get
  - `client.documents`：ingest / ingest_and_parse / upload / get
  - `client.parse`：parse / parse_direct / query_result / issue_download_ticket / download
  - `client.search`：universal_search / deep_search / query（兼容别名）
- 错误模型：`OpenPlatformAPIError`（errCode/errMsg/traceId/reqId）、`OpenPlatformConnectionError`、`OpenPlatformTimeoutError`、`OpenPlatformProtocolError`。

## 安装

```bash
pip install ikc-open-platform-sdk          # PyPI（发布后）
pip install sdk/python/                    # 或本地源码
```

## 快速开始

```python
from ikc_open_platform_sdk import OpenPlatformClient
from ikc_sdk.core.api.search.universal import SearchQueryRequest

with OpenPlatformClient("http://localhost:18000", api_key="<app-api-key>") as client:
    result = client.search.universal_search(SearchQueryRequest(query="IKC 平台"))
    for hit in result.hits:
        print(hit)
```

## 测试

```bash
python -m pytest sdk/python/tests -q
```
