langchain
langchain copied to clipboard
ClickHouse ERROR: Distance function argument of Annoy index must be of type String.
System Info
langchain: 0.0.200 platform: macOS python: 3.10.11 clickhouse: version 23.5.2.7 (official build)
Who can help?
@hwchase17
Information
- [ ] The official example notebooks/scripts
- [X] My own modified scripts
Related Components
- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async
Reproduction
Expected behavior
success write data to clickhouse
Generated by a 🤖
Anwser
To resolve the issue, update the index_param
in ClickHouseSettings
to use the metric
parameter as a string:
index_param: Optional[Union[List, Dict]] = [100, f"'{metric}'"]
Also, ensure the metric
parameter in the Annoy.from_texts()
function is set to a string value, such as "angular" or "euclidean":
vector_store_v2 = Annoy.from_texts(
texts, embeddings_func, metric="angular", n_trees=100, n_jobs=1
)
Sources
This response is meant to be helpful and save users time. It is not meant to be a precise solution.
Please leave a 👍 if this is helpful and 👎 if it is irrelevant
@haoch do you have any idea?
@sheiy Will test with the clickhouse version you used and get back to you shortly.
@sheiy It will be fixed with #6385