/** * API request model for a filter comparison operation. */ type FilterOperation$1 = { eq?: number | number | string | null; gt?: number | number | string | null; gte?: number | number | string | null; lt?: number | number | string | null; lte?: number | number | string | null; includes?: Array; }; /** * Status types for agent data processing */ declare const StatusType: { readonly ERROR: "error"; readonly ACCEPTED: "accepted"; readonly REJECTED: "rejected"; readonly PENDING_REVIEW: "pending_review"; }; type StatusType = (typeof StatusType)[keyof typeof StatusType]; declare const ComparisonOperator: { readonly GT: "gt"; readonly GTE: "gte"; readonly LT: "lt"; readonly LTE: "lte"; readonly EQ: "eq"; readonly INCLUDES: "includes"; }; type ComparisonOperator = (typeof ComparisonOperator)[keyof typeof ComparisonOperator]; /** * Filter operation for searching/filtering agent data */ type FilterOperation = FilterOperation$1; /** * Metadata for an extracted field, including confidence and citation information */ interface ExtractedFieldMetadata { /** The confidence score for the field, combined with parsing confidence if applicable */ confidence?: number; /** The confidence score for the field based on the extracted text only */ extracted_confidence?: number; /** The page number that the field occurred on */ page_number?: number; /** The original text this field's value was derived from */ matching_text?: string; } /** * Dictionary mapping field names to their metadata * Values can be ExtractedFieldMetadata objects, nested dictionaries, or arrays */ type ExtractedFieldMetadataDict = Record | unknown[]>; /** * Base extracted data interface */ interface ExtractedData { /** The original data that was extracted from the document. For tracking changes. Should not be updated. */ original_data: T; /** The latest state of the data. Will differ if data has been updated. */ data: T; /** The status of the extracted data. Prefer to use the StatusType values, but any string is allowed. */ status: StatusType | string; /** The overall confidence score for the extracted data. */ overall_confidence?: number; /** Page links, and perhaps eventually bounding boxes, for individual fields in the extracted data. */ field_metadata?: ExtractedFieldMetadataDict; /** The ID of the file that was used to extract the data. */ file_id?: string; /** The name of the file that was used to extract the data. */ file_name?: string; /** The hash of the file that was used to extract the data. */ file_hash?: string; /** Additional metadata about the extracted data, such as errors, tokens, etc. */ metadata?: Record; } /** * TypedAgentData interface for typed agent data */ interface TypedAgentData { /** The unique ID of the agent data record. */ id: string; /** The ID of the agent that created the data. */ agentUrlId: string; /** The collection of the agent data. */ collection?: string; /** The data of the agent data. Usually an ExtractedData<SomeOtherType> */ data: T; /** The date and time the data was created. */ createdAt: Date; /** The date and time the data was last updated. */ updatedAt: Date; } /** * Paginated response of typed agent data items */ interface TypedAgentDataItems { items: TypedAgentData[]; totalSize?: number; nextPageToken?: string; } /** * Options for listing agent data */ interface SearchAgentDataOptions { /** Filter options for the list. */ filter?: Record; /** Order by options for the list. */ orderBy?: string; /** Page size for the list. */ pageSize?: number; /** Offset for the list. */ offset?: number; /** * Whether to include the total number of items in the response. * Should use only for first request to build total pagination, and not subsequent requests. */ includeTotal?: boolean; } /** * Options for aggregating agent data */ interface AggregateAgentDataOptions { /** Filter options for the aggregation. */ filter?: Record; /** Fields to group by. */ groupBy?: string[]; /** Whether to count the number of items in each group. */ count?: boolean; /** Whether to return the first item in each group. */ first?: boolean; /** Order by options for the aggregation. */ orderBy?: string; /** Offset for the aggregation. */ offset?: number; /** Page size for the aggregation. */ pageSize?: number; } /** * Single aggregation group result */ interface TypedAggregateGroup { /** The group key values */ groupKey: Record; /** Count of items in the group */ count?: number; /** First item in the group */ firstItem?: T; } /** * Paginated response of aggregated agent data */ interface TypedAggregateGroupItems { items: TypedAggregateGroup[]; totalSize?: number; nextPageToken?: string; } /** * Async client for agent data operations */ declare class AgentClient { private client; private baseUrl; private headers; private collection; private agentUrlId; constructor({ apiKey, baseUrl, collection, agentUrlId, }: { apiKey?: string; baseUrl?: string; collection?: string; agentUrlId?: string; }); /** * Create new agent data */ createItem(data: T): Promise>; /** * Get agent data by ID */ getItem(id: string): Promise | null>; /** * Update agent data */ updateItem(id: string, data: T): Promise>; /** * Delete agent data */ deleteItem(id: string): Promise; /** * Search agent data */ search(options: SearchAgentDataOptions): Promise>; /** * Aggregate agent data into groups */ aggregate(options: AggregateAgentDataOptions): Promise>; /** * Transform API response to typed data */ private transformResponse; /** * Transform API aggregate response to typed data */ private transformAggregateResponse; } /** * Create a new AsyncAgentDataClient instance. Does it's best to infer an agent url id from environment. * Pass in the window url and/or env to infer the agent url id from them. * @param options - The options for the client * @returns A new AgentClient instance */ declare function createAgentDataClient({ apiKey, baseUrl, windowUrl, env, agentUrlId, collection, }?: { apiKey?: string; baseUrl?: string; windowUrl?: string; env?: Record; agentUrlId?: string; collection?: string; }): AgentClient; export { AgentClient, ComparisonOperator, StatusType, StatusType as StatusTypeEnum, createAgentDataClient }; export type { AggregateAgentDataOptions, ExtractedData, FilterOperation, SearchAgentDataOptions, TypedAgentData, TypedAgentDataItems, TypedAggregateGroup, TypedAggregateGroupItems };