UNPKG

llmasaservice-client

Version:

HOC and hook to use the LLMAsAService.io LLM load balancer and firewall

47 lines (43 loc) 1.58 kB
import React, { ReactNode } from 'react'; type LLMAsAServiceCustomer = { customer_id: string; customer_name?: string; customer_user_id?: string; customer_user_email?: string; }; interface LLMServiceType { project_id: string | undefined; customer?: LLMAsAServiceCustomer; url?: string | null; agent?: string | null; tools?: [] | null; } declare const LLMService: React.Context<LLMServiceType | undefined>; interface UserProviderProps { children: ReactNode; project_id: string | undefined; customer?: LLMAsAServiceCustomer; url?: string | null; agent?: string | null; tools?: [] | null; } declare const LLMServiceProvider: React.FC<UserProviderProps>; interface Message { role: string; content: string; } interface DataItem { key: string; data: string; } interface UseLLMReturnType { send: (prompt: string, messages?: Message[], data?: DataItem[], stream?: boolean, allowCaching?: boolean, service?: string | null, conversation?: string | null, abortController?: AbortController, onComplete?: (result: string) => void, onError?: (error: string) => void) => Promise<ReadableStreamDefaultReader<any> | string | undefined>; stop: (controller: AbortController | null) => void; response: string; idle: boolean; error: string; setResponse: (response: string) => void; lastCallId: string; } declare const useLLM: (options?: LLMServiceType) => UseLLMReturnType; export { type LLMAsAServiceCustomer, LLMService, LLMServiceProvider, type LLMServiceType, type UseLLMReturnType, useLLM };