langchain-ai / langchain-postgres

LangChain abstractions backed by Postgres Backend
MIT License
66 stars 22 forks source link

Could you clarify why the "contains" operator is not implemented? #47

Closed artefactop closed 1 month ago

artefactop commented 1 month ago

Hi, we want to migrate from langchain_community and we are using the "contains" operator but is not implemented here.

Is there any reason? If not, do you have plan to implement it?

eyurtsev commented 1 month ago

The community implementation consists of two implementations:

1) one that uses a JSON field -- this is the version that has contains operator. This version is also buggy as it casts things into text. 2) I wrote a second implementation using a JSONB field that addresses most of the implementation issues. But it doesn't have a $contains operator.

You're free to contribute functionality for this!

What I'd be looking for are clear semantics for how the operator works together with complete test cases.

Possible types are for the field: None, str, float, int, List[float], List[int], List[str]

You can reference this recent PR to see how to go about doing that: https://github.com/langchain-ai/langchain-postgres/pull/40

artefactop commented 1 month ago

Thanks @eyurtsev ! We'll definitely take a look at reviewing the implementation details you provided.