-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace legacy LLMDefinition with ModelSpec, move formatters to llama…
… specific as its the only endpoint that only accepts raw inputs
- Loading branch information
Showing
20 changed files
with
195 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ pub mod src { | |
mod chat; | ||
mod defaults; | ||
mod handler; | ||
mod model; | ||
mod server; | ||
mod session; | ||
mod tui; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 52 additions & 6 deletions
58
lumni/src/apps/builtin/llm/prompt/src/chat/conversation/model.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::fmt::Display; | ||
|
||
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ValueRef}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
|
||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] | ||
pub enum PromptRole { | ||
User, | ||
Assistant, | ||
System, | ||
} | ||
|
||
impl PromptRole { | ||
pub fn to_string(&self) -> String { | ||
match self { | ||
PromptRole::User => "user", | ||
PromptRole::Assistant => "assistant", | ||
PromptRole::System => "system", | ||
} | ||
.to_string() | ||
} | ||
} | ||
|
||
impl Display for PromptRole { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{}", self.to_string()) | ||
} | ||
} | ||
|
||
impl FromSql for PromptRole { | ||
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { | ||
match value.as_str()? { | ||
"user" => Ok(PromptRole::User), | ||
"assistant" => Ok(PromptRole::Assistant), | ||
"system" => Ok(PromptRole::System), | ||
_ => Err(FromSqlError::InvalidType.into()), | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.