@squidcloud/client
    Preparing search index...

    Class AiKnowledgeBaseReference

    A reference to an AI knowledge base.

    Index
    • Stages contexts through bulk ingestion — a durable, asynchronous lane that processes contexts through provider batch APIs rather than inline, built for high-volume ingestion. Unlike upsertContexts, this method returns as soon as the request is staged and never awaits ingestion completion; track progress with observeBulkIngestionJob or by polling getBulkIngestionJob with the returned job id.

      Parameters

      • contextRequests: BulkIngestionContext[]

        The contexts to stage; each becomes one bulk-ingestion file.

      • Optionalfiles: File[]

        Positional files for contexts with type: 'file' and no stagedObjectKey. At most 50 files, and 256 MB across all of them — the multipart body is buffered in memory server-side, so both caps are enforced by the upload parser and exceeding either is rejected before staging runs. For larger sets use createBulkUploadUrls and pass stagedObjectKey instead, which uploads straight to storage and is subject to neither cap.

      Returns Promise<BulkIngestionUpsertContextsResponse>

      The id of the staged bulk-ingestion job, plus the context id assigned to each staged context (in the same order as contextRequests).

    • Cancels a running bulk-ingestion job. Already-finalized contexts are kept; the job transitions to cancelled once in-flight provider work drains.

      Parameters

      • jobId: string

      Returns Promise<void>

    • Mints presigned upload URLs for direct-to-storage bulk files, bypassing multipart upload through core. PUT each file's bytes to its uploadUrl — sending every header in that entry's requiredHeaders, which some storage backends reject the PUT without — then reference the matching stagedObjectKey in a BulkIngestionContext passed to bulkUpsertContexts.

      Parameters

      • fileNames: string[]

        The names of the files to mint upload URLs for (at most 500 per call).

      Returns Promise<BulkIngestionCreateUploadUrlsResponse>

    • Deletes the AI knowledge base.

      Returns Promise<void>

      A promise that resolves when the deletion is complete.

    • Deletes a specific context by its ID.

      Parameters

      • contextId: string

      Returns Promise<void>

    • Deletes multiple contexts.

      Parameters

      • contextIds: string[]

      Returns Promise<void>

    • Returns the AI knowledge base.

      Returns Promise<AiKnowledgeBase | undefined>

      A promise that resolves to the AI knowledge base or undefined if not found.

    • Scans the knowledge base's raw extracted text for a literal string and returns every matching line with its file and locator. Unlike search this reads the pre-chunking text, which includes spreadsheet rows verbatim, and matches characters rather than meaning. The pattern is always a literal — regex metacharacters in it are escaped — and matching is case-insensitive. options.metadataFilter scopes the scan to the contexts it admits before any text is matched.

      Parameters

      Returns Promise<GrepKnowledgeBaseResponse>

    • Lists the ids for all contexts associated with the knowledge base.

      Returns Promise<string[]>

    • Lists all contexts associated with the knowledge base.

      Parameters

      • OptionaltruncateTextAfter: number

      Returns Promise<AiKnowledgeBaseContext[]>

      Fetches every context in one call with no pagination — expensive for large knowledge bases. Use listContextsPage instead, which supports offset/limit/search.

    • Returns all AI knowledge bases.

      Returns Promise<AiKnowledgeBase[]>

      A promise that resolves to an array of AI Knowledge Bases

    • Emits every bulkIngestionStatus push the server sends for the job and completes once a terminal state (completed, failed or cancelled) is emitted. Unlike JobClient.awaitJob, a terminal failed/cancelled state is delivered as a normal emitted value — the observable itself never errors because the job reached a terminal state; it only errors on a transport/subscription failure.

      Re-subscribes to the server-side push automatically if the client's connection id changes mid-subscription (e.g. after a long disconnect). Unsubscribing tears down the underlying socket listener. The observable is cold: each subscription independently registers a server-side push subscription, so share it (e.g. rxjs share()) when multiple consumers observe one job.

      If the job's app or knowledge base is deleted mid-flight, the job row is purged without a terminal push, so the observable never completes on its own; bound it (e.g. rxjs timeout()) when deletion is possible.

      Parameters

      • jobId: string

      Returns Observable<BulkIngestionJobStatusResponse & { jobId: string }>

    • Enqueues a graph rebuild/backfill. The default 'structural' mode keeps the already-extracted entity graph (extracting only contexts never graph-indexed) and rebuilds just the concept layer (topics + facets); mode: 'full' wipes the graph and re-extracts every context with an LLM — expensive, and only needed when the extraction itself must be redone (e.g. after changing entityTypes or extractionModel). Requires graphRag.enabled. Track progress via getGraphStatus's buildJob; only one rebuild can run per knowledge base at a time.

      Parameters

      Returns Promise<void>

    • Upserts the AI knowledge base.

      Parameters

      Returns Promise<void>