mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 07:40:12 +01:00
feat(vectorstore): Add clickhouse support as vectore store (#1883)
* Added ClickHouse vector sotre support * port fix * updated lock file * fix: mypy * fix: mypy --------- Co-authored-by: Valery Denisov <valerydenisov@double.cloud> Co-authored-by: Javier Martinez <javiermartinezalvarez98@gmail.com>
This commit is contained in:
parent
fc13368bc7
commit
2612928839
6 changed files with 399 additions and 5 deletions
|
|
@ -121,6 +121,33 @@ class VectorStoreComponent:
|
|||
collection_name="make_this_parameterizable_per_api_call",
|
||||
), # TODO
|
||||
)
|
||||
case "clickhouse":
|
||||
try:
|
||||
from clickhouse_connect import ( # type: ignore
|
||||
get_client,
|
||||
)
|
||||
from llama_index.vector_stores.clickhouse import ( # type: ignore
|
||||
ClickHouseVectorStore,
|
||||
)
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"ClickHouse dependencies not found, install with `poetry install --extras vector-stores-clickhouse`"
|
||||
) from e
|
||||
|
||||
if settings.clickhouse is None:
|
||||
raise ValueError(
|
||||
"ClickHouse settings not found. Please provide settings."
|
||||
)
|
||||
|
||||
clickhouse_client = get_client(
|
||||
host=settings.clickhouse.host,
|
||||
port=settings.clickhouse.port,
|
||||
username=settings.clickhouse.username,
|
||||
password=settings.clickhouse.password,
|
||||
)
|
||||
self.vector_store = ClickHouseVectorStore(
|
||||
clickhouse_client=clickhouse_client
|
||||
)
|
||||
case _:
|
||||
# Should be unreachable
|
||||
# The settings validator should have caught this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue