mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-06 04:05:37 +00:00
Remove useless function
This commit is contained in:
parent
eb4445070f
commit
9875f55384
@ -99,14 +99,11 @@ fn setup_search_tool(chat_completion: &mut CreateChatCompletionRequest, prompts:
|
|||||||
.build()
|
.build()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
/// Prepend system message to the conversation
|
|
||||||
fn prepend_system_message(chat_completion: &mut CreateChatCompletionRequest, system_prompt: &str) {
|
|
||||||
chat_completion.messages.insert(
|
chat_completion.messages.insert(
|
||||||
0,
|
0,
|
||||||
ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
|
ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
|
||||||
content: ChatCompletionRequestSystemMessageContent::Text(system_prompt.to_string()),
|
content: ChatCompletionRequestSystemMessageContent::Text(prompts.system.clone()),
|
||||||
name: None,
|
name: None,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -194,13 +191,10 @@ async fn non_streamed_chat(
|
|||||||
// }
|
// }
|
||||||
let client = Client::with_config(config);
|
let client = Client::with_config(config);
|
||||||
|
|
||||||
// Prepend system message to the conversation
|
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
||||||
prepend_system_message(&mut chat_completion, &chat_settings.prompts.system);
|
|
||||||
|
|
||||||
let mut response;
|
let mut response;
|
||||||
loop {
|
loop {
|
||||||
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
|
||||||
|
|
||||||
response = client.chat().create(chat_completion.clone()).await.unwrap();
|
response = client.chat().create(chat_completion.clone()).await.unwrap();
|
||||||
|
|
||||||
let choice = &mut response.choices[0];
|
let choice = &mut response.choices[0];
|
||||||
@ -267,10 +261,6 @@ async fn streamed_chat(
|
|||||||
// config.with_api_base(&endpoint);
|
// config.with_api_base(&endpoint);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Prepend system message to the conversation
|
|
||||||
prepend_system_message(&mut chat_completion, &chat_settings.prompts.system);
|
|
||||||
|
|
||||||
// Setup the search tool
|
|
||||||
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
||||||
|
|
||||||
let (tx, rx) = tokio::sync::mpsc::channel(10);
|
let (tx, rx) = tokio::sync::mpsc::channel(10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user