fix: client CompletionResponse matches actual gateway response fields
- Match field names: id, status, confidence, model, task_type, latency_ms, tokens, output - Default URL now https://llm-gateway.context-x.org (public endpoint) - ShieldX client uses 'shieldx' caller (not 'internal') - tokens.in/tokens.out instead of token_count.input/output
This commit is contained in:
parent
ac33476666
commit
b68d5c3fbf
@ -40,27 +40,27 @@ export interface CompletionRequest {
|
||||
}
|
||||
|
||||
export interface CompletionResponse {
|
||||
/** UUID for the request — use for tracing / support */
|
||||
request_id: string;
|
||||
/** Request ID for tracing */
|
||||
id: string;
|
||||
/** Overall status of the response */
|
||||
status: 'approved' | 'warning' | 'pending_review' | 'rejected';
|
||||
/** The LLM output, or null if rejected/failed */
|
||||
output: unknown | null;
|
||||
/** Model confidence score 0–1 */
|
||||
/** Model confidence score 0–10 */
|
||||
confidence: number;
|
||||
/** Ollama model that produced the output */
|
||||
model_used: string;
|
||||
/** Prompt template version used */
|
||||
prompt_version: string;
|
||||
/** Token usage */
|
||||
token_count: { input: number; output: number };
|
||||
model: string;
|
||||
/** Task type that was processed */
|
||||
task_type: string;
|
||||
/** End-to-end latency in milliseconds */
|
||||
latency_ms: number;
|
||||
/** Validation details (present when return_validation_details=true or status != 'approved') */
|
||||
/** Token usage */
|
||||
tokens: { in: number; out: number };
|
||||
/** The LLM output text */
|
||||
output: string;
|
||||
/** Validation details (present when return_validation_details=true) */
|
||||
validation?: {
|
||||
passed: boolean;
|
||||
ban_hits: unknown[];
|
||||
warnings: string[];
|
||||
score: number;
|
||||
validators: Record<string, unknown>;
|
||||
};
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ export class LLMGatewayClient {
|
||||
}) {
|
||||
this.baseUrl = config.baseUrl
|
||||
?? process.env['LLM_GATEWAY_URL']
|
||||
?? 'http://localhost:3100';
|
||||
?? 'https://llm-gateway.context-x.org';
|
||||
this.caller = config.caller;
|
||||
this.timeout = config.timeout ?? 30_000;
|
||||
}
|
||||
@ -240,10 +240,10 @@ export function createNOGnetClient(baseUrl?: string): LLMGatewayClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* ShieldX — LLM prompt injection defense (internal meta-use)
|
||||
* ShieldX — LLM prompt injection defense
|
||||
*/
|
||||
export function createShieldXClient(baseUrl?: string): LLMGatewayClient {
|
||||
return new LLMGatewayClient({ caller: 'internal', baseUrl, timeout: 10_000 });
|
||||
return new LLMGatewayClient({ caller: 'shieldx', baseUrl, timeout: 10_000 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user