neura-sdk
Version:
TypeScript SDK for interacting with the Neura AI API
48 lines (47 loc) • 1.35 kB
TypeScript
import { CompletionsRequestOptions, NeuraResponse, NeuraSDKConfig, NeuraStream } from '../types';
export declare class NeuraSDK {
private baseUrl;
private apiKey;
private maxRetries;
private retryDelay;
private cache;
private throttle;
constructor(config: NeuraSDKConfig);
/**
* Create a chat completion
* @param options Request options
* @returns Promise with the completion response
*/
createCompletion(options: CompletionsRequestOptions): Promise<NeuraResponse>;
/**
* Create a streaming chat completion
* @param options Request options
* @returns EventEmitter that emits chunks, done, and error events
*/
createCompletionStream(options: CompletionsRequestOptions): NeuraStream;
/**
* Clear the cache
*/
clearCache(): void;
/**
* Make a request to the API
* @param options Request options
* @returns Promise with the response
* @private
*/
private makeRequest;
/**
* Process a streaming response
* @param options Request options
* @param emitter EventEmitter to emit events
* @private
*/
private processStream;
/**
* Generate a cache key for the request
* @param options Request options
* @returns Cache key
* @private
*/
private getCacheKey;
}