@@ -2466,7 +2466,6 @@ pub async fn generate_off_chunks(
2466
2466
} ;
2467
2467
2468
2468
let chunk_ids = data. chunk_ids . clone ( ) ;
2469
- let prompt = data. prompt . clone ( ) ;
2470
2469
let stream_response = data. stream_response ;
2471
2470
let context_options = data. context_options . clone ( ) ;
2472
2471
@@ -2477,8 +2476,8 @@ pub async fn generate_off_chunks(
2477
2476
DatasetConfiguration :: from_json ( dataset_org_plan_sub. dataset . server_configuration ) ;
2478
2477
2479
2478
let base_url = dataset_config. LLM_BASE_URL ;
2480
-
2481
- let default_model = dataset_config. LLM_DEFAULT_MODEL ;
2479
+ let rag_prompt = dataset_config . RAG_PROMPT . clone ( ) ;
2480
+ let chosen_model = dataset_config. LLM_DEFAULT_MODEL ;
2482
2481
2483
2482
let base_url = if base_url. is_empty ( ) {
2484
2483
"https://openrouter.ai/api/v1" . into ( )
@@ -2600,7 +2599,8 @@ pub async fn generate_off_chunks(
2600
2599
2601
2600
let last_prev_message = prev_messages
2602
2601
. last ( )
2603
- . expect ( "There needs to be at least 1 prior message" ) ;
2602
+ . expect ( "There needs to be at least 1 prior message" )
2603
+ . clone ( ) ;
2604
2604
2605
2605
let mut prev_messages = prev_messages. clone ( ) ;
2606
2606
@@ -2610,19 +2610,17 @@ pub async fn generate_off_chunks(
2610
2610
. iter ( )
2611
2611
. for_each ( |message| messages. push ( ChatMessage :: from ( message. clone ( ) ) ) ) ;
2612
2612
2613
- let prompt = prompt. unwrap_or ( "Respond to the question or instruction using the docs and include the doc numbers that you used in square brackets at the end of the sentences that you used the docs for:\n \n " . to_string ( ) ) ;
2614
-
2615
2613
messages. push ( ChatMessage :: User {
2616
2614
content : ChatMessageContent :: Text ( format ! (
2617
2615
"{} {}" ,
2618
- prompt ,
2616
+ rag_prompt ,
2619
2617
last_prev_message. content. clone( )
2620
2618
) ) ,
2621
2619
name : None ,
2622
2620
} ) ;
2623
2621
2624
2622
let parameters = ChatCompletionParameters {
2625
- model : default_model ,
2623
+ model : chosen_model ,
2626
2624
stream : stream_response,
2627
2625
messages,
2628
2626
top_p : None ,
@@ -2729,7 +2727,7 @@ pub async fn generate_off_chunks(
2729
2727
json. to_string ( )
2730
2728
} )
2731
2729
. collect ( ) ,
2732
- user_message : prompt ,
2730
+ user_message : format ! ( "{} {}" , rag_prompt , last_prev_message . content . clone ( ) ) ,
2733
2731
query_rating : String :: new ( ) ,
2734
2732
rag_type : "chosen_chunks" . to_string ( ) ,
2735
2733
llm_response : completion_content. clone ( ) ,
@@ -2799,7 +2797,7 @@ pub async fn generate_off_chunks(
2799
2797
json. to_string ( )
2800
2798
} )
2801
2799
. collect ( ) ,
2802
- user_message : prompt ,
2800
+ user_message : format ! ( "{} {}" , rag_prompt , last_prev_message . content . clone ( ) ) ,
2803
2801
rag_type : "chosen_chunks" . to_string ( ) ,
2804
2802
query_rating : String :: new ( ) ,
2805
2803
llm_response : completion,
0 commit comments