Vokturz's picture
feat: Add text generation functionality
2f35054
raw
history blame
2.27 kB
export interface Section {
title: string
items: string[]
}
export interface ClassificationOutput {
sequence: string
labels: string[]
scores: number[]
}
export interface ChatMessage {
role: 'system' | 'user' | 'assistant'
content: string
}
export interface GenerationOutput {
role: 'assistant'
content: string
}
export type WorkerStatus =
| 'initiate'
| 'ready'
| 'output'
| 'loading'
| 'error'
| 'disposed'
export interface WorkerMessage {
status: WorkerStatus
progress?: number
error?: string
output?: any
}
export interface ZeroShotWorkerInput {
text: string
labels: string[]
model: string
}
export interface TextClassificationWorkerInput {
type: 'classify'
text: string
model: string
}
export interface TextGenerationWorkerInput {
type: 'generate'
prompt?: string
messages?: ChatMessage[]
hasChatTemplate: boolean
model: string
temperature?: number
max_new_tokens?: number
top_p?: number
top_k?: number
do_sample?: boolean
}
type q8 = 'q8' | 'int8' | 'bnb8' | 'uint8'
type q4 = 'q4' | 'bnb4' | 'q4f16'
type fp16 = 'fp16'
type fp32 = 'fp32'
export type QuantizationType = q8 | q4 | fp16 | fp32
export interface ModelInfo {
id: string
name: string
architecture: string
parameters: number
likes: number
downloads: number
createdAt: string
isCompatible?: boolean
incompatibilityReason?: string
supportedQuantizations: QuantizationType[]
baseId?: string
readme?: string
hasChatTemplate: boolean
}
export interface ModelInfoResponse {
id: string
createdAt: string
config?: {
architectures: string[]
model_type: string
tokenizer_config?: {
chat_template?: string
}
}
lastModified: string
pipeline_tag: string
tags: string[]
cardData?: {
base_model: string
}
baseId?: string
transformersInfo: {
pipeline_tag: string
auto_model: string
processor: string
}
safetensors?: {
parameters: {
BF16?: number
F16?: number
F32?: number
total?: number
}
}
siblings?: {
rfilename: string
}[]
modelId?: string
isCompatible: boolean
incompatibilityReason?: string
supportedQuantizations: QuantizationType[]
likes: number
downloads: number
readme?: string
}