This page covers configuration and management of Document

Object Overview

Endpoint, URL, and Supported Methods
Objects are managed via the storage server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/vectorrepositories/[vector-repository-guid]/documents.

Supported methods include: GET HEAD POST DELETE

Structure

Objects contain metadata about a processed document, typically related to vector embedding and semantic analysis pipelines. An example is shown below:

Text
Copy
Edit


Properties:

Success boolean indicating whether the operation that created this data was successful

GUID GUID globally unique identifier for the current metadata record

DocumentGUID GUID globally unique identifier for the processed document

TenantGUID GUID globally unique identifier for the tenant

CollectionGUID GUID globally unique identifier for the collection this document belongs to

SourceDocumentGUID GUID globally unique identifier for the original source document

BucketGUID GUID globally unique identifier for the storage bucket

VectorRepositoryGUID GUID globally unique identifier for the vector store or repository

GraphNodeIdentifier string string representing a node identifier within a semantic or knowledge graph

ObjectGUID GUID globally unique identifier for the object stored (usually in S3 or similar)

ObjectKey string the key (filename) of the object

ObjectVersion string version of the stored object`

Model string the machine learning model used for semantic processing (e.g., embedding)

SemanticCells array an array of semantic cell representations (typically empty until populated by processing)

CreatedUtc datetime timestamp for when this metadata record was created, in UTC time

Write Document

To write document, call POST /v1.0/tenants/[tenant-guid]/vectorrepositories/[vector-repository-guid]/documents

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000/documents' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "BucketGUID": "00000000-0000-0000-0000-000000000000",
    "CollectionGUID": "00000000-0000-0000-0000-000000000000",
    "SourceDocumentGUID": "00000000-0000-0000-0000-000000000000",
    "ObjectGUID": "00000000-0000-0000-0000-000000000000",
    "VectorRepositoryGUID": "00000000-0000-0000-0000-000000000000",
    "ObjectKey": "hello.json",
    "ObjectVersion": "1",
    "CreatedUtc": "2024-06-01",
    "SemanticCells": []
}'
import { ViewVectorProxySdk } from "view-sdk";

const vector = new ViewVectorProxySdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const writeDocument = async () => {
  try {
    const response = await vector.writeDocument({
      BucketGUID: "00000000-0000-0000-0000-000000000000",
      CollectionGUID: "00000000-0000-0000-0000-000000000000",
      SourceDocumentGUID: "00000000-0000-0000-0000-000000000000",
      ObjectGUID: "00000000-0000-0000-0000-000000000000",
      VectorRepositoryGUID: "00000000-0000-0000-0000-000000000000",
      ObjectKey: "hello.json",
      ObjectVersion: "1",
      CreatedUtc: "2024-06-01",
      SemanticCells: [],
    });
    console.log(response, "Write document response");
  } catch (err) {
    console.log("Error write document:", err);
  }
};

writeDocument();

Response

{
    "Success": true,
    "GUID": "8b5b2c5d-bf03-4bb4-8888-fd1c2a3645ec",
    "DocumentGUID": "d826c2ce-ed73-49d8-beed-b487fb37ae80",
    "TenantGUID": "00000000-0000-0000-0000-000000000000",
    "CollectionGUID": "00000000-0000-0000-0000-000000000000",
    "SourceDocumentGUID": "00000000-0000-0000-0000-000000000000",
    "BucketGUID": "00000000-0000-0000-0000-000000000000",
    "VectorRepositoryGUID": "00000000-0000-0000-0000-000000000000",
    "GraphNodeIdentifier": "",
    "ObjectGUID": "00000000-0000-0000-0000-000000000000",
    "ObjectKey": "hello.json",
    "ObjectVersion": "1",
    "Model": "sentence-transformers/all-MiniLM-L6-v2",
    "SemanticCells": [],
    "CreatedUtc": "2024-06-01T12:00:00.000000Z"
}

Read Document

To read document, call GET /v1.0/tenants/[tenant-guid]/vectorrepositories/[vector-repository-guid]/documents/[document-guid]

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000/documents/8b5b2c5d-bf03-4bb4-8888-fd1c2a3645ec' \
--header 'Authorization: ••••••' \
--data ''
import { ViewVectorProxySdk } from "view-sdk";

const vector = new ViewVectorProxySdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const readDocument = async () => {
  try {
    const response = await vector.readDocument(
      "00000000-0000-0000-0000-000000000000",
      "8b5b2c5d-bf03-4bb4-8888-fd1c2a3645ec"
    );
    console.log(response, "Read document response");
  } catch (err) {
    console.log("Error read document:", err);
  }
};

readDocument();

Document Exist

To check document existence , call HEAD /v1.0/tenants/[tenant-guid]/vectorrepositories/[vector-repository-guid]/documents/[document-guid]

curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••' \
--data ''
import { ViewVectorProxySdk } from "view-sdk";

const vector = new ViewVectorProxySdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);


const documentExist = async () => {
  try {
    const response = await vector.documentExists(
      "00000000-0000-0000-0000-000000000000",
      "8b5b2c5d-bf03-4bb4-8888-fd1c2a3645ec"
    );
    console.log(response, "Document exist response");
  } catch (err) {
    console.log("Error document exist:", err);
  }
};

Delete Document

To delete documen , call DELETE /v1.0/tenants/[tenant-guid]/vectorrepositories/[vector-repository-guid]/documents/[document-guid]

curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
'
import { ViewVectorProxySdk } from "view-sdk";

const vector = new ViewVectorProxySdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);



const deleteDocument = async () => {
  try {
    const response = await vector.deleteDocument(
      "00000000-0000-0000-0000-000000000000",
      "8b5b2c5d-bf03-4bb4-8888-fd1c2a3645ec"
    );
    console.log(response, "Delete document response");
  } catch (err) {
    console.log("Error delete document:", err);
  }
};
deleteDocument();