Document

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 api = new ViewVectorProxySdk(
  "http://localhost:8000/", //endpoint
  "<tenant-guid>", //tenant Id
  "default" //access key
);

const writeDocument = async () => {
  try {
    const response = await api.Document.write({
      BucketGUID: "<bucket-guid>",
      CollectionGUID: "<collection-guid>",
      SourceDocumentGUID: "<source-document-guid>",
      ObjectGUID: "<object-guid>",
      VectorRepositoryGUID: "<vector-repository-guid>",
      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();
import view_sdk
from view_sdk import lexi

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def createDocument():
    response = vector.Documents.create("<tenant-guid>",
        BucketGUID = "<bucket-guid>",
        CollectionGUID = "<collection-guid>",
        SourceDocumentGUID = "<source-document-guid>",
        ObjectGUID = "<object-guid>",
        VectorRepositoryGUID = "<vector-repository-guid>",
        ObjectKey = "hello.json",
        ObjectVersion = "1",
        CreatedUtc = "2024-06-01",
        SemanticCells = [
        {
            "CellType": "Text",
            "MD5Hash": "000",
            "SHA1Hash": "111",
            "SHA256Hash": "222",
            "Position": 0,
            "Chunks": [
                {
                    "MD5Hash": "000",
                    "SHA1Hash": "111",
                    "SHA256Hash": "222",
                    "Position": 0,
                    "Content": "This is a sample chunk",
                    "Embeddings": []
                }
            ]
        }
    ]
    )
    print(response)

createDocument()
using View.Sdk;
using View.Sdk.Vector;
using View.Sdk.Embeddings;
using View.Sdk.Semantic;

ViewVectorSdk sdk = new ViewVectorSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");

SemanticChunk chunk = new SemanticChunk
{
   MD5Hash = "000",
   SHA1Hash = "111",
   SHA256Hash = "222",
   Position = 0,
   Content = "This is a sample chunk",
   Embeddings = new List<float> { 0.16624743f, -0.01494671f }
};

SemanticCell cell = new SemanticCell
{
   CellType = SemanticCellTypeEnum.Text,
   MD5Hash = "000",
   SHA1Hash = "111",
   SHA256Hash = "222",
   Position = 0,
   Chunks = new List<SemanticChunk> { chunk, chunk }
};

EmbeddingsDocument document = new EmbeddingsDocument
{
   BucketGUID = Guid.Parse("<bucket-guid>"),
   CollectionGUID = Guid.Parse("<collection-guid>"),
   SourceDocumentGUID = Guid.Parse("<source-document-guid>"),
   ObjectGUID = Guid.Parse("<object-guid>"),
   VectorRepositoryGUID = Guid.Parse("<vector-repository-guid>"),
   ObjectKey = "hello.json",
   ObjectVersion = "1",
   CreatedUtc = DateTime.Parse("2024-06-01"),
   SemanticCells = new List<SemanticCell> { cell, cell }
};

 EmbeddingsDocument result = await sdk.WriteDocument(document);

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 api = new ViewVectorProxySdk(
  "http://localhost:8000/", //endpoint
  "<tenant-guid>", //tenant Id
  "default" //access key
);

const readDocument = async () => {
  try {
    const response = await api.Document.read(
      "<vector-repository-guid>",
      "<document-guid>"
    );
    console.log(response, "Read document response");
  } catch (err) {
    console.log("Error read document:", err);
  }
};

readDocument();
import view_sdk
from view_sdk import lexi

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def readDocument(): 
    response = vector.Documents.retrieve("<vector-repository-guid>","<document-guid>")
    print(response)

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 api = new ViewVectorProxySdk(
  "http://localhost:8000/", //endpoint
  "<tenant-guid>", //tenant Id
  "default" //access key
);


const documentExist = async () => {
  try {
    const response = await api.Document.exists(
      "<vector-repository-guid>",
      "<document-guid>"
    );
    console.log(response, "Document exist response");
  } catch (err) {
    console.log("Error document exist:", err);
  }
};
import view_sdk
from view_sdk import lexi

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def existsDocument():
    response = vector.Documents.exists("<vector-repository-guid>","<document-guid>")
    print(response)

existsDocument()
using View.Sdk;
using View.Sdk.Vector;
using View.Sdk.Embeddings;
using View.Sdk.Semantic;

ViewVectorSdk sdk = new ViewVectorSdk(Guid.Parse("<tenant-guid>"),"default", "http://localhost:8000/");

Guid vectorRepoGuid = Guid.Parse("<vector-repository-guid>");
Guid documentGuid   = Guid.Parse("<document-guid>");

bool exists = await sdk.DocumentExists(vectorRepoGuid, documentGuid);

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 api = new ViewVectorProxySdk(
  "http://localhost:8000/", //endpoint
  "<tenant-guid>", //tenant Id
  "default" //access key
);



const deleteDocument = async () => {
  try {
    const response = await api.Document.delete(
      "<vector-repository-guid>",
      "<document-guid>"
    );
    console.log(response, "Delete document response");
  } catch (err) {
    console.log("Error delete document:", err);
  }
};
deleteDocument();
import view_sdk
from view_sdk import lexi

sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")

def deleteDocument():
    response = vector.Documents.delete("<vector-repository-guid>","<document-guid>")
    print(response)

deleteDocument()
using View.Sdk;
using View.Sdk.Vector;
using View.Sdk.Embeddings;
using View.Sdk.Semantic;

ViewVectorSdk sdk = new ViewVectorSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://localhost:8000/");

Guid vectorRepoGuid = Guid.Parse("<vector-repository-guid>");
Guid documentGuid   = Guid.Parse("<document-guid>");

bool deleted = await sdk.DeleteDocument(vectorRepoGuid, documentGuid);