Skip to content

Commit

Permalink
community: Problem with embeddings in new versions of clickhouse. (la…
Browse files Browse the repository at this point in the history
…ngchain-ai#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 <[email protected]>
  • Loading branch information
MarceloNunesAlves and efriis authored Oct 11, 2024
1 parent 2a1029c commit 5647276
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/community/langchain_community/vectorstores/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ def __init__(
**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
Expand Down
7 changes: 7 additions & 0 deletions libs/community/langchain_community/vectorstores/myscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ def __init__(
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_)

Expand Down

0 comments on commit 5647276

Please sign in to comment.