UNPKG

graphlit-client

Version:
994 lines 172 kB
import { ApolloClient } from "@apollo/client/core/index.js"; import type { NormalizedCacheObject } from "@apollo/client/core/index.js"; import * as Types from "./generated/graphql-types.js"; import { AgentOptions, AgentResult, StreamAgentOptions, ToolHandler, RunAgentOptions, RunAgentResult } from "./types/agent.js"; import { AgentStreamEvent } from "./types/ui-events.js"; type ConversationFlowEntityReference = { id: string; name?: string | null; }; export type GetConversationFlowQueryVariables = { id: string; correlationId?: string | null; }; export type GetConversationFlowQuery = { conversation?: { id: string; name: string; creationDate: string; modifiedDate?: string | null; state: string; correlationId?: string | null; type?: string | null; transcriptUri?: string | null; messageCount?: number | null; turnCount?: number | null; agent?: ConversationFlowEntityReference | null; persona?: ConversationFlowEntityReference | null; specification?: ConversationFlowEntityReference | null; parent?: ConversationFlowEntityReference | null; children?: Array<ConversationFlowEntityReference | null> | null; turns?: Array<{ index?: number | null; tokens?: number | null; timestamp?: string | null; text?: string | null; relevance?: number | null; summary?: string | null; messages?: Array<{ role: string; author?: string | null; message?: string | null; tokens?: number | null; throughput?: number | null; ttft?: string | null; completionTime?: string | null; timestamp?: string | null; modelService?: string | null; model?: string | null; data?: string | null; mimeType?: string | null; toolCallId?: string | null; toolCallResponse?: string | null; thinkingContent?: string | null; thinkingSignature?: string | null; toolCalls?: Array<{ id: string; name: string; arguments: string; startedAt?: string | null; completedAt?: string | null; durationMs?: number | null; status?: string | null; failedAt?: string | null; firstStatusAt?: string | null; } | null> | null; } | null> | null; } | null> | null; } | null; }; export type { AgentOptions, AgentResult, ArtifactCollector, ContextStrategy, ContextManagementAction, StreamAgentOptions, ToolCallResult, UsageInfo, AgentError, RunAgentOptions, RunAgentResult, TurnResult, BudgetSnapshot, HarnessStatus, QualityAssessment, } from "./types/agent.js"; export { TokenBudgetTracker, truncateToolResult, estimateTokens, isAccurateTokenCounting, } from "./helpers/context-management.js"; export type { AgentStreamEvent, ReasoningFormat, ReasoningMetadata, } from "./types/ui-events.js"; export interface RetryConfig { /** Maximum number of retry attempts (default: 5) */ maxAttempts?: number; /** Initial delay in milliseconds (default: 300) */ initialDelay?: number; /** Maximum delay in milliseconds (default: 30000) */ maxDelay?: number; /** HTTP status codes that should trigger a retry (default: [429, 502, 503, 504]) */ retryableStatusCodes?: number[]; /** Whether to use jitter in delay calculation (default: true) */ jitter?: boolean; /** Callback when a retry is attempted */ onRetry?: (attempt: number, error: any, operation: any) => void; } export interface GraphlitClientOptions { organizationId?: string; environmentId?: string; jwtSecret?: string; ownerId?: string; userId?: string; apiUri?: string; /** Pre-signed JWT token. When provided, jwtSecret is not required. */ token?: string; /** Retry configuration for network errors */ retryConfig?: RetryConfig; } declare class Graphlit { client: ApolloClient<NormalizedCacheObject> | undefined; token: string | undefined; private apiUri; private organizationId; private environmentId; private ownerId; private userId; private jwtSecret; private retryConfig; private openaiClient?; private anthropicClient?; private googleClient?; private groqClient?; private cerebrasClient?; private cohereClient?; private mistralClient?; private bedrockClient?; private deepseekClient?; private xaiClient?; private readonly conversationQueues; private readonly googlePromptCache; constructor(organizationIdOrOptions?: string | GraphlitClientOptions, environmentId?: string, jwtSecret?: string, ownerId?: string, userId?: string, apiUri?: string); /** * Initialize the Apollo client without regenerating the token. * Used when a pre-signed token is provided. */ private initializeClient; refreshClient(): void; private setupApolloClient; /** * Set a custom OpenAI client instance for streaming * @param client - OpenAI client instance (e.g., new OpenAI({ apiKey: "..." })) */ setOpenAIClient(client: any): void; /** * Set a custom Anthropic client instance for streaming * @param client - Anthropic client instance (e.g., new Anthropic({ apiKey: "..." })) */ setAnthropicClient(client: any): void; /** * Set a custom Google Generative AI client instance for streaming * @param client - Google GenAI client instance (e.g., new GoogleGenAI({apiKey})) */ setGoogleClient(client: any): void; /** * Set a custom Groq client instance for streaming * @param client - Groq client instance (e.g., new Groq({ apiKey: "..." })) */ setGroqClient(client: any): void; /** * Set a custom Cerebras client instance for streaming * @param client - Cerebras client instance (e.g., new Cerebras({ apiKey: "..." })) */ setCerebrasClient(client: any): void; /** * Set a custom Cohere client instance for streaming * @param client - Cohere client instance (e.g., new CohereClient({ token: "..." })) */ setCohereClient(client: any): void; /** * Set a custom Mistral client instance for streaming * @param client - Mistral client instance (e.g., new Mistral({ apiKey: "..." })) */ setMistralClient(client: any): void; /** * Set a custom Bedrock client instance for streaming * @param client - BedrockRuntimeClient instance (e.g., new BedrockRuntimeClient({ region: "us-east-2" })) */ setBedrockClient(client: any): void; /** * Set a custom Deepseek client instance for streaming * @param client - OpenAI client instance configured for Deepseek (e.g., new OpenAI({ baseURL: "https://api.deepseek.com", apiKey: "..." })) */ setDeepseekClient(client: any): void; /** * Set a custom xAI client instance for streaming * @param client - OpenAI client instance configured for xAI (e.g., new OpenAI({ baseURL: "https://api.x.ai/v1", apiKey: "..." })) */ setXaiClient(client: any): void; /** * Update retry configuration and refresh the Apollo client * @param retryConfig - New retry configuration */ setRetryConfig(retryConfig: RetryConfig): void; private generateToken; /** * Fetch current project. * @returns The project. */ getProject(): Promise<Types.GetProjectQuery>; /** * Updates a project. * @param project - The project to update. * @returns The updated project. */ updateProject(project: Types.ProjectUpdateInput): Promise<Types.UpdateProjectMutation>; /** * Lookup usage records given tenant correlation identifier. * @param correlationId - The tenant correlation identifier. * @param startDate - The start date of records to be returned, optional. Defaults to last 30 days. * @param duration - The duration of records to be returned, optional. Defaults to last 30 days. * @returns The project usage records. */ lookupProjectUsage(correlationId: string, startDate?: Types.Scalars["DateTime"]["input"], duration?: Types.Scalars["TimeSpan"]["input"]): Promise<Types.LookupUsageQuery>; /** * Lookup credit usage given tenant correlation identifier. * @param correlationId - The tenant correlation identifier. * @param startDate - The start date of records to be returned, optional. Defaults to last 30 days. * @param duration - The duration of records to be returned, optional. Defaults to last 30 days. * @returns The project credits. */ lookupProjectCredits(correlationId: string, startDate?: Types.Scalars["DateTime"]["input"], duration?: Types.Scalars["TimeSpan"]["input"]): Promise<Types.LookupCreditsQuery>; /** * Retrieves project tokens. * @param startDate - The start date of tokens to be returned. * @param duration - The duration of tokens to be returned. * @returns The project tokens. */ queryProjectTokens(startDate: Types.Scalars["DateTime"]["input"], duration: Types.Scalars["TimeSpan"]["input"]): Promise<Types.QueryTokensQuery>; /** * Retrieves project usage. * @param startDate - The start date of records to be returned. * @param duration - The duration of records to be returned. * @param names - Filter by allowed usage record names, defaults to 'GraphQL'. * @param excludedNames - Filter by excluded usage record names. * @param offset - The offset to the records to be returned, defaults to 0. * @param limit - The number of records to be returned, defaults to 1000. * @returns The project usage records. */ queryProjectUsage(startDate: Types.Scalars["DateTime"]["input"], duration: Types.Scalars["TimeSpan"]["input"], names?: string[], excludedNames?: string[], offset?: Types.Scalars["Int"]["input"], limit?: Types.Scalars["Int"]["input"]): Promise<Types.QueryUsageQuery>; /** * Retrieves project credits. * @param startDate - The start date of credits to be returned. * @param duration - The duration of credits to be returned. * @returns The project credits. */ queryProjectCredits(startDate: Types.Scalars["DateTime"]["input"], duration: Types.Scalars["TimeSpan"]["input"]): Promise<Types.QueryCreditsQuery>; /** * Sends a notification. * @param connector - The integration connector used to send the notification. * @param text - The notification text. * @param textType - The text type, optional. * @returns The result of the notification. */ sendNotification(connector: Types.IntegrationConnectorInput, text: string, textType?: Types.TextTypes): Promise<Types.SendNotificationMutation>; /** * Enumerates the web pages at or beneath the provided URL using web sitemap. * @param uri - The URI of the web page to be mapped. * @param allowedPaths - The list of regular expressions for URL paths to be crawled, i.e. "^\/public\/blogs\/.*". * @param excludedPaths - The list of regular expressions for URL paths to not be crawled, i.e. "^\/internal\/private\/.*". * @param correlationId - The tenant correlation identifier, optional. * @returns The mapped URIs. */ mapWeb(uri: string, allowedPaths?: string[], excludedPaths?: string[], correlationId?: string): Promise<Types.MapWebQuery>; /** * Searches the web based on the provided properties. * @param text - The web search text. * @param service - The web search service type, defaults to Tavily. * @param limit - The number of web search results to be returned, defaults to 10. * @param correlationId - The tenant correlation identifier, optional. * @returns The web search results. */ searchWeb(text: string, service?: Types.SearchServiceTypes, limit?: number, correlationId?: string): Promise<Types.SearchWebQuery>; /** * Creates an alert. * @param alert - The alert to create. * @param correlationId - The tenant correlation identifier, optional. * @returns The created alert. */ createAlert(alert: Types.AlertInput, correlationId?: string): Promise<Types.CreateAlertMutation>; /** * Updates an alert. * @param alert - The alert to update. * @returns The updated alert. */ updateAlert(alert: Types.AlertUpdateInput): Promise<Types.UpdateAlertMutation>; /** * Creates or updates an alert. * @param alert - The alert to create or update. * @returns The created or updated alert. */ upsertAlert(alert: Types.AlertInput): Promise<Types.UpsertAlertMutation>; /** * Deletes an alert. * @param id - The ID of the alert to delete. * @returns The deleted alert. */ deleteAlert(id: string): Promise<Types.DeleteAlertMutation>; /** * Deletes multiple alerts. * @param ids - The IDs of the alerts to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted alerts. */ deleteAlerts(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteAlertsMutation>; /** * Deletes all alerts based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting alerts. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllAlerts(filter?: Types.AlertFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllAlertsMutation>; /** * Enables an alert. * @param id - The ID of the alert to enable. * @returns The enabled alert. */ enableAlert(id: string): Promise<Types.EnableAlertMutation>; /** * Disables an alert. * @param id - The ID of the alert to disable. * @returns The disabled alert. */ disableAlert(id: string): Promise<Types.DisableAlertMutation>; /** * Lookup an alert given its ID. * @param id - ID of the alert. * @param correlationId - The tenant correlation identifier, optional. * @returns The alert. */ getAlert(id: string, correlationId?: string): Promise<Types.GetAlertQuery>; /** * Retrieves alerts based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving alerts. * @param correlationId - The tenant correlation identifier, optional. * @returns The alerts. */ queryAlerts(filter?: Types.AlertFilter, correlationId?: string): Promise<Types.QueryAlertsQuery>; /** * Counts alerts based on the provided filter criteria. * @param filter - The filter criteria to apply when counting alerts. * @param correlationId - The tenant correlation identifier, optional. * @returns The count of alerts. */ countAlerts(filter?: Types.AlertFilter, correlationId?: string): Promise<Types.CountAlertsQuery>; /** * Creates an agent. * @param agent - The agent to create. * @param correlationId - The tenant correlation identifier, optional. * @returns The created agent. */ createAgent(agent: Types.AgentInput, correlationId?: string): Promise<Types.CreateAgentMutation>; /** * Updates an agent. * @param agent - The agent to update. * @returns The updated agent. */ updateAgent(agent: Types.AgentUpdateInput): Promise<Types.UpdateAgentMutation>; /** * Creates or updates an agent. * @param agent - The agent to create or update. * @returns The created or updated agent. */ upsertAgent(agent: Types.AgentInput): Promise<Types.UpsertAgentMutation>; /** * Deletes an agent. * @param id - The ID of the agent to delete. * @returns The deleted agent. */ deleteAgent(id: string): Promise<Types.DeleteAgentMutation>; /** * Deletes multiple agents. * @param ids - The IDs of the agents to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted agents. */ deleteAgents(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteAgentsMutation>; /** * Deletes all agents based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting agents. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllAgents(filter?: Types.AgentFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllAgentsMutation>; /** * Enables an agent. * @param id - The ID of the agent to enable. * @returns The enabled agent. */ enableAgent(id: string): Promise<Types.EnableAgentMutation>; /** * Disables an agent. * @param id - The ID of the agent to disable. * @returns The disabled agent. */ disableAgent(id: string): Promise<Types.DisableAgentMutation>; /** * Updates the focus of an agent. * @param id - The ID of the agent. * @param focus - The focus text to set, or undefined to clear. * @returns The updated agent. */ updateAgentFocus(id: string, focus?: string): Promise<Types.UpdateAgentFocusMutation>; /** * Updates the scratchpad of an agent. * @param id - The ID of the agent. * @param scratchpad - The scratchpad text to set. * @returns The updated agent. */ updateAgentScratchpad(id: string, scratchpad: string): Promise<Types.UpdateAgentScratchpadMutation>; /** * Lookup an agent given its ID. * @param id - ID of the agent. * @param correlationId - The tenant correlation identifier, optional. * @returns The agent. */ getAgent(id: string, correlationId?: string): Promise<Types.GetAgentQuery>; /** * Retrieves agents based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving agents. * @param correlationId - The tenant correlation identifier, optional. * @returns The agents. */ queryAgents(filter?: Types.AgentFilter, correlationId?: string): Promise<Types.QueryAgentsQuery>; /** * Counts agents based on the provided filter criteria. * @param filter - The filter criteria to apply when counting agents. * @param correlationId - The tenant correlation identifier, optional. * @returns The count of agents. */ countAgents(filter?: Types.AgentFilter, correlationId?: string): Promise<Types.CountAgentsQuery>; /** * Creates a bureau. * @param bureau - The bureau to create. * @returns The created bureau. */ createBureau(bureau: Types.BureauInput): Promise<Types.CreateBureauMutation>; /** * Updates a bureau. * @param bureau - The bureau to update. * @returns The updated bureau. */ updateBureau(bureau: Types.BureauUpdateInput): Promise<Types.UpdateBureauMutation>; /** * Deletes a bureau. * @param id - The ID of the bureau to delete. * @returns The deleted bureau. */ deleteBureau(id: string): Promise<Types.DeleteBureauMutation>; /** * Deletes multiple bureaus. * @param ids - The IDs of the bureaus to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted bureaus. */ deleteBureaus(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteBureausMutation>; /** * Deletes all bureaus based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting bureaus. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllBureaus(filter?: Types.BureauFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllBureausMutation>; /** * Adds desks to a bureau. * @param desks - The desks to add. * @param bureau - The bureau to add the desks to. * @returns The updated bureau. */ addDesksToBureau(desks: Types.EntityReferenceInput[], bureau: Types.EntityReferenceInput): Promise<Types.AddDesksToBureauMutation>; /** * Removes desks from a bureau. * @param desks - The desks to remove. * @param bureau - The bureau to remove the desks from. * @returns The updated bureau. */ removeDesksFromBureau(desks: Types.EntityReferenceInput[], bureau: Types.EntityReferenceInput): Promise<Types.RemoveDesksFromBureauMutation>; /** * Lookup a bureau given its ID. * @param id - ID of the bureau. * @param correlationId - The tenant correlation identifier, optional. * @returns The bureau. */ getBureau(id: string, correlationId?: string): Promise<Types.GetBureauQuery>; /** * Retrieves bureaus based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving bureaus. * @param correlationId - The tenant correlation identifier, optional. * @returns The bureaus. */ queryBureaus(filter?: Types.BureauFilter, correlationId?: string): Promise<Types.QueryBureausQuery>; /** * Counts bureaus based on the provided filter criteria. * @param filter - The filter criteria to apply when counting bureaus. * @param correlationId - The tenant correlation identifier, optional. * @returns The count of bureaus. */ countBureaus(filter?: Types.BureauFilter, correlationId?: string): Promise<Types.CountBureausQuery>; /** * Creates a desk. * @param desk - The desk to create. * @returns The created desk. */ createDesk(desk: Types.DeskInput): Promise<Types.CreateDeskMutation>; /** * Updates a desk. * @param desk - The desk to update. * @returns The updated desk. */ updateDesk(desk: Types.DeskUpdateInput): Promise<Types.UpdateDeskMutation>; /** * Deletes a desk. * @param id - The ID of the desk to delete. * @returns The deleted desk. */ deleteDesk(id: string): Promise<Types.DeleteDeskMutation>; /** * Deletes multiple desks. * @param ids - The IDs of the desks to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted desks. */ deleteDesks(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteDesksMutation>; /** * Deletes all desks based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting desks. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllDesks(filter?: Types.DeskFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllDesksMutation>; /** * Adds agents to a desk. * @param agents - The agents to add. * @param desk - The desk to add the agents to. * @returns The updated desk. */ addAgentsToDesk(agents: Types.EntityReferenceInput[], desk: Types.EntityReferenceInput): Promise<Types.AddAgentsToDeskMutation>; /** * Removes agents from a desk. * @param agents - The agents to remove. * @param desk - The desk to remove the agents from. * @returns The updated desk. */ removeAgentsFromDesk(agents: Types.EntityReferenceInput[], desk: Types.EntityReferenceInput): Promise<Types.RemoveAgentsFromDeskMutation>; /** * Lookup a desk given its ID. * @param id - ID of the desk. * @param correlationId - The tenant correlation identifier, optional. * @returns The desk. */ getDesk(id: string, correlationId?: string): Promise<Types.GetDeskQuery>; /** * Retrieves desks based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving desks. * @param correlationId - The tenant correlation identifier, optional. * @returns The desks. */ queryDesks(filter?: Types.DeskFilter, correlationId?: string): Promise<Types.QueryDesksQuery>; /** * Counts desks based on the provided filter criteria. * @param filter - The filter criteria to apply when counting desks. * @param correlationId - The tenant correlation identifier, optional. * @returns The count of desks. */ countDesks(filter?: Types.DeskFilter, correlationId?: string): Promise<Types.CountDesksQuery>; /** * Creates a fact. * @param fact - The fact to create. * @returns The created fact. */ createFact(fact: Types.FactInput): Promise<Types.CreateFactMutation>; /** * Updates a fact. * @param fact - The fact to update. * @returns The updated fact. */ updateFact(fact: Types.FactUpdateInput): Promise<Types.UpdateFactMutation>; /** * Deletes a fact. * @param id - The ID of the fact to delete. * @returns The deleted fact. */ deleteFact(id: string): Promise<Types.DeleteFactMutation>; /** * Deletes multiple facts. * @param ids - The IDs of the facts to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted facts. */ deleteFacts(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteFactsMutation>; /** * Deletes all facts based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting facts. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllFacts(filter?: Types.FactFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllFactsMutation>; /** * Lookup a fact given its ID. * @param id - ID of the fact. * @param correlationId - The tenant correlation identifier, optional. * @returns The fact. */ getFact(id: string, correlationId?: string): Promise<Types.GetFactQuery>; /** * Retrieves facts based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving facts. * @param correlationId - The tenant correlation identifier, optional. * @returns The facts. */ queryFacts(filter?: Types.FactFilter, correlationId?: string): Promise<Types.QueryFactsQuery>; /** * Retrieves facts as a knowledge graph. * @param filter - The filter criteria to apply when retrieving facts, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The facts graph with nodes and edges. */ queryFactsGraph(filter?: Types.FactFilter, correlationId?: string): Promise<Types.QueryFactsGraphQuery>; /** * Retrieves facts with clustering. * @param filter - The filter criteria to apply when retrieving facts, optional. * @param clusters - The clustering input parameters, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The facts with clusters. */ queryFactsClusters(filter?: Types.FactFilter, clusters?: Types.EntityClustersInput, correlationId?: string): Promise<Types.QueryFactsClustersQuery>; /** * Counts facts based on the provided filter criteria. * @param filter - The filter criteria to apply when counting facts. * @param correlationId - The tenant correlation identifier, optional. * @returns The count of facts. */ countFacts(filter?: Types.FactFilter, correlationId?: string): Promise<Types.CountFactsQuery>; /** * Creates a collection. * @param collection - The collection to create. * @returns The created collection. */ createCollection(collection: Types.CollectionInput): Promise<Types.CreateCollectionMutation>; /** * Updates a collection. * @param collection - The collection to update. * @returns The updated collection. */ updateCollection(collection: Types.CollectionUpdateInput): Promise<Types.UpdateCollectionMutation>; /** * Deletes a collection. * @param id - The ID of the collection to delete. * @returns The deleted collection. */ deleteCollection(id: string): Promise<Types.DeleteCollectionMutation>; /** * Deletes multiple collections. * @param ids - The IDs of the collections to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted collections. */ deleteCollections(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteCollectionsMutation>; /** * Deletes all collections based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting collections. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllCollections(filter?: Types.CollectionFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllCollectionsMutation>; /** * Adds contents to collections. * @param contents - The contents to add. * @param collections - The collections to add the contents to. * @returns The result of the operation. */ addContentsToCollections(contents: Types.EntityReferenceInput[], collections: Types.EntityReferenceInput[]): Promise<Types.AddContentsToCollectionsMutation>; /** * Removes contents from a collection. * @param contents - The contents to remove. * @param collection - The collection to remove the contents from. * @returns The result of the operation. */ removeContentsFromCollection(contents: Types.EntityReferenceInput[], collection: Types.EntityReferenceInput): Promise<Types.RemoveContentsFromCollectionMutation>; /** * Adds conversations to collections. * @param conversations - The conversations to add. * @param collections - The collections to add the conversations to. * @returns The result of the operation. */ addConversationsToCollections(conversations: Types.EntityReferenceInput[], collections: Types.EntityReferenceInput[]): Promise<Types.AddConversationsToCollectionsMutation>; /** * Removes conversations from a collection. * @param conversations - The conversations to remove. * @param collection - The collection to remove the conversations from. * @returns The result of the operation. */ removeConversationsFromCollection(conversations: Types.EntityReferenceInput[], collection: Types.EntityReferenceInput): Promise<Types.RemoveConversationsFromCollectionMutation>; /** * Lookup a collection given its ID. * @param id - ID of the collection. * @returns The collection. */ getCollection(id: string): Promise<Types.GetCollectionQuery>; /** * Retrieves collections based on the provided filter criteria. * @param filter - The filter criteria to apply when retrieving collections. * @returns The collections. */ queryCollections(filter?: Types.CollectionFilter): Promise<Types.QueryCollectionsQuery>; /** * Counts collections based on the provided filter criteria. * @param filter - The filter criteria to apply when counting collections. * @returns The count of collections. */ countCollections(filter?: Types.CollectionFilter): Promise<Types.CountCollectionsQuery>; /** * Describes an image using a multimodal LLM. * @param prompt - The prompt to use for describing the image. * @param uri - The URI of the image to describe. * @param specification - The LLM specification to use, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The image description. */ describeImage(prompt: string, uri: string, specification?: Types.EntityReferenceInput, correlationId?: string): Promise<Types.DescribeImageMutation>; /** * Describes a base64-encoded image using a multimodal LLM. * @param prompt - The prompt to use for describing the image. * @param mimeType - The MIME type of the image. * @param data - The base64-encoded image data. * @param specification - The LLM specification to use, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The image description. */ describeEncodedImage(prompt: string, mimeType: string, data: string, specification?: Types.EntityReferenceInput, correlationId?: string): Promise<Types.DescribeEncodedImageMutation>; /** * Takes a screenshot of a web page. * @param uri - The URI of the web page to screenshot. * @param maximumHeight - The maximum height of the screenshot, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param workflow - The workflow to use for processing, optional. * @param collections - The collections to add the content to, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The screenshot content. */ screenshotPage(uri: string, maximumHeight?: number, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput, collections?: Types.EntityReferenceInput[], correlationId?: string): Promise<Types.ScreenshotPageMutation>; /** * Ingests a batch of text contents. * @param batch - The batch of text contents to ingest. * @param textType - The type of text (plain, markdown, HTML). * @param collections - The collections to add the contents to, optional. * @param observations - The observations to assign to the contents, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The ingested contents. */ ingestTextBatch(batch: Types.TextContentInput[], textType: Types.TextTypes, collections?: Types.EntityReferenceInput[], observations?: Types.ObservationReferenceInput[], correlationId?: string): Promise<Types.IngestTextBatchMutation>; /** * Ingests a batch of URIs. * @param uris - The URIs to ingest. * @param workflow - The workflow to use for processing, optional. * @param collections - The collections to add the contents to, optional. * @param observations - The observations to assign to the contents, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The ingested contents. */ ingestBatch(uris: string[], workflow?: Types.EntityReferenceInput, collections?: Types.EntityReferenceInput[], observations?: Types.ObservationReferenceInput[], correlationId?: string): Promise<Types.IngestBatchMutation>; /** * Ingests content from a URI. * @param uri - The URI of the content to ingest. * @param name - The name of the content, optional. * @param id - The ID to assign to the content, optional. * @param identifier - The external identifier for the content, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param workflow - The workflow to use for processing, optional. * @param collections - The collections to add the content to, optional. * @param observations - The observations to assign to the content, optional. * @param correlationId - The tenant correlation identifier, optional. * @param agent - The agent to use for processing, optional. * @returns The ingested content. */ ingestUri(uri: string, name?: string, id?: string, identifier?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput, collections?: Types.EntityReferenceInput[], observations?: Types.ObservationReferenceInput[], correlationId?: string, agent?: Types.EntityReferenceInput): Promise<Types.IngestUriMutation>; /** * Ingests text content. * @param text - The text to ingest. * @param name - The name of the content, optional. * @param textType - The type of text (plain, markdown, HTML), optional. * @param uri - The URI associated with the content, optional. * @param id - The ID to assign to the content, optional. * @param identifier - The external identifier for the content, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param workflow - The workflow to use for processing, optional. * @param collections - The collections to add the content to, optional. * @param observations - The observations to assign to the content, optional. * @param correlationId - The tenant correlation identifier, optional. * @param agent - The agent to use for processing, optional. * @returns The ingested content. */ ingestText(text: string, name?: string, textType?: Types.TextTypes, uri?: string, id?: string, identifier?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput, collections?: Types.EntityReferenceInput[], observations?: Types.ObservationReferenceInput[], correlationId?: string, agent?: Types.EntityReferenceInput): Promise<Types.IngestTextMutation>; /** * Ingests a memory (ephemeral text content). * @param text - The text to ingest as memory. * @param name - The name of the memory, optional. * @param textType - The type of text (plain, markdown, HTML), optional. * @param id - The ID to assign to the memory, optional. * @param identifier - The external identifier for the memory, optional. * @param collections - The collections to add the memory to, optional. * @param correlationId - The tenant correlation identifier, optional. * @param agent - The agent to use for processing, optional. * @returns The ingested memory. */ ingestMemory(text: string, name?: string, textType?: Types.TextTypes, id?: string, identifier?: string, collections?: Types.EntityReferenceInput[], correlationId?: string, agent?: Types.EntityReferenceInput): Promise<Types.IngestMemoryMutation>; /** * Ingests an event. * @param markdown - The markdown content of the event. * @param name - The name of the event, optional. * @param description - The description of the event, optional. * @param eventDate - The date of the event, optional. * @param id - The ID to assign to the event, optional. * @param identifier - The external identifier for the event, optional. * @param collections - The collections to add the event to, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The ingested event. */ ingestEvent(markdown: string, name?: string, description?: string, eventDate?: Types.Scalars["DateTime"]["input"], id?: string, identifier?: string, collections?: Types.EntityReferenceInput[], correlationId?: string): Promise<Types.IngestEventMutation>; /** * Ingests a base64-encoded file. * @param name - The name of the file. * @param data - The base64-encoded file data. * @param mimeType - The MIME type of the file. * @param fileCreationDate - The file creation date, optional. * @param fileModifiedDate - The file modified date, optional. * @param id - The ID to assign to the content, optional. * @param identifier - The external identifier for the content, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param workflow - The workflow to use for processing, optional. * @param collections - The collections to add the content to, optional. * @param observations - The observations to assign to the content, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The ingested content. */ ingestEncodedFile(name: string, data: string, mimeType: string, fileCreationDate?: Types.Scalars["DateTime"]["input"], fileModifiedDate?: Types.Scalars["DateTime"]["input"], id?: string, identifier?: string, isSynchronous?: boolean, workflow?: Types.EntityReferenceInput, collections?: Types.EntityReferenceInput[], observations?: Types.ObservationReferenceInput[], correlationId?: string): Promise<Types.IngestEncodedFileMutation>; /** * Updates content. * @param content - The content to update. * @returns The updated content. */ updateContent(content: Types.ContentUpdateInput): Promise<Types.UpdateContentMutation>; /** * Deletes content. * @param id - The ID of the content to delete. * @returns The deleted content. */ deleteContent(id: string): Promise<Types.DeleteContentMutation>; /** * Approves content. * @param id - The ID of the content to approve. * @returns The approved content. */ approveContent(id: string): Promise<Types.ApproveContentMutation>; /** * Rejects content. * @param id - The ID of the content to reject. * @param reason - The reason for rejection. * @returns The rejected content. */ rejectContent(id: string, reason?: string): Promise<Types.RejectContentMutation>; /** * Adds a label to content. * @param id - The ID of the content. * @param label - The label to add. * @returns The added label. */ addContentLabel(id: string, label: string): Promise<Types.AddContentLabelMutation>; /** * Removes a label from content. * @param id - The ID of the content. * @param label - The label to remove. * @returns The removed label. */ removeContentLabel(id: string, label: string): Promise<Types.RemoveContentLabelMutation>; /** * Restarts content processing. * @param id - The ID of the content to restart. * @returns The restarted content. */ restartContent(id: string): Promise<Types.RestartContentMutation>; /** * Deletes multiple contents. * @param ids - The IDs of the contents to delete. * @param isSynchronous - Whether this mutation is synchronous. * @returns The deleted contents. */ deleteContents(ids: string[], isSynchronous?: boolean): Promise<Types.DeleteContentsMutation>; /** * Deletes all contents based on the provided filter criteria. * @param filter - The filter criteria to apply when deleting contents. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The result of the deletion. */ deleteAllContents(filter?: Types.ContentFilter, isSynchronous?: boolean, correlationId?: string): Promise<Types.DeleteAllContentsMutation>; /** * Summarizes text using the specified summarization strategy. * @param summarization - The summarization strategy to use. * @param text - The text to summarize. * @param textType - The type of text (plain, markdown, HTML), optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The summarized text. */ summarizeText(summarization: Types.SummarizationStrategyInput, text: string, textType?: Types.TextTypes, correlationId?: string): Promise<Types.SummarizeTextMutation>; /** * Summarizes contents using the specified summarization strategies. * @param summarizations - The summarization strategies to use. * @param filter - The filter criteria to apply when retrieving contents to summarize. * @param correlationId - The tenant correlation identifier, optional. * @returns The summarized contents. */ summarizeContents(summarizations: Types.SummarizationStrategyInput[], filter?: Types.ContentFilter, correlationId?: string): Promise<Types.SummarizeContentsMutation>; /** * Classifies text using the specified classification connector. * @param text - The text to classify. * @param classification - The classification connector to use. * @param textType - The type of text (plain, markdown, HTML), optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The classification labels. */ classifyText(text: string, classification: Types.ContentClassificationConnectorInput, textType?: Types.TextTypes, correlationId?: string): Promise<Types.ClassifyTextMutation>; /** * Classifies contents using the specified classification connector. * @param classification - The classification connector to use. * @param filter - The filter criteria to apply when retrieving contents. * @param correlationId - The tenant correlation identifier, optional. * @returns The classification results. */ classifyContents(classification: Types.ContentClassificationConnectorInput, filter?: Types.ContentFilter, correlationId?: string): Promise<Types.ClassifyContentsMutation>; /** * Extracts structured data from text using tool definitions. * @param prompt - The prompt to guide extraction. * @param text - The text to extract from. * @param tools - The tool definitions for extraction. * @param specification - The LLM specification to use, optional. * @param textType - The type of text (plain, markdown, HTML), optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The extracted data. */ extractText(prompt: string, text: string, tools: Types.ToolDefinitionInput[], specification?: Types.EntityReferenceInput, textType?: Types.TextTypes, correlationId?: string): Promise<Types.ExtractTextMutation>; /** * Extracts structured data from contents using tool definitions. * @param prompt - The prompt to guide extraction. * @param tools - The tool definitions for extraction. * @param specification - The LLM specification to use, optional. * @param filter - The filter criteria to apply when retrieving contents. * @param correlationId - The tenant correlation identifier, optional. * @returns The extracted data. */ extractContents(prompt: string, tools: Types.ToolDefinitionInput[], specification?: Types.EntityReferenceInput, filter?: Types.ContentFilter, correlationId?: string): Promise<Types.ExtractContentsMutation>; /** * Extracts observables (entities) from text. * @param text - The text to extract observables from. * @param textType - The type of text (plain, markdown, HTML), optional. * @param specification - The LLM specification to use, optional. * @param observableTypes - The types of observables to extract, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The extracted observables. */ extractObservables(text: string, textType?: Types.TextTypes, specification?: Types.EntityReferenceInput, observableTypes?: Types.ObservableTypes[], correlationId?: string): Promise<Types.ExtractObservablesMutation>; /** * Publishes contents to an external connector. * @param publishPrompt - The prompt for publishing. * @param connector - The publishing connector to use. * @param summaryPrompt - The prompt for summarizing each content, optional. * @param summarySpecification - The LLM specification for summarization, optional. * @param publishSpecification - The LLM specification for publishing, optional. * @param name - The name of the published content, optional. * @param filter - The filter criteria for selecting contents, optional. * @param workflow - The workflow to use, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param includeDetails - Whether to include details in publishing, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The published content. */ publishContents(publishPrompt: string, connector: Types.ContentPublishingConnectorInput, summaryPrompt?: string, summarySpecification?: Types.EntityReferenceInput, publishSpecification?: Types.EntityReferenceInput, name?: string, filter?: Types.ContentFilter, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, includeDetails?: boolean, correlationId?: string): Promise<Types.PublishContentsMutation>; /** * Publishes skills from contents matching the provided filter. * @param filter - The content filter criteria, optional. * @param correlationId - The tenant correlation identifier, optional. * @returns The published skills. */ publishSkills(filter?: Types.ContentFilter, correlationId?: string): Promise<Types.PublishSkillsMutation>; /** * Publishes text to an external connector. * @param text - The text to publish. * @param textType - The type of text (plain, markdown, HTML). * @param connector - The publishing connector to use. * @param name - The name of the published content, optional. * @param workflow - The workflow to use, optional. * @param isSynchronous - Whether this mutation is synchronous. * @param correlationId - The tenant correlation identifier, optional. * @returns The published content. */ publishText(text: string, textType: Types.TextTypes, connector: Types.ContentPublishingConnectorInput, name?: string, workflow?: Types.EntityReferenceInput, isSynchronous?: boolean, correlationId?: string): Promise<Types.PublishTextMutation>; /** * Distributes contents to an external connector. * @p