model-gateway-rs 0.2.6

A Rust library for model gateway services, providing traits and SDKs for various AI models.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub mod chat_completions;
pub mod doubao;
pub mod ollama;

use async_trait::async_trait;
use toolcraft_request::ByteStream;

use crate::{
    error::Result,
    model::llm::{LlmInput, LlmOutput},
};

#[async_trait]
pub trait Llm {
    async fn chat_once(&self, input: LlmInput) -> Result<LlmOutput>;
    async fn chat_stream(&self, input: LlmInput) -> Result<ByteStream>;
}