Files
aha/src/models/mod.rs
T

15 lines
610 B
Rust
Raw Normal View History

2025-09-22 16:38:12 +08:00
pub mod qwen2_5vl;
use anyhow::Result;
use candle_core::{DType, Device};
2025-09-22 23:49:58 +08:00
use openai_dive::v1::resources::chat::{ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse};
use rocket::futures::Stream;
2025-09-22 16:38:12 +08:00
pub trait GenerateModel {
fn init(path: &str, device: Option<&Device>, dtype: Option<DType>) -> Result<Self>
where
Self: Sized;
2025-09-22 23:49:58 +08:00
fn generate(&mut self, mes: ChatCompletionParameters) -> Result<ChatCompletionResponse>;
fn generate_stream(&mut self, mes: ChatCompletionParameters) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>;
2025-09-22 16:38:12 +08:00
}
2025-09-22 23:49:58 +08:00