mirror of
https://github.com/katanemo/plano.git
synced 2026-05-15 11:02:39 +02:00
Update chatbot UI and update hallucination check (#218)
* update chatbot UI * Update docker-compose for demos * Fix bugs * fix for emtadata (#219) * fix for emtadata * fix * revert * merge main --------- Co-authored-by: CTran <cotran2@utexas.edu>
This commit is contained in:
parent
05f0491f76
commit
5f3aff4922
9 changed files with 129 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use common::{
|
||||
common_types::open_ai::Message,
|
||||
consts::{ARCH_MODEL_PREFIX, ASSISTANT_ROLE, USER_ROLE},
|
||||
consts::{ARCH_MODEL_PREFIX, USER_ROLE, HALLUCINATION_TEMPLATE},
|
||||
};
|
||||
|
||||
pub fn extract_messages_for_hallucination(messages: &Vec<Message>) -> Vec<String> {
|
||||
|
|
@ -18,9 +18,11 @@ pub fn extract_messages_for_hallucination(messages: &Vec<Message>) -> Vec<String
|
|||
for message in messages.iter().rev() {
|
||||
if let Some(model) = message.model.as_ref() {
|
||||
if !model.starts_with(ARCH_MODEL_PREFIX) {
|
||||
if message.role == ASSISTANT_ROLE {
|
||||
break;
|
||||
}
|
||||
if let Some(content) = &message.content {
|
||||
if !content.starts_with(HALLUCINATION_TEMPLATE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if message.role == USER_ROLE {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue