/** * AI Guard SDK middleware and provider wrappers. * * Provides: * - HTTP middleware interception with enforcement (send + SSE write/end) * - Streaming interception for SDK wrappers (AsyncIterable / ReadableStream) * - Multi-provider client wrappers with blocking support * - LangStream/Vercel AI SDK onChunk adapter */ import type { CapturedRequest, DynamicFinding, ModelMetadata } from "./types"; type AnyRecord = Record; /** * OpenAI wrapper (chat.completions.create). */ export declare function wrapOpenAIClient(client: T): T; /** * Anthropic wrapper (@anthropic-ai/sdk): messages.create, including stream=true responses. */ export declare function wrapAnthropicClient(client: T): T; /** * Google Gemini wrapper (@google/generative-ai): getGenerativeModel().generateContent and generateContentStream. */ export declare function wrapGeminiClient any; }>(client: T): T; /** * AWS Bedrock wrapper (@aws-sdk/client-bedrock-runtime): client.send(command). */ export declare function wrapBedrockClient Promise; }>(client: T): T; /** * Azure OpenAI wrapper (OpenAI SDK configured with Azure base URL). */ export declare function wrapAzureOpenAIClient(client: T): T; /** * Cohere wrapper (@cohere-ai/cohere-js): chat, chatStream, generate. */ export declare function wrapCohereClient(client: T): T; /** * Mistral wrapper (@mistralai/mistralai): chat.complete, chat.stream. */ export declare function wrapMistralClient(client: T): T; /** * Ollama wrapper (ollama npm package): chat, generate, embeddings. */ export declare function wrapOllamaClient(client: T): T; /** * Generic HTTP client wrapper for self-hosted / OpenAI-compatible endpoints * (vLLM, TGI, LocalAI, etc.). Wraps a fetch-like function that takes a URL * and request init and returns a Response-like object. */ export declare function wrapGenericOpenAICompatibleClient>(instance: T, options?: { provider?: string; baseURL?: string; }): T; /** * LangChain JS wrapper (langchain/llms compatible): invoke/call/stream. */ export declare function wrapLangChainLLM(llm: T): T; /** * LangStream / Vercel AI SDK compatible onChunk adapter. */ export declare function createOnChunkAdapter(options: { request: CapturedRequest; model: ModelMetadata; onChunk?: (chunk: unknown) => void | Promise; }): { onChunk: (chunk: unknown) => Promise; onComplete: () => Promise; }; /** * Middleware function for Express/Next.js-style request handling. * Includes SSE stream interception for res.write/res.end in addition to res.send. */ export declare function aiGuardMiddleware(): (req: any, res: any, next: () => void) => Promise; export {};