This page shows you how to view a list of files, check the status of a file, and delete a file from your assistant.
List files in an assistant
View all files
You can get the status, ID, and metadata for each file in your assistant, as in the following example:
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# Get your assistant.
assistant = pc.assistant.Assistant(
assistant_name="example-assistant",
)
# List files in your assistant.
files = assistant.list_files()
This operation returns a response like the following:
{
"files": [
{
"name": "example_file.txt",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"created_on": "2023-11-07T05:31:56Z",
"updated_on": "2023-11-07T05:31:56Z",
"status": "Processing"
}
]
}
You can use the id
value to check the status of an individual file.
You can list file in an assistant using the Pinecone console. Select the assistant and view the files in the Assistant playground.
View a filtered list of files
Metadata filter expressions can be included when listing files. This will limit the list of files to only those matching the filter expression. Use the filter
parameter to specify the metadata filter expression.
For more information about filtering with metadata, see Understanding files.
The following example lists files that are a manuscript:
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# Get your assistant.
assistant = pc.assistant.Assistant(
assistant_name="example-assistant",
)
# List files in your assistant that match the metadata filter.
files = assistant.list_files(filter={"document_type":"manuscript"})
Get the status of a file
You can get the status and metadata for your assistant, as in the following example:
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# Get an assistant.
assistant = pc.assistant.Assistant(
assistant_name="example-assistant",
)
# Describe a file.
file = assistant.describe_file(file_id="070513b3-022f-4966-b583-a9b12e0290ff")
This operation returns a response like the following:
{
"name": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"created_on": "2023-11-07T05:31:56Z",
"updated_on": "2023-11-07T05:31:56Z",
"status": "Processing",
"percent_done": 0.5,
"signed_url": "https://storage.googleapis.com...",
"error_message": null,
"size": 1073470
}
You can check the status a file using the Pinecone console. In the Assistant playground, click the file for more details.
Delete a file
You can delete a file from an assistant.
Once a file is deleted, you cannot recover it.
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# Get your assistant.
assistant = pc.assistant.Assistant(
assistant_name="example-assistant",
)
# Delete a file from your assistant.
assistant.delete_file(file_id="070513b3-022f-4966-b583-a9b12e0290ff")
You can delete a file from an assistant using the Pinecone console. In the Assistant playground, find the file and click the ellipsis (..) menu > Delete.