UNPKG

recallrai

Version:

Official Node.js SDK for RecallrAI - Revolutionary contextual memory system that enables AI assistants to form meaningful connections between conversations, just like human memory.

69 lines (68 loc) 2.21 kB
/** * HTTP client for making requests to the RecallrAI API. */ import { AxiosResponse } from "axios"; import { RecallStrategy } from "../models"; /** * HTTP client for making requests to the RecallrAI API. */ export declare class HTTPClient { private client; private apiKey; private projectId; private baseUrl; private timeout; private _systemPromptCacheByStrategy; private _systemPromptCacheExpiresAt; /** * Initialize the HTTP client. * * @param apiKey - Your RecallrAI API key. * @param projectId - Your project ID. * @param baseUrl - The base URL for the RecallrAI API. * @param timeout - Request timeout in seconds. */ constructor(apiKey: string, projectId: string, baseUrl: string, timeout?: number); /** * Filter out null and undefined values from params. */ private filterParams; /** * Filter out null and undefined values from data. */ private filterData; /** * Make a request to the RecallrAI API. * * @param method - HTTP method (GET, POST, PUT, DELETE). * @param path - API endpoint path. * @param params - Query parameters. * @param data - Request body data. * @returns The parsed JSON response. */ request(method: string, path: string, params?: Record<string, any>, data?: Record<string, any>): Promise<AxiosResponse>; /** * Make a GET request. */ get(path: string, params?: Record<string, any>): Promise<AxiosResponse>; /** * Make a POST request. */ post(path: string, data?: Record<string, any>): Promise<AxiosResponse>; /** * Make a PUT request. */ put(path: string, data?: Record<string, any>): Promise<AxiosResponse>; /** * Make a DELETE request. */ delete(path: string, params?: Record<string, any>): Promise<AxiosResponse>; /** * Stream Server-Sent Events (SSE) from the API. */ streamLines(path: string, params?: Record<string, any>): AsyncGenerator<string>; /** * Fetch the strategy-specific system prompt, caching it per strategy for one hour. */ getCachedSystemPrompt(recallStrategy?: RecallStrategy): Promise<string>; }