ikc-flash-sdk
ikc-flash-knowledge 记忆引擎的官方客户端(同步 + 异步)。服务端包内已同源 include 本 SDK
(ikc_flash_sdk);本目录的 pyproject.toml 用于独立分发(scripts/publish_sdk.sh)。
线缆模型与错误码的单一来源是
ikc-sdk-lib的ikc_sdk.flash(v0.14.0):本 SDK 的models/codes只是再导出,字段与码值一律不在此定义。
快速开始
from ikc_flash_sdk import IkCFlashClient
with IkCFlashClient("http://127.0.0.1:19400", token="dev-token") as client:
scope = {"agentId": "demo-agent", "threadId": "t-1"}
# 摄入(缺省异步:返回 jobId,用 .memory.job 轮询)
accepted = client.memory.observe(scope=scope, events=[{"role": "user", "content": "我叫老王,做知识管理"}])
# 召回(token 预算打包,直接塞进提示词)
recall = client.memory.recall(scope=scope, query="用户是谁", tokenBudget=800)
print(recall["packedContext"])
异步用法:async with AsyncIkCFlashClient(...) as client:,方法同名同参。
用自己的模型做加工:model= 逐字段覆盖服务端 model: 配置(网关侧 modelInfo 优先级最高),
优先级 调用级 > 客户端级 > 服务端;凭据只上行、不回显。
from ikc_flash_sdk import IkCFlashClient, ModelRef
with IkCFlashClient("http://127.0.0.1:19400", token="dev-token",
model=ModelRef(name="qwen3-32b", baseUrl="https://llm.customer.example/v1",
apiKey="sk-…")) as client:
data = client.memory.consolidate(scope={"agentId": "demo-agent"}, async_=False)
print(data["result"]["modelUsed"]) # {'provider': ..., 'name': 'qwen3-32b', 'source': 'request'}
作业台账:jobs() 读服务端作业列表(创建时间倒序 + 游标分页;store_backend=pg 时跨进程/重启可见)。
page = client.memory.jobs(scope_key='demo-agent|t-1', task='consolidate', statuses=['success'], limit=20)
for job in page["items"]:
print(job["jobId"], job["status"])
约定
- 只发调用方传入的字段:SDK 不把缺省值 pin 上线缆(服务端缺省可变,客户端不固化)。
- 错误码类型化:
IkCFlashRevisionConflictError/IkCFlashRecallParamsError等可按类型捕获, 也可用err_code统一判断;均继承ikc_sdk的IkcSdkError。 - 安全字段不进 SDK:不提供
tenantId/ 向量等入口(由实例侧身份与检索面注入)。
更多见 docs/SDK开发手册.md。
Metadata
Release files for ikc-flash-sdk 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ikc_flash_sdk-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for ikc_flash_sdk-0.4.2-py3-none-any.whl |
Release files / ikc_flash_sdk-0.4.2-py3-none-any.whl
| Download URL | ikc_flash_sdk-0.4.2-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb9c15c09e6f3e03521eceef4c4a5a8126822be39d76372eaae6aa70437166a3
|
|
BLAKE2b-256 checksum How to use checksums |
c62222bacc6764b97832353cdcaa3127cd6d3ebb82efe1cc7a958de88e898968
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for ikc-flash-sdk 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.