Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fix system prompt

ozanarmaganeae05c1caf91
diff --git a/src/conversation_model.cpp b/src/conversation_model.cpp
index 70a1d8f2..a2fd627e 100644
--- a/src/conversation_model.cpp
+++ b/src/conversation_model.cpp
@@ -34,7 +34,10 @@ Option<std::string> ConversationModel::get_answer(const std::string& context, co
const std::string& model_namespace = get_model_namespace(model_config["model_name"].get<std::string>());
- const std::string& system_prompt = model_config["system_prompt"].get<std::string>();
+ std::string system_prompt = "";
+ if(model_config.count("system_prompt") != 0 && model_config["system_prompt"].is_string()) {
+ system_prompt = model_config["system_prompt"].get<std::string>();
+ }
if(model_namespace == "openai") {
return OpenAIConversationModel::get_answer(context, prompt, system_prompt, model_config);
diff --git a/test/collection_vector_search_test.cpp b/test/collection_vector_search_test.cpp
index 673a4383..67db3f2f 100644
--- a/test/collection_vector_search_test.cpp
+++ b/test/collection_vector_search_test.cpp
@@ -2906,7 +2906,7 @@ TEST_F(CollectionVectorTest, TestQAConversation) {
})"_json.dump());
ASSERT_TRUE(add_op.ok());
-
+
auto results_op = coll->search("how many products are there for clothing category?", {"embedding"},
"", {}, {}, {2}, 10,
1, FREQUENCY, {true},
@@ -2935,7 +2935,7 @@ TEST_F(CollectionVectorTest, TestQAConversation) {
ASSERT_TRUE(history.is_object());
ASSERT_TRUE(history.contains("conversation"));
- ASSERT_TRUE(history["conversation"].is_array ());
+ ASSERT_TRUE(history["conversation"].is_array());
ASSERT_EQ("how many products are there for clothing category?", history["conversation"][0]["user"]);
}