@cpod/sdk - v0.2.7
    Preparing search index...

    Function addEntity

    • Add a new entity to document chunks

      Adds a named entity to a single chunk or all chunks of a file. Useful for manual entity annotation or correction.

      Parameters

      • request: AddEntityRequest

        Entity addition request

        Request to add a new entity

        • entity: string

          Entity name (required)

        • id: string

          Chunk or file ID (required)

        • userName: string

          User name performing the operation (required)

        • entityType: string

          Entity type (required) - e.g., "PERSON", "ORGANIZATION", "LOCATION", "PRODUCT"

        • Optionaldescription?: string

          Entity description (optional)

        • OptionalupdateType?: "chunk" | "file"

          Update type: 'chunk' for single chunk, 'file' for all chunks (default: 'chunk')

      Returns Promise<AddEntityResponse>

      Promise resolving to AddEntityResponse:

      • response - Success status (boolean)
      • chunksUpdated - Number of chunks where entity was added
      • chunksSkipped - Number of chunks skipped (already had entity)
      • fileHash - File hash if file-level update
      • updatedEntity - Name of the entity that was added

      401 - Not authenticated

      422 - Validation error

      import { addEntity } from "@cpod/sdk";

      // Add entity to a specific chunk
      const result = await addEntity({
      entity: "John Smith",
      id: "chunk-abc123",
      userName: "admin@example.com",
      entityType: "PERSON",
      description: "CEO of Acme Corp",
      updateType: "chunk",
      });
      console.log(`Added to ${result.chunksUpdated} chunks`);

      // Add entity to all chunks of a file
      const fileResult = await addEntity({
      entity: "Acme Corporation",
      id: "95d47a820fcc0a667004a6da403b3d29",
      userName: "admin@example.com",
      entityType: "ORGANIZATION",
      updateType: "file",
      });