Skip to content

Commit 10e6946

Browse files
committed
refactor(settings): update embedding model handling and clean up dataset settings form
1 parent 2b3b45a commit 10e6946

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

frontends/dashboard/src/components/dataset-settings/GeneralSettings.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export const GeneralServerSettings = (props: {
1414
}) => {
1515
return (
1616
<form class="flex flex-col gap-3">
17-
{/* General LLM Settings */}
18-
1917
{/* Embedding Settings */}
2018
<div
2119
class="rounded-md border shadow sm:overflow-hidden"
@@ -35,7 +33,7 @@ export const GeneralServerSettings = (props: {
3533
<div class="col-span-4 space-y-1 sm:col-span-2">
3634
<div class="flex items-center">
3735
<label
38-
for="embeddingSize"
36+
for="embeddingModel"
3937
class="mr-2 block text-sm font-medium leading-6"
4038
>
4139
Embedding Model
@@ -46,11 +44,11 @@ export const GeneralServerSettings = (props: {
4644
/>
4745
</div>
4846
<select
49-
id="embeddingSize"
47+
id="embeddingModel"
5048
aria-readonly
5149
title="Embedding Model is only editable on creation"
5250
disabled
53-
name="embeddingSize"
51+
name="embeddingModel"
5452
class="col-span-2 block w-full cursor-not-allowed rounded-md border-[0.5px] border-neutral-300 bg-white px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
5553
value={
5654
availableEmbeddingModels.find(
@@ -68,7 +66,7 @@ export const GeneralServerSettings = (props: {
6866
<div class="col-span-4 space-y-1 sm:col-span-2">
6967
<div class="flex items-center">
7068
<label
71-
for="embeddingSize"
69+
for="embeddingQueryPrefix"
7270
class="mr-2 block text-sm font-medium leading-6"
7371
>
7472
Embedding Query Prefix
@@ -98,7 +96,7 @@ export const GeneralServerSettings = (props: {
9896
<div class="col-span-4 space-y-1 sm:col-span-2">
9997
<div class="flex items-center">
10098
<label
101-
for="embeddingSize"
99+
for="rerankerModel"
102100
class="mr-2 block text-sm font-medium leading-6"
103101
>
104102
Reranker Model
@@ -176,7 +174,7 @@ export const GeneralServerSettings = (props: {
176174
<div class="col-span-4 space-y-1 sm:col-span-2">
177175
<div class="flex items-center">
178176
<label
179-
for="embeddingSize"
177+
for="distanceMetric"
180178
class="mr-2 block text-sm font-medium leading-6"
181179
>
182180
Distance Metric
@@ -187,11 +185,11 @@ export const GeneralServerSettings = (props: {
187185
/>
188186
</div>
189187
<select
190-
id="embeddingSize"
188+
id="distanceMetric"
191189
aria-readonly
192190
title="Embedding Model is only editable on creation"
193191
disabled
194-
name="embeddingSize"
192+
name="distanceMetric"
195193
class="col-span-2 block w-full cursor-not-allowed rounded-md border-[0.5px] border-neutral-300 bg-white px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
196194
value={
197195
availableDistanceMetrics.find(
@@ -398,7 +396,7 @@ export const GeneralServerSettings = (props: {
398396
/>
399397
<div class="flex items-center">
400398
<label
401-
for="embeddingSize"
399+
for="indexedOnly"
402400
class="mr-2 block text-sm font-medium leading-6"
403401
>
404402
Indexed Only
@@ -427,7 +425,7 @@ export const GeneralServerSettings = (props: {
427425
/>
428426
<div class="flex items-center">
429427
<label
430-
for="embeddingSize"
428+
for="qdrantOnly"
431429
class="mr-2 block text-sm font-medium leading-6"
432430
>
433431
Qdrant Only

server/src/data/models.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,12 +2808,25 @@ impl From<DatasetConfigurationDTO> for DatasetConfiguration {
28082808
RERANKER_API_KEY: dto.RERANKER_API_KEY.unwrap_or("".to_string()),
28092809
RERANKER_MODEL_NAME: dto.RERANKER_MODEL_NAME.unwrap_or("bge-reranker-large".to_string()),
28102810
EMBEDDING_BASE_URL: dto.EMBEDDING_BASE_URL.unwrap_or("https://embedding.trieve.ai".to_string()),
2811-
EMBEDDING_MODEL_NAME: dto.EMBEDDING_MODEL_NAME.unwrap_or("jina-base-en".to_string()),
2811+
EMBEDDING_MODEL_NAME: dto.EMBEDDING_MODEL_NAME.clone().unwrap_or("jina-base-en".to_string()),
28122812
RERANKER_BASE_URL: dto.RERANKER_BASE_URL.unwrap_or("".to_string()),
28132813
MESSAGE_TO_QUERY_PROMPT: dto.MESSAGE_TO_QUERY_PROMPT.unwrap_or("Write a 1-2 sentence semantic search query along the lines of a hypothetical response to: \n\n".to_string()),
28142814
RAG_PROMPT: dto.RAG_PROMPT.unwrap_or("Use the following retrieved documents to respond briefly and accurately:".to_string()),
28152815
N_RETRIEVALS_TO_INCLUDE: dto.N_RETRIEVALS_TO_INCLUDE.unwrap_or(8),
2816-
EMBEDDING_SIZE: dto.EMBEDDING_SIZE.unwrap_or(768),
2816+
EMBEDDING_SIZE: if let Some(embedding_size) = dto.EMBEDDING_SIZE {
2817+
embedding_size
2818+
} else if let Some(embedding_model_name) = dto.EMBEDDING_MODEL_NAME {
2819+
match embedding_model_name.as_str() {
2820+
"text-embedding-3-small" => 1536,
2821+
"text-embedding-3-large" => 3072,
2822+
"bge-m3" => 1024,
2823+
"jina-embeddings-v2-base-code" => 768,
2824+
"jina-base-en" => 768,
2825+
_ => 768,
2826+
}
2827+
} else {
2828+
768
2829+
},
28172830
DISTANCE_METRIC: dto.DISTANCE_METRIC.unwrap_or(DistanceMetric::Cosine),
28182831
LLM_DEFAULT_MODEL: dto.LLM_DEFAULT_MODEL.unwrap_or("gpt-4o".to_string()),
28192832
BM25_ENABLED: dto.BM25_ENABLED.unwrap_or(true),

server/src/operators/dataset_operator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ pub async fn clear_dataset_query(
488488

489489
let chunk_groups = chunk_group::chunk_group
490490
.filter(chunk_group::dataset_id.eq(id))
491+
.filter(chunk_group::created_at.le(deleted_at))
491492
.select(chunk_group::id)
492493
.load::<uuid::Uuid>(&mut conn)
493494
.await
@@ -585,6 +586,10 @@ pub async fn clear_dataset_query(
585586
delete_points_from_qdrant(qdrant_point_ids, qdrant_collection.clone())
586587
.await
587588
.map_err(|err| {
589+
log::error!(
590+
"Could not delete points in current batch from qdrant: {}",
591+
err
592+
);
588593
ServiceError::BadRequest(format!(
589594
"Could not delete points in current batch from qdrant: {}",
590595
err

0 commit comments

Comments
 (0)