@@ -24,6 +24,7 @@ import {
2424 PriceToolCallOptions ,
2525 RelevanceToolCallOptions ,
2626 SearchToolCallOptions ,
27+ NotFilterToolCallOptions ,
2728} from "trieve-ts-sdk" ;
2829
2930export const defaultRelevanceToolCallOptions : RelevanceToolCallOptions = {
@@ -54,20 +55,28 @@ export const defaultSearchToolCallOptions: SearchToolCallOptions = {
5455 "Call this tool anytime it seems like we need to skip the search step. This tool tells our system that the user is asking about what they were previously shown." ,
5556} ;
5657
58+ export const defaultNotFilterToolCallOptions : NotFilterToolCallOptions = {
59+ userMessageTextPrefix : "Here is the user query:" ,
60+ toolDescription :
61+ "Set to true if the query is not interested in the products they were shown previously or would like to see something different. Ensure that this is only set to true when the user wants to see something different from the previously returned results or is not interested in those previously returned results." ,
62+ } ;
63+
5764interface LLMSettingsProps {
5865 shopDataset : Dataset ;
5966 existingPdpPrompt : string ;
6067 existingRelevanceToolCallOptions : RelevanceToolCallOptions | null ;
6168 existingPriceToolCallOptions : PriceToolCallOptions | null ;
6269 existingSearchToolCallOptions : SearchToolCallOptions | null ;
70+ existingNotFilterToolCallOptions : NotFilterToolCallOptions | null ;
6371}
6472
6573export function LLMSettings ( {
6674 shopDataset,
6775 existingPdpPrompt,
6876 existingRelevanceToolCallOptions,
6977 existingPriceToolCallOptions,
70- existingSearchToolCallOptions
78+ existingSearchToolCallOptions,
79+ existingNotFilterToolCallOptions,
7180} : LLMSettingsProps ) {
7281 const shopify = useAppBridge ( ) ;
7382 const submit = useSubmit ( ) ;
@@ -92,6 +101,10 @@ export function LLMSettings({
92101 existingSearchToolCallOptions ?? defaultSearchToolCallOptions ,
93102 ) ;
94103
104+ const [ notFilterToolCallOptions , setNotFilterToolCallOptions ] = useState (
105+ existingNotFilterToolCallOptions ?? defaultNotFilterToolCallOptions ,
106+ ) ;
107+
95108 const onLLMSettingsSave = async ( ) => {
96109 submit (
97110 {
@@ -114,6 +127,7 @@ export function LLMSettings({
114127 relevance_tool_call_options : JSON . stringify ( relevanceToolCallOptions ) ,
115128 price_tool_call_options : JSON . stringify ( priceToolCallOptions ) ,
116129 search_tool_call_options : JSON . stringify ( searchToolCallOptions ) ,
130+ not_filter_tool_call_options : JSON . stringify ( notFilterToolCallOptions ) ,
117131 dataset_id : shopDataset . id ,
118132 type : "tool_call_options" ,
119133 } ,
@@ -518,6 +532,48 @@ export function LLMSettings({
518532 < Button onClick = { saveToolCallOptions } > Save</ Button >
519533 </ InlineStack >
520534 </ Card >
535+ < Card roundedAbove = "sm" >
536+ < BlockStack gap = "400" >
537+ < FormLayout >
538+ < Text as = "h1" variant = "headingMd" >
539+ Not Filter Tool Configuration
540+ </ Text >
541+ < BlockStack gap = "400" >
542+ < TextField
543+ label = "Tool Description"
544+ helpText = "The description of the tool"
545+ value = { notFilterToolCallOptions . toolDescription ?? "" }
546+ onChange = { ( e ) =>
547+ setNotFilterToolCallOptions ( {
548+ ...notFilterToolCallOptions ,
549+ toolDescription : e ,
550+ } )
551+ }
552+ multiline = { 3 }
553+ autoComplete = "off"
554+ />
555+ < TextField
556+ label = "User Message Text Prefix"
557+ helpText = "The prefix to use before showing the the users message"
558+ value = {
559+ notFilterToolCallOptions . userMessageTextPrefix ?? ""
560+ }
561+ onChange = { ( e ) =>
562+ setNotFilterToolCallOptions ( {
563+ ...notFilterToolCallOptions ,
564+ userMessageTextPrefix : e ,
565+ } )
566+ }
567+ multiline = { 3 }
568+ autoComplete = "off"
569+ />
570+ </ BlockStack >
571+ </ FormLayout >
572+ </ BlockStack >
573+ < InlineStack align = "end" gap = "200" >
574+ < Button onClick = { saveToolCallOptions } > Save</ Button >
575+ </ InlineStack >
576+ </ Card >
521577 </ BlockStack >
522578 </ InlineGrid >
523579 </ BlockStack >
0 commit comments