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

Error while using Supabase self-query retriever when filters contain boolean value #7610

Closed
5 tasks done
ArmmGh opened this issue Jan 28, 2025 · 2 comments
Closed
5 tasks done
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@ArmmGh
Copy link
Contributor

ArmmGh commented Jan 28, 2025

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

const retriever = SelfQueryRetriever.fromLLM({
    llm: llm,
    vectorStore: vectorStore,
    documentContents: 'Detailed description of an apartment',
    attributeInfo: attributeInfo,
    structuredQueryTranslator: new SupabaseTranslator(),
    verbose: true,
  })

retriever.invoke("find apartments that have AC")

Error Message and Stack Trace (if applicable)

Error is Data type not supported

buildColumnName(attr: string, value: string | number, includeType = true) {
    let column = "";
    if (isString(value)) {
      column = `metadata->>${attr}`;
    } else if (isInt(value)) {
      column = `metadata->${attr}${includeType ? "::int" : ""}`;
    } else if (isFloat(value)) {
      column = `metadata->${attr}${includeType ? "::float" : ""}`;
    } else {
      throw new Error("Data type not supported");
    }

    return column;
  }

Description

  • I am trying to use langchain library to query my Supabase DB and return results by using selfQueryRetriever
  • I expect to get results based on query
  • I get error if filters generated by LLM contains boolean type

I created PR to solve the bug

System Info

Node Version: v20.18.0
Yarn Version: 1.22.22

@ArmmGh
Copy link
Contributor Author

ArmmGh commented Jan 28, 2025

Here is the PR that solves the issue
#7601

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jan 28, 2025
@ArmmGh
Copy link
Contributor Author

ArmmGh commented Jan 30, 2025

Merged!

@ArmmGh ArmmGh closed this as completed Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant