@xynehq/jaf
Version:
Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools
58 lines • 3.58 kB
TypeScript
/**
* JAF ADK Layer - Content System
*
* Functional content and message handling utilities
*/
import { Content, Part, FunctionCall, FunctionResponse } from '../types';
export declare const createContent: (role: "user" | "model" | "system", text: string, metadata?: Record<string, unknown>) => Content;
export declare const createUserMessage: (text: string, metadata?: Record<string, unknown>) => Content;
export declare const createModelMessage: (text: string, metadata?: Record<string, unknown>) => Content;
export declare const createSystemMessage: (text: string, metadata?: Record<string, unknown>) => Content;
export declare const createTextPart: (text: string, metadata?: Record<string, unknown>) => Part;
export declare const createImagePart: (data: ArrayBuffer | string, metadata?: Record<string, unknown>) => Part;
export declare const createAudioPart: (data: ArrayBuffer | string, metadata?: Record<string, unknown>) => Part;
export declare const createFunctionCallPart: (functionCall: FunctionCall, metadata?: Record<string, unknown>) => Part;
export declare const createFunctionResponsePart: (functionResponse: FunctionResponse, metadata?: Record<string, unknown>) => Part;
export declare const createFunctionCall: (id: string, name: string, args: Record<string, unknown>) => FunctionCall;
export declare const createFunctionResponse: (id: string, name: string, response: unknown, success?: boolean, error?: string) => FunctionResponse;
export declare const addPart: (content: Content, part: Part) => Content;
export declare const addTextPart: (content: Content, text: string) => Content;
export declare const addFunctionCall: (content: Content, functionCall: FunctionCall) => Content;
export declare const addFunctionResponse: (content: Content, functionResponse: FunctionResponse) => Content;
export declare const getTextContent: (content: Content) => string;
export declare const getFunctionCalls: (content: Content) => FunctionCall[];
export declare const getFunctionResponses: (content: Content) => FunctionResponse[];
export declare const hasTextContent: (content: Content) => boolean;
export declare const hasFunctionCalls: (content: Content) => boolean;
export declare const hasFunctionResponses: (content: Content) => boolean;
export declare const contentToString: (content: Content) => string;
export declare const parseContent: (raw: unknown) => Content;
export declare const isValidContent: (content: unknown) => content is Content;
export declare const isValidPart: (part: unknown) => part is Part;
export declare const mergeContent: (...contents: Content[]) => Content;
export declare const cloneContent: (content: Content) => Content;
export declare const filterContentByRole: (contents: Content[], role: Content["role"]) => Content[];
export declare const getLastUserMessage: (contents: Content[]) => Content | null;
export declare const getLastModelMessage: (contents: Content[]) => Content | null;
export declare const getContentStats: (content: Content) => {
totalParts: number;
textParts: number;
imageParts: number;
audioParts: number;
functionCallParts: number;
functionResponseParts: number;
textLength: number;
hasMedia: boolean;
hasFunctions: boolean;
};
export declare const getConversationStats: (contents: Content[]) => {
totalMessages: number;
userMessages: number;
modelMessages: number;
systemMessages: number;
totalTextLength: number;
totalFunctionCalls: number;
totalFunctionResponses: number;
averageMessageLength: number;
};
//# sourceMappingURL=index.d.ts.map