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

convert date and timestamp to string format for qdrant #12407

Closed
wants to merge 1 commit into from

Conversation

xieqihui
Copy link
Contributor

@xieqihui xieqihui commented Oct 27, 2023

Description:
Convert the datetime values to string format to solve qdrant_client.http.models.MatchValue pydantic validation errors in QdrantTranslator.

Details:
If the filter value output from llm contains "YYYY-MM-DD" formated datetime, the output parser will format it to datetime.date.

return datetime.datetime.strptime(item, '"%Y-%m-%d"').date()

However, Qdrant client doesn't support datetime or date format, so this will result in pydantic error:
https://github.com/qdrant/qdrant-client/blob/6875996cad0b4d15c891e9e81c725aaa3e9afdb5/qdrant_client/http/models/models.py#L1995

3 validation errors for MatchValue
value.bool
  Input should be a valid boolean [type=bool_type, input_value=datetime.date(2023, 10, 10), input_type=date]
    For further information visit https://errors.pydantic.dev/2.4/v/bool_type
value.int
  Input should be a valid integer [type=int_type, input_value=datetime.date(2023, 10, 10), input_type=date]
    For further information visit https://errors.pydantic.dev/2.4/v/int_type
value.str
  Input should be a valid string [type=string_type, input_value=datetime.date(2023, 10, 10), input_type=date]
    For further information visit https://errors.pydantic.dev/2.4/v/string_type

Similar convertion has been implemented in WeaviateTranslator:

elif isinstance(comparison.value, datetime) or isinstance(

@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Oct 27, 2023 6:15am

@dosubot dosubot bot added Ɑ: vector store Related to vector store module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Oct 27, 2023
@xieqihui xieqihui force-pushed the fix_qdrant_datetime branch from 3b89c28 to 4df23c5 Compare October 27, 2023 06:11
@xieqihui xieqihui force-pushed the fix_qdrant_datetime branch from 4df23c5 to c5c17b4 Compare October 27, 2023 06:15
@hwchase17 hwchase17 closed this Jan 30, 2024
@baskaryan baskaryan reopened this Jan 30, 2024
@ccurme ccurme added the langchain Related to the langchain package label Jun 21, 2024
@hwchase17 hwchase17 closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature langchain Related to the langchain package Ɑ: vector store Related to vector store module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants