From b7765f77c6bc195ac3fc5e2cc62c5d1907b8ed3a Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Fri, 2 Feb 2024 15:46:11 +0700
Subject: [PATCH] feat(cl): Use condense plus context chat engine for FastAPI
 as default

---
 templates/components/vectordbs/python/mongo/index.py | 2 +-
 templates/components/vectordbs/python/none/index.py  | 2 +-
 templates/components/vectordbs/python/pg/index.py    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/templates/components/vectordbs/python/mongo/index.py b/templates/components/vectordbs/python/mongo/index.py
index d9b14dd2..a80590b5 100644
--- a/templates/components/vectordbs/python/mongo/index.py
+++ b/templates/components/vectordbs/python/mongo/index.py
@@ -20,4 +20,4 @@ def get_chat_engine():
     )
     index = VectorStoreIndex.from_vector_store(store, service_context)
     logger.info("Finished connecting to index from MongoDB.")
-    return index.as_chat_engine(similarity_top_k=5)
+    return index.as_chat_engine(similarity_top_k=5, chat_mode="condense_plus_context")
diff --git a/templates/components/vectordbs/python/none/index.py b/templates/components/vectordbs/python/none/index.py
index 0170d6e8..4404c66e 100644
--- a/templates/components/vectordbs/python/none/index.py
+++ b/templates/components/vectordbs/python/none/index.py
@@ -22,4 +22,4 @@ def get_chat_engine():
     storage_context = StorageContext.from_defaults(persist_dir=STORAGE_DIR)
     index = load_index_from_storage(storage_context, service_context=service_context)
     logger.info(f"Finished loading index from {STORAGE_DIR}")
-    return index.as_chat_engine()
+    return index.as_chat_engine(similarity_top_k=5, chat_mode="condense_plus_context")
diff --git a/templates/components/vectordbs/python/pg/index.py b/templates/components/vectordbs/python/pg/index.py
index 5c902772..510c21a5 100644
--- a/templates/components/vectordbs/python/pg/index.py
+++ b/templates/components/vectordbs/python/pg/index.py
@@ -13,4 +13,4 @@ def get_chat_engine():
     store = init_pg_vector_store_from_env()
     index = VectorStoreIndex.from_vector_store(store, service_context)
     logger.info("Finished connecting to index from PGVector.")
-    return index.as_chat_engine(similarity_top_k=5)
+    return index.as_chat_engine(similarity_top_k=5, chat_mode="condense_plus_context")
-- 
GitLab