mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
fix(vector store)!: fix file content API (#4105)
# What does this PR do? - changed to match https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml ## Test Plan updated test CI
This commit is contained in:
parent
4341c4c2ac
commit
d4ecbfd092
8 changed files with 93 additions and 114 deletions
|
|
@ -907,16 +907,16 @@ def test_openai_vector_store_retrieve_file_contents(
|
|||
)
|
||||
|
||||
assert file_contents is not None
|
||||
assert len(file_contents.content) == 1
|
||||
content = file_contents.content[0]
|
||||
assert file_contents.object == "vector_store.file_content.page"
|
||||
assert len(file_contents.data) == 1
|
||||
content = file_contents.data[0]
|
||||
|
||||
# llama-stack-client returns a model, openai-python is a badboy and returns a dict
|
||||
if not isinstance(content, dict):
|
||||
content = content.model_dump()
|
||||
assert content["type"] == "text"
|
||||
assert content["text"] == test_content.decode("utf-8")
|
||||
assert file_contents.filename == file_name
|
||||
assert file_contents.attributes == attributes
|
||||
assert file_contents.has_more is False
|
||||
|
||||
|
||||
@vector_provider_wrapper
|
||||
|
|
@ -1483,14 +1483,12 @@ def test_openai_vector_store_file_batch_retrieve_contents(
|
|||
)
|
||||
|
||||
assert file_contents is not None
|
||||
assert file_contents.filename == file_data[i][0]
|
||||
assert len(file_contents.content) > 0
|
||||
assert file_contents.object == "vector_store.file_content.page"
|
||||
assert len(file_contents.data) > 0
|
||||
|
||||
# Verify the content matches what we uploaded
|
||||
content_text = (
|
||||
file_contents.content[0].text
|
||||
if hasattr(file_contents.content[0], "text")
|
||||
else file_contents.content[0]["text"]
|
||||
file_contents.data[0].text if hasattr(file_contents.data[0], "text") else file_contents.data[0]["text"]
|
||||
)
|
||||
assert file_data[i][1].decode("utf-8") in content_text
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue