mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix: last_id when listing files in vector store (#4079)
# What does this PR do? the last_id should be the id of the last item in the returned list, not the unfiltered list. ## Test Plan fixed test
This commit is contained in:
parent
d9cf5cd480
commit
84a84ee85c
2 changed files with 3 additions and 3 deletions
|
|
@ -886,8 +886,8 @@ class OpenAIVectorStoreMixin(ABC):
|
||||||
|
|
||||||
# Determine pagination info
|
# Determine pagination info
|
||||||
has_more = len(file_objects) > limit
|
has_more = len(file_objects) > limit
|
||||||
first_id = file_objects[0].id if file_objects else None
|
first_id = limited_files[0].id if file_objects else None
|
||||||
last_id = file_objects[-1].id if file_objects else None
|
last_id = limited_files[-1].id if file_objects else None
|
||||||
|
|
||||||
return VectorStoreListFilesResponse(
|
return VectorStoreListFilesResponse(
|
||||||
data=limited_files,
|
data=limited_files,
|
||||||
|
|
|
||||||
|
|
@ -825,7 +825,7 @@ def test_openai_vector_store_list_files(
|
||||||
assert first_page.has_more
|
assert first_page.has_more
|
||||||
assert len(first_page.data) == 2
|
assert len(first_page.data) == 2
|
||||||
assert first_page.first_id == first_page.data[0].id
|
assert first_page.first_id == first_page.data[0].id
|
||||||
assert first_page.last_id != first_page.data[-1].id
|
assert first_page.last_id == first_page.data[-1].id
|
||||||
|
|
||||||
next_page = compat_client.vector_stores.files.list(
|
next_page = compat_client.vector_stores.files.list(
|
||||||
vector_store_id=vector_store.id, limit=2, after=first_page.data[-1].id
|
vector_store_id=vector_store.id, limit=2, after=first_page.data[-1].id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue