port ai crate to ai2, with all tests passing
This commit is contained in:
parent
204aba07f6
commit
04ab68502b
22 changed files with 1930 additions and 0 deletions
16
crates/ai2/src/models.rs
Normal file
16
crates/ai2/src/models.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
pub enum TruncationDirection {
|
||||
Start,
|
||||
End,
|
||||
}
|
||||
|
||||
pub trait LanguageModel {
|
||||
fn name(&self) -> String;
|
||||
fn count_tokens(&self, content: &str) -> anyhow::Result<usize>;
|
||||
fn truncate(
|
||||
&self,
|
||||
content: &str,
|
||||
length: usize,
|
||||
direction: TruncationDirection,
|
||||
) -> anyhow::Result<String>;
|
||||
fn capacity(&self) -> anyhow::Result<usize>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue