Files
aha/src/models/mod.rs
T

19 lines
639 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:58:08 +08:00
use openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
2025-09-22 23:49:58 +08:00
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>;
2025-09-22 23:58:08 +08:00
fn generate_stream(
&mut self,
mes: ChatCompletionParameters,
) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>;
2025-09-22 16:38:12 +08:00
}