Skip to content

Commit

Permalink
fix last modification timestamp field calculation in xpack (#5566)
Browse files Browse the repository at this point in the history
* fix last modification timestamp field calculation

* bring path back

GitOrigin-RevId: 5ffa1bd1a2642865898cc4d96a7f9ff13406ba0b
  • Loading branch information
zxqfd555-pw authored and Manul from Pathway committed Feb 2, 2024
1 parent 9972b9b commit 5ad9098
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]

### Fixed
- `pw.io.xpacks.llm.VectorStoreServer` now correctly computes the last modification timestamp of an indexed document.

## [0.8.0] - 2024-02-01

### Added
Expand Down
11 changes: 6 additions & 5 deletions python/pathway/xpacks/llm/vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def embedder(txt):
)

parsed_docs += parsed_docs.select(
modified=pw.this.data["metadata"]["modified_at"],
path=pw.this.data["metadata"]["path"],
modified=pw.this.data["metadata"]["modified_at"].as_int(),
path=pw.this.data["metadata"]["path"].as_str(),
)

stats = parsed_docs.reduce(
Expand Down Expand Up @@ -203,7 +203,7 @@ def statistics_query(
@pw.udf
def format_stats(counts, last_modified) -> pw.Json:
if counts is not None:
response = {"file_count": counts, "last_modified": last_modified.value}
response = {"file_count": counts, "last_modified": last_modified}
else:
response = {"file_count": 0, "last_modified": None}
return pw.Json(response)
Expand Down Expand Up @@ -336,8 +336,9 @@ def run_server(
port,
threaded: bool = False,
with_cache: bool = True,
cache_backend: pw.persistence.Backend
| None = pw.persistence.Backend.filesystem("./Cache"),
cache_backend: (
pw.persistence.Backend | None
) = pw.persistence.Backend.filesystem("./Cache"),
):
"""
Builds the document processing pipeline and runs it.
Expand Down

0 comments on commit 5ad9098

Please sign in to comment.