Comprehensive guide to Director functionality in the View platform for connection management and embeddings generation.
Overview
Director functionality provides comprehensive platform coordination and service management capabilities within the View platform. It enables connection management, embeddings generation, and coordination of various platform services for optimal system operation and AI-powered content processing.
Director operations are accessible via the View platform API at port 8501 and support connection management and embeddings generation for enhanced platform functionality.
API Endpoints
- GET
/v1.0/connections- List all connections - POST
/v1.0/tenants/[tenant-guid]/embeddings/- Generate embeddings
SDK Setup
JavaScript SDK Setup
Install SDK from npm
npm install view-sdk
Initialize Configuration Sdk
import { ViewDirectorSdk } from "view-sdk";
const director = new ViewDirectorSdk(
"<tenant-guid>", //tenant Id
"default", //access token
"http://localhost:8501/" //endpoint
);
Python setup
Install SDK from pip
pip install view-sdk
Initialize Configuration Sdk
import view_sdk
from view_sdk import director
from view_sdk.sdk_configuration import Service
sdk = view_sdk.configure(
access_key="default",
base_url="localhost",
tenant_guid="tenant-guid",
service_ports={Service.DIRECTOR: 8000},
)
List Connections
To list connections call GET /v1.0/connections
curl --location --request GET 'http://localhost:8501/v1.0/connections' \
--header 'Content-Type: application/json' \
--header 'x-token: *******' \
'import { ViewDirectorSdk } from "view-sdk";
const api = new ViewDirectorSdk(
"http://localhost:8501/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
director.accessToken = "******";
const listConnections = async () => {
try {
const response = await api.Embedding.retrieveConnections();
console.log(response);
} catch (error) {
console.error("Error listing connections:", error);
}
};
listConnections();import view_sdk
from view_sdk import director
from view_sdk.sdk_configuration import Service
sdk = view_sdk.configure(
access_key="default",
base_url="localhost",
tenant_guid="tenant-guid",
service_ports={Service.DIRECTOR: 8000},
)
def listConnections():
result = director.Connections.retrieve_all("******")
print(result)
listConnections()Generate Embeddings
To generate embeddings call GET /v1.0/tenants/[tenant-guid]/embeddings/
curl --location 'http://localhost:8501/v1.0/tenants/00000000-0000-0000-0000-000000000000/embeddings/' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"Model": "all-MiniLM-L6-v2",
"ApiKey": "",
"Contents": [
"This is a sample chunk of text, hello!",
"Oh wow, here'\''s another chunk of text",
"And yet again, a third chunk of text"
]
}'import { ViewDirectorSdk } from "view-sdk";
const api = new ViewDirectorSdk(
"http://localhost:8501/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const generateEmbedding = async () => {
try {
const response = await api.Embedding.generateEmbedding({
Model: "all-MiniLM-L6-v2",
ApiKey: "",
Contents: ["This is a sample chunk of text, hello!"],
});
console.log(response);
} catch (error) {
console.error("Error generating embedding:", error);
}
};
generateEmbedding();import view_sdk
from view_sdk import director
from view_sdk.sdk_configuration import Service
sdk = view_sdk.configure(
access_key="default",
base_url="localhost",
tenant_guid="tenant-guid",
service_ports={Service.DIRECTOR: 8000},
)
def generateEmbeddings():
result = director.GenerateEmbeddings.create(
Model= "all-MiniLM-L6-v2",
ApiKey= "",
Contents= [
"This is a sample chunk of text, hello!",
"Oh wow, here's another chunk of text",
"And yet again, a third chunk of text"
]
)
print(result)
generateEmbeddings()Best Practices
When implementing Director functionality in the View platform, consider the following recommendations for optimal connection management, embeddings generation, and platform coordination:
- Connection Management: Implement effective connection management strategies for optimal platform service coordination and resource utilization
- Embeddings Generation: Configure appropriate embeddings generation parameters and models for optimal AI-powered content processing and analysis
- Service Coordination: Implement comprehensive service coordination strategies for optimal platform operation and performance
- Resource Optimization: Monitor and optimize resource utilization for embeddings generation and connection management operations
- Error Handling: Implement robust error handling and recovery mechanisms for connection failures and embeddings generation issues
Next Steps
After successfully implementing Director functionality, you can:
- Platform Integration: Integrate Director functionality with other platform services for enhanced coordination and operation
- Service Management: Use Director capabilities for comprehensive service management and platform optimization
- AI-Powered Processing: Leverage embeddings generation for advanced AI-powered content processing and analysis
- Connection Optimization: Optimize connection management for improved platform performance and reliability
- Advanced Coordination: Implement advanced platform coordination strategies using Director capabilities for enhanced system operation