inklings 0.1.0

A unified Rust API for various Large Language Model (LLM) providers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use futures::Stream;
use std::pin::Pin;
mod openai;
mod anthropic;
mod mock;

pub use openai::OpenAIProvider;
pub use anthropic::AnthropicProvider;
pub use mock::MockProvider;

#[async_trait::async_trait]
pub trait Provider {
    async fn complete(&self, prompt: &str) -> Result<String, crate::types::Error>;
    async fn chat(&self, messages: Vec<crate::types::Message>) -> Result<String, crate::types::Error>;
    async fn stream_chat(&self, messages: Vec<crate::types::Message>) -> Result<Pin<Box<dyn Stream<Item = Result<String, crate::types::Error>> + Send>>, crate::types::Error>;
}