Skip to content

The agent engineering platform.

community: Problem with embeddings in new versions of clickhouse. (#26041)

Marcelo Nunes Alves56472769985b
diff --git a/libs/community/langchain_community/vectorstores/clickhouse.py b/libs/community/langchain_community/vectorstores/clickhouse.py
index a285cb8445..4246abfc0d 100644
--- a/libs/community/langchain_community/vectorstores/clickhouse.py
+++ b/libs/community/langchain_community/vectorstores/clickhouse.py
@@ -309,6 +309,14 @@ class Clickhouse(VectorStore):
**kwargs,
)
# Enable JSON type
+ try:
+ self.client.command("SET allow_experimental_json_type=1")
+ except Exception as _:
+ logger.debug(
+ f"Clickhouse version={self.client.server_version} - "
+ "There is no allow_experimental_json_type parameter."
+ )
+
self.client.command("SET allow_experimental_object_type=1")
if self.config.index_type:
# Enable index
diff --git a/libs/community/langchain_community/vectorstores/myscale.py b/libs/community/langchain_community/vectorstores/myscale.py
index ecd2108d41..d3dec65c8b 100644
--- a/libs/community/langchain_community/vectorstores/myscale.py
+++ b/libs/community/langchain_community/vectorstores/myscale.py
@@ -193,6 +193,13 @@ class MyScale(VectorStore):
password=self.config.password,
**kwargs,
)
+ try:
+ self.client.command("SET allow_experimental_json_type=1")
+ except Exception as _:
+ logger.debug(
+ f"Clickhouse version={self.client.server_version} - "
+ "There is no allow_experimental_json_type parameter."
+ )
self.client.command("SET allow_experimental_object_type=1")
self.client.command(schema_)