-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
fix: assign current_time to datetime.now() if current_time is None #5045
fix: assign current_time to datetime.now() if current_time is None #5045
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if doing this, can just do current_time = kwargs.get("current_time")
in line above
|
i mean keep the added lines, but just remove the default of datatime.now - since you check for None after, it doesnt do anything |
oh yeah makes sense; I've updated it |
…ever (#5155) # Same as PR #5045, but for async <!-- Thank you for contributing to LangChain! Your PR will appear in our next 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. --> <!-- Remove if not applicable --> Fixes #4825 I had forgotten to update the asynchronous counterpart `aadd_documents` with the bug fix from PR #5045, so this PR also fixes `aadd_documents` too. ## Who can review? Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested: @dev2049 <!-- 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 - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 -->
…ever (#5155) # Same as PR #5045, but for async <!-- Thank you for contributing to LangChain! Your PR will appear in our next 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. --> <!-- Remove if not applicable --> Fixes #4825 I had forgotten to update the asynchronous counterpart `aadd_documents` with the bug fix from PR #5045, so this PR also fixes `aadd_documents` too. ## Who can review? Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested: @dev2049 <!-- 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 - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 -->
Assign
current_time
todatetime.now()
if itcurrent_time is None
intime_weighted_retriever
Fixes #4825
As implemented,
add_documents
inTimeWeightedVectorStoreRetriever
assignsdoc.metadata["last_accessed_at"]
anddoc.metadata["created_at"]
todatetime.datetime.now()
ifcurrent_time
is not inkwargs
.However, from the way
add_documents
is being called fromGenerativeAgentMemory
,current_time
is set as akwarg
, but it is given a value ofNone
:The default of
now
was set in #4658 to be None. The proposed fix is the following:Alternatively, we could just set the default of
now
to bedatetime.datetime.now()
everywhere instead. Thoughts @hwchase17? If we still want to keep the default to beNone
, then this PR should fix the above issue. If we want to set the default to bedatetime.datetime.now()
instead, I can update this PR with that alternative fix. EDIT: seems like from #5018 it looks like we would prefer to keep the default to beNone
, in which case this PR should fix the error.Before submitting
Who can review?
Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:
@hwchase17
@dev2049