AiBrow
  • Welcome
  • AiBrow web API
    • Getting started
    • Feature comparison
  • AiBrow Extension
    • Getting started
    • Web polyfill
    • Helping users install the AiBrow extension
    • Remove the on-device helper or models
  • Examples
    • CoreModel API
    • Embedding API
    • LanguageDetector API
    • LanguageModel API
    • Rewriter API
    • Summarizer API
    • Translator API
    • Writer API
    • Using different models
    • Model download feedback
    • Getting JSON output
  • API Reference
    • AI
      • AiBrowAI
      • BrowserAI
      • WebAI
    • AiBrow
      • CoreModelFactory
        • CoreModel
        • CoreModelCapabilities
      • EmbeddingFactory
        • Embedding
        • EmbeddingCapabilities
      • LanguageDetectorFactory
        • LanguageDetector
        • LanguageDectectorCapabilities
      • LanguageModelFactory
        • LanguageModel
        • LanguageModelCapabilities
      • RewriterFactory
        • Rewriter
        • RewriterCapabilities
      • SummarizerFactory
        • Summarizer
        • SummarizerCapabilities
      • TranslatorFactory
        • Translator
        • TranslatorCapabilities
      • WriterFactory
        • Writer
        • WriterCapabilities
    • Types
      • AICapabilityAvailability
      • AICapabilityGpuEngine
      • AICreateMonitor
      • AILanguageDetectorDetectResult
      • AIRewriterFormat
      • AIRewriterLength
      • AIRewriterTone
      • AISummarizerFormat
      • AISummarizerLength
      • AISummarizerType
      • AIWriterFormat
      • AIWriterLength
      • AIWriterTone
      • AIModelDtype
    • Models
Powered by GitBook
On this page
  • Properties
  • topK
  • topP
  • temperature
  • repeatPenality
  • flashAttention
  • contextSize
  • grammar extension
  • maxTokens
  • tokensSoFar
  • tokensLeft
  • Methods
  • prompt
  • promptStreaming
  • countPromptTokens
  1. API Reference
  2. AiBrow
  3. LanguageModelFactory

LanguageModel

Properties

topK

number

topP

number

temperature

number

repeatPenality

number

flashAttention

boolean

contextSize

number

grammar extension

any

maxTokens

number

tokensSoFar

number

tokensLeft

number


Methods

prompt

async (input, options) => string

promptStreaming

(input, options) => ReadableStream

This prompts the language model with a continuation of the conversation. Internally, the input is appended to the set of messages in the language model's context window. Older messages outside of the language model's context window are automatically discarded.

Input

Either a string, single prompt or array of prompts such as

Options (optional)

signal optional AbortSignal

Returns a readable stream that updates each time new tokens are available from the language model

countPromptTokens

async (input, options) => number

Input

Either a string, single prompt or array of prompts such as

Options (Optional)

signal? AbortSignal

PreviousLanguageModelFactoryNextLanguageModelCapabilities

Last updated 3 months ago

See

[
  { content: "The prompt content", role: "user" },
  { content: "The prompt content", role: "assistant" }
]
[
  { content: "The prompt content", role: "user" },
  { content: "The prompt content", role: "assistant" }
]
promptStreaming