Replies: 2 comments 1 reply
-
🤖 Hey @nshern, great to see you back here! Hope you've been doing well. Based on the information provided, it seems like the issue might be related to the date format in your metadata. The LlamaIndex application expects dates in a specific format, and if the dates in your metadata are not in this format, it could lead to incorrect interpretation. In the To resolve this, you need to ensure that the dates in your metadata are in the correct format before they are passed to these methods. If they are not, you need to convert them to the correct format. Here is a Python function that can help you do this: from datetime import datetime
def convert_date_format(date_string: str, current_format: str, new_format: str) -> str:
"""Convert a date string from one format to another.
Args:
date_string (str): The date string to convert.
current_format (str): The current format of the date string.
new_format (str): The new format to convert the date string to.
Returns:
str: The date string in the new format.
"""
date_object = datetime.strptime(date_string, current_format)
return date_object.strftime(new_format) You can use this function to convert your dates to the correct format before passing them to the date_string = "01-31-2022" # date in 'MM-DD-YYYY' format
current_format = "%m-%d-%Y"
new_format = "%Y-%m-%d" # 'YYYY-MM-DD' format
correct_format_date = convert_date_format(date_string, current_format, new_format)
# Now you can pass `correct_format_date` to the `load_data` or `create_event` methods Please let me know if this resolves your issue or if you need further assistance. Sources
|
Beta Was this translation helpful? Give feedback.
-
🤖 It seems like this issue requires a deeper look, @logan-markewich could you please lend your expertise? |
Beta Was this translation helpful? Give feedback.
-
I have a bunch of documents that are meeting notes. Each document has metadata with the date of when the meeting was held. When I query the engine it is continuously confused about when the last held meeting was and will give wildly different answers, which are nearly always wrong.
How can I fix this issue and make it look and respect the metadata that contains the date?
Beta Was this translation helpful? Give feedback.
All reactions