Developer Integration
Developer Integration Framework
VoxaCP provides a flexible and robust framework for developer integration, making it easy to design, modify, and expand AI agents. Whether you want to build new agents, connect external services, or integrate VoxaCP’s AI capabilities into your own applications, this framework includes all the tools and APIs required for seamless development.
Key Features
Feature
Description
API Access
RESTful and WebSocket APIs for interacting with AI agents and system components.
SDKs
Official Software Development Kits available for major languages such as Python and JavaScript.
Custom Agent Creation
Templates and utilities for building task-specific or industry-specific agents.
Event Hooks
Define custom event listeners to trigger actions based on agent activity or user interactions.
Context Integration
Seamless access to decentralized context data within your custom applications.
Security Controls
Strong authentication and permission systems to protect user data and regulate agent access.
SDK Installation
Install the official VoxaCP SDK from npm:
npm install @voxacp/sdkSet your API key in a .env file:
VoxaCP_API_KEY="YOUR_VOXACP_API_KEY_HERE"Example: Verifying AI Model Output
Below is a complete implementation example for verifying AI outputs using the VoxaCP SDK.
// Import the VoxaCP SDK – your gateway to decentralized AI verification
import { VoxaCP } from '@voxacp/sdk';
// Initialize the VoxaCP client with your API key
// Ensure your VoxaCP_API_KEY is set in your environment variables for production use.
const vxa = new VoxaCP({
apiKey: process.env.VoxaCP_API_KEY,
environment: 'production' // Use 'production' for live deployments
});
/**
* Verifies the output of an AI model using VoxaCP's decentralized attestation network.
* This ensures transparency, integrity, and trust in AI-generated outputs.
*
* @param {string} modelId - The identifier of the AI model (e.g., 'gpt-4o', 'custom-predictor').
* @param {string} input - The input or prompt sent to the AI model.
* @param {string} output - The output generated by the AI model.
* @returns {Promise<object|null>} The verification details if successful, otherwise null.
*/
async function verifyAIModelOutput(modelId, input, output) {
console.log(`\n--- Starting Verification for Model: ${modelId} ---`);
console.log('Input:', input);
console.log('Output:', output);
try {
// Step 1: Create an Attestation
console.log('Requesting attestation from VoxaCP...');
const attestation = await vxa.createAttestation({
modelId,
input,
output,
options: {
includeProof: true,
storagePolicy: 'persistent'
}
});
console.log(`Attestation created successfully! Attestation ID: ${attestation.id}`);
// Step 2: Verify the Attestation
console.log('Verifying the attestation...');
const verification = await vxa.verifyAttestation(attestation.id);
if (verification.isValid) {
console.log('✅ AI Output Verified Successfully!');
console.log(`Verification ID: ${verification.id}`);
return verification;
} else {
console.error('❌ Verification Failed!');
console.error(`Reason: ${verification.reason}`);
return null;
}
} catch (error) {
console.error('An error occurred during the verification process:');
if (error.response) {
console.error('API Error Status:', error.response.status);
console.error('API Error Data:', error.response.data);
} else if (error.request) {
console.error('Network Error: No response received from VoxaCP API.');
} else {
console.error('General Error Message:', error.message);
}
throw error;
} finally {
console.log('--- Verification Process Complete ---');
}
}
// --- Example Usage ---
verifyAIModelOutput(
'gpt-4o',
'What is the capital of France?',
'The capital of France is Paris.'
).then(result => {
if (result) {
console.log('Factual AI response check passed.');
} else {
console.log('Factual AI response check failed.');
}
});
verifyAIModelOutput(
'content-moderator-v1',
'Review the following text for hate speech: "I love sunny days!"',
'Classification: Clean. No hate speech detected.'
).then(result => {
if (result) {
console.log('Content moderation AI output check passed.');
} else {
console.log('Content moderation AI output check failed.');
}
}).catch(err => {
console.error("Content moderation example encountered an error:", err);
});Last updated

