@halfwaylab/hwp-client
v0.1.0
Published
HWP (Hypothesis Working Protocol) Client SDK for JavaScript/TypeScript
Maintainers
Readme
@halfwaylab/hwp-client
HWP (Hypothesis Working Protocol) TypeScript/JavaScript SDK
安装
npm install @halfwaylab/hwp-client使用
import { HWPClient } from '@halfwaylab/hwp-client';
const client = new HWPClient({
baseUrl: 'https://hwp.halfwaylab.cn',
apiKey: 'your-api-key'
});
// 方式1: 提交运行
const run = await client.createRun({
input_text: 'What is consciousness?'
});
console.log('Session ID:', run.session_id);
// 方式2: 提交并等待完成
const result = await client.runAndWait(
{ input_text: 'What is the nature of time?' },
(status) => console.log(`Progress: ${status.current_round}/${status.total_rounds}`)
);
console.log('Result:', result);API
HWPClient
| 方法 | 说明 |
|------|------|
| createRun() | 创建链运行任务 |
| getRunStatus() | 查询运行状态 |
| getRunResult() | 获取运行结果 |
| cancelRun() | 取消运行 |
| health() | 健康检查 |
| listProviders() | 获取可用 Provider |
| pauseSummary() | 暂停总结 |
| runAndWait() | 提交并等待完成 |
License
MIT
