Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClickHouse ERROR: Distance function argument of Annoy index must be of type String. #6208

Closed
2 of 14 tasks
sheiy opened this issue Jun 15, 2023 · 4 comments · Fixed by #6385
Closed
2 of 14 tasks

ClickHouse ERROR: Distance function argument of Annoy index must be of type String. #6208

sheiy opened this issue Jun 15, 2023 · 4 comments · Fixed by #6385

Comments

@sheiy
Copy link

sheiy commented Jun 15, 2023

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
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

image

Expected behavior

success write data to clickhouse

@devstein
Copy link

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

@sheiy
Copy link
Author

sheiy commented Jun 16, 2023

@haoch do you have any idea?

@haoch
Copy link
Contributor

haoch commented Jun 18, 2023

@sheiy Will test with the clickhouse version you used and get back to you shortly.

@haoch
Copy link
Contributor

haoch commented Jun 18, 2023

@sheiy It will be fixed with #6385

hwchase17 pushed a commit that referenced this issue Jun 19, 2023
<!--
Thank you for contributing to LangChain! Your PR will appear in our
release under the title you set. Please make sure it highlights your
valuable contribution.

Replace this with a description of the change, the issue it fixes (if
applicable), and relevant context. List any dependencies required for
this change.

After you're done, someone will review your PR. They may suggest
improvements. If no one reviews your PR within a few days, feel free to
@-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd
like us to shout you out on Twitter, please also include your handle!
-->

Fixes #6208

<!-- Remove if not applicable -->

Fixes # (issue)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on
network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests,
lint
etc:


https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @hwchase17

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
 
 VectorStores / Retrievers / Memory
  - @dev2049
kacperlukawski pushed a commit to kacperlukawski/langchain that referenced this issue Jun 29, 2023
<!--
Thank you for contributing to LangChain! Your PR will appear in our
release under the title you set. Please make sure it highlights your
valuable contribution.

Replace this with a description of the change, the issue it fixes (if
applicable), and relevant context. List any dependencies required for
this change.

After you're done, someone will review your PR. They may suggest
improvements. If no one reviews your PR within a few days, feel free to
@-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd
like us to shout you out on Twitter, please also include your handle!
-->

Fixes langchain-ai#6208

<!-- Remove if not applicable -->

Fixes # (issue)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on
network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests,
lint
etc:


https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @hwchase17

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
 
 VectorStores / Retrievers / Memory
  - @dev2049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants