@docsearch/react 4.5.0-beta.1 → 4.5.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,8 +106,9 @@ type AskAiSearchParameters = {
106
106
  filters?: string;
107
107
  attributesToRetrieve?: string[];
108
108
  restrictSearchableAttributes?: string[];
109
- distinct?: boolean;
109
+ distinct?: boolean | number | string;
110
110
  };
111
+ type AgentStudioSearchParameters = Record<string, Omit<AskAiSearchParameters, 'facetFilters'>>;
111
112
  type DocSearchAskAi = {
112
113
  /**
113
114
  * The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
@@ -128,10 +129,6 @@ type DocSearchAskAi = {
128
129
  * The assistant ID to use for the ask AI feature.
129
130
  */
130
131
  assistantId: string;
131
- /**
132
- * The search parameters to use for the ask AI feature.
133
- */
134
- searchParameters?: AskAiSearchParameters;
135
132
  /**
136
133
  * Enables displaying suggested questions on Ask AI's new conversation screen.
137
134
  *
@@ -139,7 +136,39 @@ type DocSearchAskAi = {
139
136
  */
140
137
  suggestedQuestions?: boolean;
141
138
  useStagingEnv?: boolean;
142
- };
139
+ } & ({
140
+ /**
141
+ * **Experimental:** Whether to use Agent Studio as the chat backend.
142
+ *
143
+ * This is an experimental feature and its API may change without notice in future releases.
144
+ * Use with caution in production environments.
145
+ *
146
+ * @default false
147
+ */
148
+ agentStudio?: never;
149
+ /**
150
+ * The search parameters to use for the ask AI feature.
151
+ *
152
+ * **NOTE**: If using `agentStudio = true`, the `searchParameters` object is
153
+ * keyed by the index name.
154
+ */
155
+ searchParameters?: AskAiSearchParameters;
156
+ } | {
157
+ agentStudio: false;
158
+ searchParameters?: AskAiSearchParameters;
159
+ } | {
160
+ agentStudio: true;
161
+ /**
162
+ * The search parameters to use for the ask AI feature.
163
+ * Keyed by the index name.
164
+ *
165
+ * @example
166
+ * {
167
+ * "INDEX_NAME": { distinct: false }
168
+ * }
169
+ */
170
+ searchParameters?: AgentStudioSearchParameters;
171
+ });
143
172
  interface DocSearchIndex {
144
173
  name: string;
145
174
  searchParameters?: SearchParamsObject;
@@ -176,15 +205,6 @@ interface DocSearchProps {
176
205
  * Useful to route Ask AI into a different UI (e.g. `@docsearch/sidepanel-js`) without flicker.
177
206
  */
178
207
  interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
179
- /**
180
- * **Experimental:** Whether to use Agent Studio as the chat backend.
181
- *
182
- * This is an experimental feature and its API may change without notice in future releases.
183
- * Use with caution in production environments.
184
- *
185
- * @default false
186
- */
187
- agentStudio?: boolean;
188
208
  /**
189
209
  * Theme overrides applied to the modal and related components.
190
210
  */
@@ -422,7 +442,7 @@ type DocSearchModalProps = DocSearchProps & {
422
442
  translations?: ModalTranslations;
423
443
  isHybridModeSupported?: boolean;
424
444
  };
425
- declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, interceptAskAiEvent, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, isHybridModeSupported, agentStudio, ...props }: DocSearchModalProps): JSX.Element;
445
+ declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, interceptAskAiEvent, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, isHybridModeSupported, ...props }: DocSearchModalProps): JSX.Element;
426
446
 
427
447
  export { DocSearchModal };
428
448
  export type { DocSearchModalProps, ModalTranslations };