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

Starting with Clickhouse version 24.8, a different type of configuration
has been introduced in the vectorized data ingestion, and if this
configuration occurs, an error occurs when generating the table. As can
be seen below:

![Screenshot from 2024-09-04
11-48-00](https://github.com/user-attachments/assets/70840a93-1001-490c-921a-26924c51d9eb)

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Marcelo Nunes Alves 2024-10-11 15:54:50 -03:00 committed by GitHub
parent 2a1029c53c
commit 5647276998
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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_)