Future Features
The following features are experimental or planned and may be refined in subsequent versions.
Multimodal Support
Support for image, audio, and video input/output.
typescript
import { createImageContent, createAudioContent, createMultiModalMessage } from '@yh-ui/ai-sdk'
// Image input
const imageContent = createImageContent({
url: 'https://example.com/image.jpg',
detail: 'high' // 'low' | 'high' | 'auto'
})
// Multimodal message
const message = createMultiModalMessage({
role: 'user',
content: [imageContent, { type: 'text', text: 'Describe this image' }]
})Chain of Thought (CoT)
typescript
import { createChainOfThought } from '@yh-ui/ai-sdk'
const cot = createChainOfThought({
mode: 'chain', // standard | chain | tree | tabular
maxDepth: 5,
showConfidence: true
})
const result = await cot.run('Analyze the solution to this problem', llmCall)
console.log(result.steps) // Reasoning steps
console.log(result.answer) // Final answerCost Control
typescript
import { createCostTracker } from '@yh-ui/ai-sdk'
const costTracker = createCostTracker({
monthlyBudget: 100, // $100/month
maxTokensPerRequest: 4000, // Single request limit
warningThreshold: 0.8, // Warning at 80%
onBudgetExceeded: (budget) => {
console.warn('Budget almost exhausted:', budget)
}
})
// Record usage
costTracker.recordUsage({
prompt: 100,
completion: 200,
model: 'gpt-4'
})
// Get tracking status
const tracking = costTracker.getTracking()
console.log(`Used this month: $${tracking.totalCost}`)
console.log(`Remaining budget: $${tracking.remaining}`)Safety Guardrails
typescript
import { createSafetyFilter } from '@yh-ui/ai-sdk'
const filter = createSafetyFilter({
rules: [
// Content filter: Block personal information
{
id: 'no-personal-info',
name: 'No Personal Information',
type: 'content_filter',
pattern: /\b\d{3}-\d{4}-\d{4}\b/, // Phone number
action: 'block'
},
// Output filter: Custom check
{
id: 'custom-check',
name: 'Custom Check',
type: 'output_filter',
customCheck: (content) => !content.includes('sensitive word'),
action: 'warn'
}
]
})
// Check input
const inputResult = await filter.check('User input content')
if (!inputResult.passed) {
console.log('Violation:', inputResult.violations)
}
// Check output
const outputResult = await filter.check(modelOutput)Document Loaders
typescript
import { createDocumentLoader } from '@yh-ui/ai-sdk'
// Support multiple formats
const loader = createDocumentLoader({
type: 'pdf', // pdf | markdown | txt | docx | html
extractImages: true,
maxPages: 100
})
const docs = await loader.load('https://example.com/document.pdf')TIP
These features are under active development and APIs may change. Use with caution in production environments.