@picahq/ai
Version:
Pica AI SDK for Vercel AI SDK integration
211 lines (210 loc) • 6.92 kB
TypeScript
import { AvailableActions, RequestConfig, ConnectionDefinition, Connection } from "./types/connection";
interface PicaOptions {
/**
* The descriptor for the Pica client options.
* @property connectors - Array of connector IDs to filter available actions
* @property actions - Array of action IDs to filter available actions (default: all actions)
* @property permissions - Permissions for the Pica client: "read" (GET only), "write" (POST/PUT/PATCH), "admin" (all methods) (default: "admin")
* @property serverUrl - Custom server URL for Pica API (defaults to https://api.picaos.com)
* @property identity - Identity value for AuthKit token generation
* @property identityType - Type of identity for AuthKit ("user", "team", "organization", or "project")
* @property authkit - Whether to enable AuthKit integration
* @property knowledgeAgent - Whether to enable Knowledge Agent mode
* @property knowledgeAgentConfig - Configuration options for Knowledge Agent
* @property headers - Additional headers to send with requests
*/
connectors?: string[];
actions?: string[];
permissions?: "read" | "write" | "admin";
serverUrl?: string;
identity?: string;
identityType?: "user" | "team" | "organization" | "project";
authkit?: boolean;
knowledgeAgent?: boolean;
knowledgeAgentConfig?: KnowledgeAgentConfig;
headers?: Record<string, string>;
}
interface KnowledgeAgentConfig {
includeEnvironmentVariables: boolean;
}
export declare class Pica {
private secret;
private connections;
private connectionDefinitions;
private systemPromptValue;
private initialized;
private identity?;
private identityType?;
private useAuthkit;
private useKnowledgeAgent;
private knowledgeAgentConfig?;
private options?;
private baseUrl;
private getConnectionUrl;
private availableActionsUrl;
private getConnectionDefinitionsUrl;
constructor(secret: string, options?: PicaOptions);
generateSystemPrompt(userSystemPrompt?: string): Promise<string>;
private initialize;
waitForInitialization(): Promise<string>;
private initializeConnections;
private initializeConnectionDefinitions;
get system(): string;
private generateHeaders;
private getAllAvailableActions;
getAvailablePicaConnectors(): Promise<ConnectionDefinition[]>;
getAvailableConnectors(platform?: string): Promise<Connection[]>;
private getSingleAction;
private getMethodFromKnowledge;
private getAvailableActions;
private executePassthrough;
private getPromptToConnectPlatformTool;
get intelligenceTool(): {
getAvailableActions: import("ai").Tool<{
platform: string;
}, {
success: boolean;
actions: {
_id: string;
title: string;
tags: string[];
}[];
platform: string;
content: string;
title?: undefined;
message?: undefined;
raw?: undefined;
} | {
success: boolean;
title: string;
message: any;
raw: string;
actions?: undefined;
platform?: undefined;
content?: undefined;
}>;
getActionKnowledge: import("ai").Tool<{
platform: string;
actionId: string;
}, {
success: boolean;
action: AvailableActions;
platform: string;
content: string;
title?: undefined;
message?: undefined;
raw?: undefined;
} | {
success: boolean;
title: string;
message: any;
raw: string;
action?: undefined;
platform?: undefined;
content?: undefined;
}>;
execute: import("ai").Tool<{
platform: string;
action: {
_id: string;
path: string;
};
method?: string;
connectionKey: string;
data?: any;
pathVariables?: Record<string, string | number | boolean>;
queryParams?: Record<string, any>;
headers?: Record<string, any>;
isFormData?: boolean;
isFormUrlEncoded?: boolean;
}, {
success: boolean;
title: string;
message: any;
raw: string;
}>;
};
get oneTool(): {
getAvailableActions: import("ai").Tool<{
platform: string;
}, {
success: boolean;
actions: {
_id: string;
title: string;
tags: string[];
}[];
platform: string;
content: string;
title?: undefined;
message?: undefined;
raw?: undefined;
} | {
success: boolean;
title: string;
message: any;
raw: string;
actions?: undefined;
platform?: undefined;
content?: undefined;
}>;
getActionKnowledge: import("ai").Tool<{
platform: string;
actionId: string;
}, {
success: boolean;
action: AvailableActions;
platform: string;
content: string;
title?: undefined;
message?: undefined;
raw?: undefined;
} | {
success: boolean;
title: string;
message: any;
raw: string;
action?: undefined;
platform?: undefined;
content?: undefined;
}>;
execute: import("ai").Tool<{
platform: string;
action: {
_id: string;
path: string;
};
method?: string;
connectionKey: string;
data?: any;
pathVariables?: Record<string, string | number | boolean>;
queryParams?: Record<string, any>;
headers?: Record<string, any>;
isFormData?: boolean;
isFormUrlEncoded?: boolean;
}, {
success: boolean;
data: unknown;
connectionKey: string;
platform: string;
action: string;
requestConfig: RequestConfig;
content: string;
title?: undefined;
message?: undefined;
raw?: undefined;
} | {
success: boolean;
title: string;
message: any;
raw: string;
data?: undefined;
connectionKey?: undefined;
platform?: undefined;
action?: undefined;
requestConfig?: undefined;
content?: undefined;
}>;
};
}
export {};