pprog 0.0.6

An LLM pair programming server with web interface
use anyhow::Result;
use async_trait::async_trait;

use crate::chat::CommonMessage;
use super::types::{InferenceError, ModelResponse};

#[async_trait]
pub trait Inference: Send + Sync {
    fn new() -> Self where Self: Sized;
    
    async fn query_model(
        &self, 
        messages: Vec<CommonMessage>, 
        system_message: Option<&str>
    ) -> Result<ModelResponse, InferenceError>;

    async fn get_token_count(
        &self, 
        messages: Vec<CommonMessage>, 
        system_message: Option<&str>
    ) -> Result<u64, InferenceError>;
}