Skip to content

Commit 04f1f80

Browse files
dorukardahanclaude
andauthored
fix: docs corrections and dead code cleanup (#172)
1. README: Node.js requirement 22.0.0 → 20.0.0 (matches package.json engines field and CI matrix which tests both 20.x and 22.x) 2. getRequestHeaders JSDoc: fix wrong method call in @example - Was calling getServiceMetadata twice (second should be getRequestHeaders) - Remove non-existent serviceName parameter - Fix message role from "system" to "user" - Fix headers placement in OpenAI SDK call 3. response.ts: remove duplicate chatID null check (dead code) - Line 38 already returns null if !chatID - Second check at line 54 was unreachable - Replace console.warn with existing logger.warn (3 occurrences) 4. request.ts: remove commented-out import Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 87a1686 commit 04f1f80

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Access decentralized AI computing through the 0G Compute Network - a GPU marketp
1212

1313
## Requirements
1414

15-
- Node.js >= 22.0.0
15+
- Node.js >= 20.0.0
1616
- A wallet with 0G tokens
1717

1818
## Installation

src.ts/sdk/inference/broker/broker.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,12 @@ export class InferenceBroker extends ReadOnlyInferenceBroker {
304304
*
305305
* @example
306306
*
307-
* const { endpoint, model } = await broker.getServiceMetadata(
307+
* const { endpoint, model } = await broker.inference.getServiceMetadata(
308308
* providerAddress,
309-
* serviceName,
310309
* );
311310
*
312-
* const headers = await broker.getServiceMetadata(
311+
* const headers = await broker.inference.getRequestHeaders(
313312
* providerAddress,
314-
* serviceName,
315313
* content,
316314
* );
317315
*
@@ -322,12 +320,10 @@ export class InferenceBroker extends ReadOnlyInferenceBroker {
322320
*
323321
* const completion = await openai.chat.completions.create(
324322
* {
325-
* messages: [{ role: "system", content }],
323+
* messages: [{ role: "user", content }],
326324
* model,
327325
* },
328-
* headers: {
329-
* ...headers,
330-
* },
326+
* { headers: { ...headers } },
331327
* );
332328
*
333329
* @throws An error if errors occur during the processing of the request.

src.ts/sdk/inference/broker/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { InferenceServingContract } from '../contract'
44
import type { LedgerBroker } from '../../ledger'
55
import { Automata } from '../../common/automata'
66
import { throwFormattedError } from '../../common/utils'
7-
// import { Verifier } from './verifier'
7+
88

99
/**
1010
* ServingRequestHeaders contains headers related to request.

src.ts/sdk/inference/broker/response.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,17 @@ export class ResponseProcessor extends ZGServingUserBrokerBase {
4242

4343
const svc = await extractor.getSvcInfo()
4444
if (!isVerifiability(svc.verifiability)) {
45-
console.warn('this service is not verifiable')
45+
logger.warn('this service is not verifiable')
4646
return false
4747
}
4848

4949
if (!svc.teeSignerAcknowledged) {
50-
console.warn('TEE Signer is not acknowledged')
50+
logger.warn('TEE Signer is not acknowledged')
5151
return false
5252
}
5353

54-
if (!chatID) {
55-
throw new Error('Chat ID does not exist')
56-
}
57-
5854
if (!svc.additionalInfo) {
59-
console.warn('Service additionalInfo does not exist')
55+
logger.warn('Service additionalInfo does not exist')
6056
return false
6157
}
6258

0 commit comments

Comments
 (0)