Files
aha/src/models/mod.rs
T

24 lines
710 B
Rust
Raw Normal View History

2025-09-25 12:09:25 +08:00
pub mod base_modules;
2025-09-25 12:25:24 +08:00
pub mod minicpm4;
pub mod qwen2_5vl;
2025-09-25 12:09:25 +08:00
2025-09-22 16:38:12 +08:00
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,
2025-09-25 12:25:24 +08:00
) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>
where
Self: Sized;
2025-09-22 16:38:12 +08:00
}