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:
Shuguang Chen 2024-10-24 14:11:53 -07:00 committed by GitHub
parent 05f0491f76
commit 5f3aff4922
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 129 additions and 34 deletions

View file

@ -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 {