UNPKG

tlnt

Version:

TLNT - HMS-Powered Multi-Agent Platform with Government Agency Analysis, Deep Research, and Enterprise-Ready Deployment. Self-optimizing multi-domain AI agent with continuous learning and enterprise-grade performance monitoring.

161 lines 6.2 kB
/** * HMS-NFO API Client * * Client for connecting to HMS-NFO (Data Source/ETL System) API * Provides data processing, ETL, agency analysis, and deep research capabilities */ import axios from 'axios'; export class HMSNfoClient { client; config; constructor(config) { this.config = { timeout: 30000, ...config, }; this.client = axios.create({ baseURL: this.config.baseURL, timeout: this.config.timeout, headers: { 'Content-Type': 'application/json', ...(this.config.apiKey && { 'Authorization': `Bearer ${this.config.apiKey}`, }), }, }); // Request interceptor for logging this.client.interceptors.request.use((config) => { console.log(`HMS-NFO Request: ${config.method?.toUpperCase()} ${config.url}`); return config; }, (error) => { console.error('HMS-NFO Request Error:', error); return Promise.reject(error); }); // Response interceptor for error handling this.client.interceptors.response.use((response) => { console.log(`HMS-NFO Response: ${response.status} ${response.config.url}`); return response; }, (error) => { console.error('HMS-NFO Response Error:', error.response?.status, error.response?.data); return Promise.reject(this.formatError(error)); }); } formatError(error) { if (error.response) { const message = error.response.data?.message || error.response.data?.error || 'HMS-NFO API Error'; return new Error(`${message} (${error.response.status})`); } else if (error.request) { return new Error('HMS-NFO connection timeout or network error'); } else { return new Error(`HMS-NFO client error: ${error.message}`); } } // Health check async healthCheck() { const response = await this.client.get('/health'); return response.data; } // Agent-specific endpoints for HMS-NET integration async requestETLProcessing(request) { const requestWithId = { ...request, request_id: request.request_id || `etl-${Date.now()}`, }; const response = await this.client.post('/api/agent/etl-request', requestWithId); return response.data; } async requestAgencyAnalysis(request) { const requestWithId = { ...request, request_id: request.request_id || `agency-${Date.now()}`, }; const response = await this.client.post('/api/agent/agency-issue', requestWithId); return response.data; } async requestDeepResearch(request) { const requestWithId = { ...request, request_id: request.request_id || `research-${Date.now()}`, }; const response = await this.client.post('/api/agent/deep-research', requestWithId); return response.data; } // Demo endpoints for testing and development async getAgencyTypes() { const response = await this.client.get('/api/demo/agency-types'); return response.data.agency_types || response.data['agency-types']; } async performWebSearch(request) { const response = await this.client.post('/api/demo/web-search', request); return response.data; } async getETLStatus() { const response = await this.client.get('/api/demo/etl-status'); return response.data; } async performDemoAgencyAnalysis(agencyName, issueTopic, state) { const response = await this.client.post('/api/agency-issue', { agency_name: agencyName, issue_topic: issueTopic, state, }); return response.data; } async performDemoDeepResearch(query, depth = 3) { const response = await this.client.post('/api/demo/deep-research', { query, depth, }); return response.data; } // Convenience methods for common operations async analyzeGovernmentAgency(agencyName, issueTopic, options = {}) { return this.requestAgencyAnalysis({ agent_id: `blax-nfo-${Date.now()}`, agency_name: agencyName, issue_topic: issueTopic, state: options.state, agency_type: options.agencyType, analysis_parameters: { include_regulations: options.includeRegulations ?? true, include_policy_analysis: options.includePolicyAnalysis ?? true, generate_recommendations: options.generateRecommendations ?? true, }, callback_url: options.callbackUrl, }); } async performComprehensiveResearch(topic, options = {}) { return this.requestDeepResearch({ agent_id: `blax-nfo-${Date.now()}`, research_topic: topic, research_depth: options.depth ?? 3, research_breadth: options.breadth ?? 5, parameters: { include_cort_analysis: options.includeCoRT ?? true, source_types: options.sourceTypes ?? ['government', 'academic', 'industry'], max_sources: options.maxSources ?? 50, synthesis_required: options.synthesisRequired ?? true, }, callback_url: options.callbackUrl, }); } async processGovernmentData(source, options = {}) { return this.requestETLProcessing({ agent_id: `blax-nfo-${Date.now()}`, type: 'etl_processing', source, parameters: { output_format: options.outputFormat ?? 'structured_json', analysis_depth: options.analysisDepth ?? 3, include_metadata: options.includeMetadata ?? true, filter_criteria: options.filterCriteria, }, callback_url: options.callbackUrl, timeout_seconds: 300, }); } } export default HMSNfoClient; //# sourceMappingURL=hmsNfoClient.js.map