npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aivue/predictive-input

v1.0.4

Published

AI-powered predictive text input for Vue 3 - Learns writing patterns, suggests complete sentences with context-aware predictions and multi-language support

Downloads

399

Readme

🧠 @aivue/predictive-input

AI-Powered Predictive Text Input for Vue 3

Transform your text inputs with intelligent, AI-powered predictions. Get smart text completions and suggestions powered by your AI provider.

npm version npm downloads License: MIT


✨ Features

🎯 Smart Predictions

  • AI-Powered - Uses AI to generate intelligent text predictions
  • Context-Aware - Understands context for better predictions
  • Text Completion - Suggests complete thoughts and phrases
  • Confidence Scoring - Shows prediction reliability

🤖 AI Integration

  • Multiple Providers - Works with OpenAI, Claude, Gemini, and more
  • Flexible - Use any AI client from @aivue/core
  • Customizable - Configure prediction behavior
  • Real-time - Get predictions as you type

Performance

  • Lightweight - Minimal bundle size
  • Fast - Real-time predictions with debouncing
  • Responsive - Smooth user experience
  • Keyboard Navigation - Full keyboard support

📦 Installation

npm install @aivue/predictive-input

🚀 Quick Start

Basic Usage

<template>
  <div>
    <PredictiveInput
      v-model="text"
      :client="aiClient"
      placeholder="Start typing..."
      @prediction-selected="handlePrediction"
    />
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { PredictiveInput } from '@aivue/predictive-input';
import { createOpenAIClient } from '@aivue/core';
import '@aivue/predictive-input/dist/predictive-input.css';

const text = ref('');

// Create AI client
const aiClient = createOpenAIClient({
  apiKey: import.meta.env.VITE_OPENAI_API_KEY
});

const handlePrediction = (prediction) => {
  console.log('Selected:', prediction.text, 'Confidence:', prediction.confidence);
};
</script>

📖 Components

PredictiveInput

Main input component with AI-powered predictions.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | modelValue | string | '' | Input value (v-model) | | placeholder | string | 'Start typing...' | Placeholder text | | disabled | boolean | false | Disable input | | multiline | boolean | false | Use textarea instead of input | | rows | number | 3 | Rows for textarea | | type | string | 'text' | Input type | | maxPredictions | number | 5 | Maximum predictions to show | | minConfidence | number | 0.1 | Minimum confidence threshold | | suggestionsPosition | 'above' \| 'below' | 'below' | Position of suggestions | | enableTraining | boolean | true | Auto-train on input | | storageKey | string | 'aivue_predictive_input' | LocalStorage key |

Events

| Event | Payload | Description | |-------|---------|-------------| | update:modelValue | string | Emitted when value changes | | prediction-accepted | Prediction | Emitted when prediction is accepted | | training-complete | - | Emitted when training completes |

Keyboard Shortcuts

  • ↑/↓ - Navigate predictions
  • Tab/Enter - Accept selected prediction
  • Esc - Close suggestions

TrainingPanel

Panel for training the AI model with custom text.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | storageKey | string | 'aivue_predictive_input' | LocalStorage key |

Events

| Event | Description | |-------|-------------| | training-complete | Emitted when training completes | | data-cleared | Emitted when data is cleared | | data-imported | Emitted when data is imported |


🎨 Composable API

usePredictiveInput

import { usePredictiveInput } from '@aivue/predictive-input';

const {
  predictions,
  isTraining,
  isTrained,
  train,
  getPredictions,
  updatePredictions,
  clearData,
  exportData,
  importData,
  getStats
} = usePredictiveInput({
  storageKey: 'my_app_predictions',
  autoSave: true,
  enableOffline: true,
  defaultLanguage: 'en'
});

🔧 Advanced Usage

Custom Training

import { usePredictiveInput } from '@aivue/predictive-input';

const { train, isTrained } = usePredictiveInput();

// Train with custom text
const trainingText = `
  Your writing samples here...
  Emails, documents, notes, etc.
`;

await train(trainingText);
console.log('Training complete:', isTrained.value);

Manual Predictions

const { getPredictions } = usePredictiveInput();

const context = {
  previousText: 'Hello, how are',
  currentWord: 'you',
  cursorPosition: 15,
  timestamp: Date.now()
};

const predictions = getPredictions(context);
predictions.forEach(pred => {
  console.log(pred.text, pred.confidence);
});

Data Management

const { exportData, importData, clearData } = usePredictiveInput();

// Export training data
await exportData('my-predictions.json');

// Import from file
const file = event.target.files[0];
await importData(file);

// Clear all data
await clearData();

🎯 Use Cases

📧 Email Composition

  • Learn from past emails
  • Suggest common phrases
  • Speed up writing

📝 Note Taking

  • Personal writing style
  • Context-aware suggestions
  • Faster documentation

💬 Chat Applications

  • Quick responses
  • Consistent tone
  • Reduced typing

📄 Form Filling

  • Common responses
  • Address completion
  • Repeated information

🌟 Why Choose This Package?

| Feature | @aivue/predictive-input | Traditional Autocomplete | |---------|------------------------|-------------------------| | Learning | ✅ Learns your style | ❌ Static dictionary | | Context | ✅ Context-aware | ❌ Word-based only | | Sentences | ✅ Full sentences | ❌ Single words | | Privacy | ✅ 100% local | ⚠️ Often server-based | | Offline | ✅ Works offline | ❌ Needs connection | | Languages | ✅ 6 languages | ⚠️ Limited |


📊 Technical Details

N-Gram Model

  • Unigrams, bigrams, and trigrams
  • Probability-based predictions
  • Efficient pattern matching

Pattern Learning

  • Phrase extraction (2-5 words)
  • Frequency tracking
  • Context association
  • Recency weighting

Storage

  • LocalStorage-based
  • Automatic compression
  • Export/import support
  • Privacy-focused

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


📦 Related Packages

Explore the complete @aivue ecosystem:

🧠 @aivue/core

Core AI functionality for Vue.js components

💬 @aivue/chatbot

AI-powered chat components for Vue.js

@aivue/autosuggest

AI-powered suggestion components for Vue.js

📝 @aivue/smartform

AI-powered form validation for Vue.js

🎭 @aivue/emotion-ui

Emotion-aware UI components with sentiment analysis

📄 @aivue/doc-intelligence

Document processing and OCR with AI

🔔 @aivue/smart-notify

Intelligent notification system

🎤 @aivue/voice-actions

Voice command integration

📋 @aivue/smart-datatable

Advanced data table components

🖼️ @aivue/image-caption

AI-powered image captioning with OpenAI Vision models

📊 @aivue/analytics

AI-powered analytics and insights


📄 License

MIT © reachbrt


🔗 Links


🙏 Acknowledgments

Built with ❤️ using:

  • Vue 3
  • TypeScript
  • Natural (NLP library)
  • Compromise (NLP library)

Made with 🧠 by the @aivue team