Skip to content

Commit

Permalink
feat(quantic): added relevant generative answering (rga) example in t…
Browse files Browse the repository at this point in the history
…he quantic examples org (#3452)

* initial commit and example setup

* added example for RGA

* added feedback, moved the gen answer component, removed template logic
  • Loading branch information
SimonMilord authored Dec 6, 2023
1 parent 5e753f0 commit b16990e
Show file tree
Hide file tree
Showing 7 changed files with 375 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Styling hooks are not supported by the LWC Local Development Server.
* You can safely comment those out in order to run the code in the Local Dev Server, these are for a11y purpose only.
* Issue opened to Salesforce: https://github.com/forcedotcom/salesforcedx-vscode/issues/4493
*
* These values change the border colors of the checkboxes, text inputs and buttons borders to a higher contrast value
* to better respect accessibility standards.
*/
:host {
--slds-c-checkbox-color-border: var(--lwc-colorTextIconDefault, #747474);
--slds-c-checkbox-color-border-checked: var(--lwc-colorTextIconDefault, #747474);
--slds-c-input-color-border: var(--lwc-colorTextIconDefault, #747474);
--slds-c-button-neutral-color-border: var(--lwc-colorTextIconDefault, #747474);
}


.search__container {
position: relative;
background: #fff;
border-radius: .25rem;
background-clip: padding-box;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<template>
<div
class="search__container slds-p-around_medium"
>
<c-quantic-search-interface
engine-id={engineId}
search-hub={searchHub}
pipeline={pipeline}
disable-state-in-url={disableStateInUrl}
skip-first-search={skipFirstSearch}
>
<c-quantic-aria-live></c-quantic-aria-live>
<div class="slds-grid slds-grid_vertical slds-grid_align-center">
<div
class="slds-col slds-size_1-of-1 slds-large-size_6-of-12 slds-align-middle"
>
<div class="slds-m-vertical_small">
<c-quantic-search-box
engine-id={engineId}
textarea
></c-quantic-search-box>
</div>
</div>
<div class="slds-col">
<div
class="slds-grid slds-gutters_direct slds-wrap main slds-grid_align-center"
>
<div
class="slds-col slds-order_2 slds-large-order_1 slds-size_1-of-1 slds-large-size_3-of-12 facets_container slds-show_large"
>
<c-quantic-facet-manager engine-id={engineId}>
<c-quantic-facet
field="objecttype"
label="Type"
engine-id={engineId}
data-cy="type"
></c-quantic-facet>
<c-quantic-facet
display-values-as="link"
field="filetype"
label="File Type"
engine-id={engineId}
>
<c-quantic-facet-caption
slot="captions"
value="html"
caption="HTML"
></c-quantic-facet-caption>
<c-quantic-facet-caption
slot="captions"
value="txt"
caption="Text file"
></c-quantic-facet-caption>
<c-quantic-facet-caption
slot="captions"
value="pdf"
caption="PDF"
></c-quantic-facet-caption>
<c-quantic-facet-caption
slot="captions"
value="YouTubeVideo"
caption="YouTube Video"
></c-quantic-facet-caption>
</c-quantic-facet>
<c-quantic-numeric-facet
field="ytlikecount"
label="Youtube Likes"
with-input="integer"
engine-id={engineId}
></c-quantic-numeric-facet>
<c-quantic-timeframe-facet
engine-id={engineId}
field="date"
label="Date"
with-date-picker
>
<c-quantic-timeframe unit="week"></c-quantic-timeframe>
<c-quantic-timeframe unit="month"></c-quantic-timeframe>
<c-quantic-timeframe
amount="6"
unit="month"
></c-quantic-timeframe>
<c-quantic-timeframe unit="year"></c-quantic-timeframe>
</c-quantic-timeframe-facet>
<c-quantic-category-facet
with-search
field="geographicalhierarchy"
label="Country"
engine-id={engineId}
></c-quantic-category-facet>
</c-quantic-facet-manager>
</div>
<div
class="slds-col slds-order_1 slds-large-order_2 slds-size_1-of-1 slds-large-size_6-of-12"
>
<c-quantic-tab-bar>
<c-quantic-tab
label="All"
engine-id={engineId}
is-active
></c-quantic-tab>
<c-quantic-tab
label="Articles"
expression="@sfkbid"
engine-id={engineId}
></c-quantic-tab>
<c-quantic-tab
label="Issues"
expression='@jisourcetype AND NOT @jidocumenttype="WorkLog"'
engine-id={engineId}
></c-quantic-tab>
<c-quantic-tab
label="Community"
expression='@objecttype=="Message"'
engine-id={engineId}
></c-quantic-tab>
<c-quantic-tab
label="Files"
expression="@boxdocumenttype==File OR @spcontenttype==Document"
engine-id={engineId}
></c-quantic-tab>
<c-quantic-tab
label="Thread"
expression="@source==iNaturalistTaxons"
engine-id={engineId}
></c-quantic-tab>
</c-quantic-tab-bar>
<div class="slds-var-m-vertical_small">
<c-quantic-generated-answer
engine-id={engineId}
answer-style={answerStyle}
multiline-footer={multilineFooter}
></c-quantic-generated-answer>
</div>
<div class="slds-grid slds-var-m-top_small">
<c-quantic-summary
class="slds-var-m-vertical_x-small slds-small-size_8-of-12 slds-large-size_7-of-12"
engine-id={engineId}
>
</c-quantic-summary>
<c-quantic-sort
class="slds-var-m-vertical_xxx-small slds-large-size_5-of-12 slds-show_large"
engine-id={engineId}
>
</c-quantic-sort>
<div
class="slds-small-size_4-of-12 slds-clearfix slds-hide_large"
>
<div class="slds-float_right">
<c-quantic-refine-toggle
engine-id={engineId}
full-screen
></c-quantic-refine-toggle>
</div>
</div>
</div>
<c-quantic-query-error
engine-id={engineId}
></c-quantic-query-error>
<c-quantic-breadcrumb-manager
engine-id={engineId}
></c-quantic-breadcrumb-manager>
<c-quantic-did-you-mean
engine-id={engineId}
></c-quantic-did-you-mean>
<c-quantic-no-results engine-id={engineId}></c-quantic-no-results>
<div class="slds-var-m-vertical_small">
<c-quantic-smart-snippet
engine-id={engineId}
></c-quantic-smart-snippet>
</div>
<div class="slds-var-m-vertical_small">
<c-quantic-smart-snippet-suggestions
engine-id={engineId}
></c-quantic-smart-snippet-suggestions>
</div>
<c-quantic-folded-result-list
engine-id={engineId}
></c-quantic-folded-result-list>
<div class="slds-var-m-vertical_medium">
<c-quantic-pager engine-id={engineId}></c-quantic-pager>
<c-quantic-results-per-page
engine-id={engineId}
></c-quantic-results-per-page>
</div>
</div>
<div
class="slds-col slds-order_3 slds-large-order_3 slds-size_1-of-1 slds-large-size_3-of-12"
>
<div class="slds-m-bottom_large">
<c-quantic-recent-queries-list
engine-id={engineId}
></c-quantic-recent-queries-list>
</div>
<div class="slds-m-bottom_large">
<c-quantic-recent-results-list
engine-id={engineId}
></c-quantic-recent-results-list>
</div>
</div>
</div>
</div>
</div>
</c-quantic-search-interface>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {LightningElement, api} from 'lwc';

// For the 'genqatest' query pipeline, the following query should yield a relevant generated answer: How to resolve netflix connection with tivo?

export default class ExampleRelevantGenerativeAnswering extends LightningElement {
/** @type {string} */
@api engineId = 'example-relevant-generative-answering';
/** @type {string} */
@api searchHub = 'default';
/** @type {string} */
@api pipeline = 'genqatest';
/** @type {boolean} */
@api disableStateInUrl = false;
/** @type {boolean} */
@api skipFirstSearch = false;
/** @type {string} */
@api answerStyle = 'default';
/** @type {boolean} */
@api multilineFooter = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
</targets>
<targetConfigs>
<targetConfig targets="lightningCommunity__Default">
<property name="engineId" type="String" default="example-relevant-generative-answering" label="Enter Coveo Headless engine ID"/>
<property name="searchHub" type="String" default="default" label="The search interface search hub"/>
<property name="pipeline" type="String" default="genqatest" label="The search interface query pipeline"/>
<property name="disableStateInUrl" type="Boolean" default="false" label="Disable state in URL"/>
<property name="skipFirstSearch" type="Boolean" default="false" label="Skip first search"/>
<property name="answerStyle" type="String" default="default" label="The format style of the generated answer"/>
<property name="multilineFooter" type="Boolean" default="false" label="Display footer sections on multiple lines"/>
</targetConfig>
<targetConfig targets="lightning__AppPage, lightning__RecordPage, lightning__HomePage">
<property name="engineId" type="String" default="example-relevant-generative-answering" label="Enter Coveo Headless engine ID"/>
<property name="searchHub" type="String" default="default" label="The search interface search hub"/>
<property name="pipeline" type="String" default="genqatest" label="The search interface query pipeline"/>
<property name="disableStateInUrl" type="Boolean" default="false" label="Disable state in URL"/>
<property name="skipFirstSearch" type="Boolean" default="false" label="Skip first search"/>
<property name="answerStyle" type="String" default="default" label="The format style of the generated answer"/>
<property name="multilineFooter" type="Boolean" default="false" label="Display footer sections on multiple lines"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"activeViewId": "27d477db-01c7-4f6b-b918-ab4734a27cd5",
"appPageId": "2199ef25-89a9-44a1-ad69-7cb8bd918245",
"configurationTags": [],
"id": "844569ed-fc9d-4a4d-89c1-321ec2b4e977",
"label": "Relevant Generative Answering Example",
"pageAccess": "UseParent",
"routeType": "custom-relevant-generative-answering-example",
"type": "route",
"urlPrefix": "relevant-generative-answering-example"
}
Loading

0 comments on commit b16990e

Please sign in to comment.