You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Can be either "semantic", "fulltext", "hybrid, or "bm25". If specified as "hybrid", it will pull in one page of both semantic and full-text results then re-rank them using scores from a cross encoder model. "semantic" will pull in one page of the nearest cosine distant vectors. "fulltext" will pull in one page of full-text results based on SPLADE. "bm25" will get one page of results scored using BM25 with the terms OR'd together.
606
606
pubsearch_type:Option<SearchMethod>,
607
+
/// Type of suggestions. Can be "question", "keyword", or "semantic". If not specified, this defaults to "keyword".
608
+
pubsuggestion_type:Option<SuggestType>,
609
+
/// Context is the context of the query. This can be any string under 15 words and 200 characters. The context will be used to generate the suggested queries. Defaults to None.
610
+
pubcontext:Option<String>,
607
611
/// Filters is a JSON object which can be used to filter chunks. This is useful for when you want to filter chunks by arbitrary metadata. Unlike with tag filtering, there is a performance hit for filtering on metadata.
let query_style = match data.suggestion_type.clone().unwrap_or(SuggestType::Keyword){
764
+
SuggestType::Question => "question",
765
+
SuggestType::Keyword => "keyword",
766
+
SuggestType::Semantic => "semantic while not question",
767
+
};
768
+
let context_sentence = match data.context.clone(){
769
+
Some(context) => {
770
+
if context.split_whitespace().count() > 15 || context.len() > 200{
771
+
returnErr(ServiceError::BadRequest(
772
+
"Context must be under 15 words and 200 characters".to_string(),
773
+
));
774
+
}
775
+
776
+
format!(
777
+
"\n\nSuggest things with the following context in mind: {}.\n\n",
778
+
context
779
+
)
780
+
}
781
+
None => "".to_string(),
782
+
};
783
+
759
784
let content = ChatMessageContent::Text(format!(
760
-
"Here is some context for the dataset for which the user is querying for {}. Generate 10 suggested followup keyword searches based off the domain of this dataset. Your only response should be the 10 followup keyword searches which are separated by new lines and are just text and you do not add any other context or information about the followup keyword searches. This should not be a list, so do not number each keyword search. These followup keyword searches should be related to the domain of the dataset.",
761
-
rag_content
785
+
"Here is some context for the dataset for which the user is querying for {}{}. Generate 10 suggested followup {} style queries based off the domain of this dataset. Your only response should be the 10 followup {} style queries which are separated by new lines and are just text and you do not add any other context or information about the followup {} style queries. This should not be a list, so do not number each {} style queries. These followup {} style queries should be related to the domain of the dataset.",
0 commit comments