mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-03 18:08:58 +02:00
More intuitive search settings interfaces (#2899)
* clearer search settings interfaces * nits
This commit is contained in:
@@ -90,9 +90,10 @@ const RerankingDetailsForm = forwardRef<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-2 rounded-lg max-w-4xl mx-auto">
|
<div className="p-2 rounded-lg max-w-4xl mx-auto">
|
||||||
<h2 className="text-2xl font-bold mb-4 text-text-800">
|
<p className="mb-4">
|
||||||
Post-processing
|
Select from cloud, self-hosted models, or use no reranking
|
||||||
</h2>
|
model.
|
||||||
|
</p>
|
||||||
<div className="text-sm mr-auto mb-6 divide-x-2 flex">
|
<div className="text-sm mr-auto mb-6 divide-x-2 flex">
|
||||||
{originalRerankingDetails.rerank_model_name && (
|
{originalRerankingDetails.rerank_model_name && (
|
||||||
<button
|
<button
|
||||||
|
@@ -21,11 +21,6 @@ export enum RerankerProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AdvancedSearchConfiguration {
|
export interface AdvancedSearchConfiguration {
|
||||||
model_name: string;
|
|
||||||
model_dim: number;
|
|
||||||
normalize: boolean;
|
|
||||||
query_prefix: string;
|
|
||||||
passage_prefix: string;
|
|
||||||
index_name: string | null;
|
index_name: string | null;
|
||||||
multipass_indexing: boolean;
|
multipass_indexing: boolean;
|
||||||
multilingual_expansion: string[];
|
multilingual_expansion: string[];
|
||||||
|
@@ -4,7 +4,11 @@ import * as Yup from "yup";
|
|||||||
import { TrashIcon } from "@/components/icons/icons";
|
import { TrashIcon } from "@/components/icons/icons";
|
||||||
import { FaPlus } from "react-icons/fa";
|
import { FaPlus } from "react-icons/fa";
|
||||||
import { AdvancedSearchConfiguration } from "../interfaces";
|
import { AdvancedSearchConfiguration } from "../interfaces";
|
||||||
import { BooleanFormField } from "@/components/admin/connectors/Field";
|
import {
|
||||||
|
BooleanFormField,
|
||||||
|
Label,
|
||||||
|
SubLabel,
|
||||||
|
} from "@/components/admin/connectors/Field";
|
||||||
import NumberInput from "../../connectors/[connector]/pages/ConnectorInput/NumberInput";
|
import NumberInput from "../../connectors/[connector]/pages/ConnectorInput/NumberInput";
|
||||||
|
|
||||||
interface AdvancedEmbeddingFormPageProps {
|
interface AdvancedEmbeddingFormPageProps {
|
||||||
@@ -21,9 +25,6 @@ const AdvancedEmbeddingFormPage = forwardRef<
|
|||||||
>(({ updateAdvancedEmbeddingDetails, advancedEmbeddingDetails }, ref) => {
|
>(({ updateAdvancedEmbeddingDetails, advancedEmbeddingDetails }, ref) => {
|
||||||
return (
|
return (
|
||||||
<div className="py-4 rounded-lg max-w-4xl px-4 mx-auto">
|
<div className="py-4 rounded-lg max-w-4xl px-4 mx-auto">
|
||||||
<h2 className="text-2xl font-bold mb-4 text-text-800">
|
|
||||||
Advanced Configuration
|
|
||||||
</h2>
|
|
||||||
<Formik
|
<Formik
|
||||||
innerRef={ref}
|
innerRef={ref}
|
||||||
initialValues={advancedEmbeddingDetails}
|
initialValues={advancedEmbeddingDetails}
|
||||||
@@ -52,6 +53,9 @@ const AdvancedEmbeddingFormPage = forwardRef<
|
|||||||
<FieldArray name="multilingual_expansion">
|
<FieldArray name="multilingual_expansion">
|
||||||
{({ push, remove }) => (
|
{({ push, remove }) => (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
|
<Label>Multi-lingual Expansion</Label>
|
||||||
|
|
||||||
|
<SubLabel>Add additional languages to the search.</SubLabel>
|
||||||
{values.multilingual_expansion.map(
|
{values.multilingual_expansion.map(
|
||||||
(_: any, index: number) => (
|
(_: any, index: number) => (
|
||||||
<div key={index} className="w-full flex mb-4">
|
<div key={index} className="w-full flex mb-4">
|
||||||
|
@@ -33,11 +33,6 @@ export default function EmbeddingForm() {
|
|||||||
|
|
||||||
const [advancedEmbeddingDetails, setAdvancedEmbeddingDetails] =
|
const [advancedEmbeddingDetails, setAdvancedEmbeddingDetails] =
|
||||||
useState<AdvancedSearchConfiguration>({
|
useState<AdvancedSearchConfiguration>({
|
||||||
model_name: "",
|
|
||||||
model_dim: 0,
|
|
||||||
normalize: false,
|
|
||||||
query_prefix: "",
|
|
||||||
passage_prefix: "",
|
|
||||||
index_name: "",
|
index_name: "",
|
||||||
multipass_indexing: true,
|
multipass_indexing: true,
|
||||||
multilingual_expansion: [],
|
multilingual_expansion: [],
|
||||||
@@ -109,11 +104,6 @@ export default function EmbeddingForm() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchSettings) {
|
if (searchSettings) {
|
||||||
setAdvancedEmbeddingDetails({
|
setAdvancedEmbeddingDetails({
|
||||||
model_name: searchSettings.model_name,
|
|
||||||
model_dim: searchSettings.model_dim,
|
|
||||||
normalize: searchSettings.normalize,
|
|
||||||
query_prefix: searchSettings.query_prefix,
|
|
||||||
passage_prefix: searchSettings.passage_prefix,
|
|
||||||
index_name: searchSettings.index_name,
|
index_name: searchSettings.index_name,
|
||||||
multipass_indexing: searchSettings.multipass_indexing,
|
multipass_indexing: searchSettings.multipass_indexing,
|
||||||
multilingual_expansion: searchSettings.multilingual_expansion,
|
multilingual_expansion: searchSettings.multilingual_expansion,
|
||||||
@@ -263,8 +253,8 @@ export default function EmbeddingForm() {
|
|||||||
// This is a cloud model
|
// This is a cloud model
|
||||||
newModel = {
|
newModel = {
|
||||||
...selectedProvider,
|
...selectedProvider,
|
||||||
...rerankingDetails,
|
|
||||||
...advancedEmbeddingDetails,
|
...advancedEmbeddingDetails,
|
||||||
|
...rerankingDetails,
|
||||||
provider_type:
|
provider_type:
|
||||||
(selectedProvider.provider_type
|
(selectedProvider.provider_type
|
||||||
?.toLowerCase()
|
?.toLowerCase()
|
||||||
@@ -274,8 +264,8 @@ export default function EmbeddingForm() {
|
|||||||
// This is a locally hosted model
|
// This is a locally hosted model
|
||||||
newModel = {
|
newModel = {
|
||||||
...selectedProvider,
|
...selectedProvider,
|
||||||
...rerankingDetails,
|
|
||||||
...advancedEmbeddingDetails,
|
...advancedEmbeddingDetails,
|
||||||
|
...rerankingDetails,
|
||||||
provider_type: null,
|
provider_type: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -388,6 +378,16 @@ export default function EmbeddingForm() {
|
|||||||
|
|
||||||
{formStep == 1 && (
|
{formStep == 1 && (
|
||||||
<>
|
<>
|
||||||
|
<h2 className="text-2xl font-bold mb-4 text-text-800">
|
||||||
|
Select a Reranking Model
|
||||||
|
</h2>
|
||||||
|
<Text className="mb-4">
|
||||||
|
Updating the reranking model does not require re-indexing
|
||||||
|
documents. The reranker helps improve search quality by reordering
|
||||||
|
results after the initial embedding search. Changes will take
|
||||||
|
effect immediately for all new searches.
|
||||||
|
</Text>
|
||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
<RerankingDetailsForm
|
<RerankingDetailsForm
|
||||||
setModelTab={setModelTab}
|
setModelTab={setModelTab}
|
||||||
@@ -429,6 +429,14 @@ export default function EmbeddingForm() {
|
|||||||
)}
|
)}
|
||||||
{formStep == 2 && (
|
{formStep == 2 && (
|
||||||
<>
|
<>
|
||||||
|
<h2 className="text-2xl font-bold mb-4 text-text-800">
|
||||||
|
Advanced Search Configuration
|
||||||
|
</h2>
|
||||||
|
<Text className="mb-4">
|
||||||
|
Configure advanced embedding and search settings. Changes will
|
||||||
|
require re-indexing documents.
|
||||||
|
</Text>
|
||||||
|
|
||||||
<Card>
|
<Card>
|
||||||
<AdvancedEmbeddingFormPage
|
<AdvancedEmbeddingFormPage
|
||||||
advancedEmbeddingDetails={advancedEmbeddingDetails}
|
advancedEmbeddingDetails={advancedEmbeddingDetails}
|
||||||
|
@@ -809,7 +809,6 @@ export function ChatPage({
|
|||||||
|
|
||||||
// Check if all messages are currently rendered
|
// Check if all messages are currently rendered
|
||||||
if (currentVisibleRange.end < messageHistory.length) {
|
if (currentVisibleRange.end < messageHistory.length) {
|
||||||
console.log("Updating visible range");
|
|
||||||
// Update visible range to include the last messages
|
// Update visible range to include the last messages
|
||||||
updateCurrentVisibleRange({
|
updateCurrentVisibleRange({
|
||||||
start: Math.max(
|
start: Math.max(
|
||||||
|
@@ -33,10 +33,6 @@ export function CustomEmbeddingModelForm({
|
|||||||
api_url: provider.api_url,
|
api_url: provider.api_url,
|
||||||
description: "",
|
description: "",
|
||||||
index_name: "",
|
index_name: "",
|
||||||
pricePerMillion: 0,
|
|
||||||
mtebScore: 0,
|
|
||||||
maxContext: 4096,
|
|
||||||
max_tokens: 1024,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
validationSchema={Yup.object().shape({
|
validationSchema={Yup.object().shape({
|
||||||
@@ -51,13 +47,8 @@ export function CustomEmbeddingModelForm({
|
|||||||
api_url: Yup.string().required("API base URL is required"),
|
api_url: Yup.string().required("API base URL is required"),
|
||||||
description: Yup.string(),
|
description: Yup.string(),
|
||||||
index_name: Yup.string().nullable(),
|
index_name: Yup.string().nullable(),
|
||||||
pricePerMillion: Yup.number(),
|
|
||||||
mtebScore: Yup.number(),
|
|
||||||
maxContext: Yup.number(),
|
|
||||||
max_tokens: Yup.number(),
|
|
||||||
})}
|
})}
|
||||||
onSubmit={async (values) => {
|
onSubmit={async (values) => {
|
||||||
console.log(values);
|
|
||||||
setShowTentativeModel(values as CloudEmbeddingModel);
|
setShowTentativeModel(values as CloudEmbeddingModel);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@@ -58,17 +58,10 @@ export interface EmbeddingModelDescriptor {
|
|||||||
|
|
||||||
export interface CloudEmbeddingModel extends EmbeddingModelDescriptor {
|
export interface CloudEmbeddingModel extends EmbeddingModelDescriptor {
|
||||||
pricePerMillion: number;
|
pricePerMillion: number;
|
||||||
enabled?: boolean;
|
|
||||||
mtebScore: number;
|
|
||||||
maxContext: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HostedEmbeddingModel extends EmbeddingModelDescriptor {
|
export interface HostedEmbeddingModel extends EmbeddingModelDescriptor {
|
||||||
link?: string;
|
link?: string;
|
||||||
model_dim: number;
|
|
||||||
normalize: boolean;
|
|
||||||
query_prefix: string;
|
|
||||||
passage_prefix: string;
|
|
||||||
isDefault?: boolean;
|
isDefault?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,9 +190,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
description:
|
description:
|
||||||
"Cohere's English embedding model. Good performance for English-language tasks.",
|
"Cohere's English embedding model. Good performance for English-language tasks.",
|
||||||
pricePerMillion: 0.1,
|
pricePerMillion: 0.1,
|
||||||
mtebScore: 64.5,
|
|
||||||
maxContext: 512,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 1024,
|
model_dim: 1024,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
@@ -214,9 +204,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
description:
|
description:
|
||||||
"Cohere's lightweight English embedding model. Faster and more efficient for simpler tasks.",
|
"Cohere's lightweight English embedding model. Faster and more efficient for simpler tasks.",
|
||||||
pricePerMillion: 0.1,
|
pricePerMillion: 0.1,
|
||||||
mtebScore: 62,
|
|
||||||
maxContext: 512,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 384,
|
model_dim: 384,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
@@ -247,9 +234,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
passage_prefix: "",
|
passage_prefix: "",
|
||||||
mtebScore: 64.6,
|
|
||||||
maxContext: 8191,
|
|
||||||
enabled: false,
|
|
||||||
index_name: "",
|
index_name: "",
|
||||||
api_key: null,
|
api_key: null,
|
||||||
api_url: null,
|
api_url: null,
|
||||||
@@ -264,9 +248,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
description:
|
description:
|
||||||
"OpenAI's newer, more efficient embedding model. Good balance of performance and cost.",
|
"OpenAI's newer, more efficient embedding model. Good balance of performance and cost.",
|
||||||
pricePerMillion: 0.02,
|
pricePerMillion: 0.02,
|
||||||
enabled: false,
|
|
||||||
mtebScore: 62.3,
|
|
||||||
maxContext: 8191,
|
|
||||||
index_name: "",
|
index_name: "",
|
||||||
api_key: null,
|
api_key: null,
|
||||||
api_url: null,
|
api_url: null,
|
||||||
@@ -290,9 +271,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
model_name: "text-embedding-004",
|
model_name: "text-embedding-004",
|
||||||
description: "Google's most recent text embedding model.",
|
description: "Google's most recent text embedding model.",
|
||||||
pricePerMillion: 0.025,
|
pricePerMillion: 0.025,
|
||||||
mtebScore: 66.31,
|
|
||||||
maxContext: 2048,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 768,
|
model_dim: 768,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
@@ -306,9 +284,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
model_name: "textembedding-gecko@003",
|
model_name: "textembedding-gecko@003",
|
||||||
description: "Google's Gecko embedding model. Powerful and efficient.",
|
description: "Google's Gecko embedding model. Powerful and efficient.",
|
||||||
pricePerMillion: 0.025,
|
pricePerMillion: 0.025,
|
||||||
mtebScore: 66.31,
|
|
||||||
maxContext: 2048,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 768,
|
model_dim: 768,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
@@ -335,9 +310,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
description:
|
description:
|
||||||
"Voyage's large embedding model. High performance with instruction fine-tuning.",
|
"Voyage's large embedding model. High performance with instruction fine-tuning.",
|
||||||
pricePerMillion: 0.12,
|
pricePerMillion: 0.12,
|
||||||
mtebScore: 68.28,
|
|
||||||
maxContext: 4000,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 1024,
|
model_dim: 1024,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
@@ -352,9 +324,6 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
|
|||||||
description:
|
description:
|
||||||
"Voyage's lightweight embedding model. Good balance of performance and efficiency.",
|
"Voyage's lightweight embedding model. Good balance of performance and efficiency.",
|
||||||
pricePerMillion: 0.12,
|
pricePerMillion: 0.12,
|
||||||
mtebScore: 67.13,
|
|
||||||
maxContext: 16000,
|
|
||||||
enabled: false,
|
|
||||||
model_dim: 1024,
|
model_dim: 1024,
|
||||||
normalize: false,
|
normalize: false,
|
||||||
query_prefix: "",
|
query_prefix: "",
|
||||||
|
Reference in New Issue
Block a user