Manage files
This page shows you how to upload a file, view a list of files, check the status of a file, and delete a file from your assistant.
File upload limitations depend on the plan you are using. For more information, see Understanding Pinecone Assistant.
Upload a local file
To upload a file to your assistant from your local device, use the upload_file
operation as in the following example.
It may take several minutes for your assistant to process your file. You can check the status of your file to determine if it is ready to use.
You can upload a file to an assistant using the Pinecone console. Select the assistant you want to upload to and add the file in the Assistant playground.
Upload with metadata
You can upload a file with metadata. Metadata is a dictionary of key-value pairs that you can use to store additional information about the file. For example, you can use metadata to store the file’s name, document type, publish date, or any other relevant information.
When a file is uploaded with metadata, you can use the metadata to filter a list of files and filter chat responses.
List files in an assistant
View all files
Use the list_files
operation to get the status, ID, and metadata for each file in your assistant as in the following example:
This operation returns a response like the following:
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 in Pinecone Assistant.
The following example lists files that are a manuscript:
Additional filter examples
Filter | Example | Description |
---|---|---|
$eq | {"genre": {"$eq": "documentary"}} | Matches with the genre “documentary”. |
$ne | {"genre": {"$ne": "drama"}} | Matches with a genre other than “drama”. |
$gt | {"year": {"$gt": 2019}} | Matches with a year greater than 2019. |
$gte | {"year": {"$gte": 2020}} | Matches with a year greater than or equal to 2020. |
$lt | {"year": {"$lt": 2020}} | Matches with a year less than 2020. |
$lte | {"year": {"$lte": 2020}} | Matches with a year less than or equal to 2020. |
$in | {"genre": {"$in": ["comedy", "documentary"]}} | Matches with the genre “comedy” or “documentary”. |
$nin | {"genre": {"$nin": ["comedy", "documentary"]}} | Matches with a genre other than “comedy” or “documentary”. |
$exists | {"genre": {"$exists": true}} | Matches with the “genre” field. |
Combine filters
The metadata filters can be combined by using $and
and $or
operators:
Operator | Example | Description |
---|---|---|
$and | {"$and": [{"genre": {"$eq": "drama"}}, {"year": {"$gte": 2020}}]} | Matches with the genre “drama” and a year greater than or equal to 2020. |
$or | {"$or": [{"genre": {"$eq": "drama"}}, {"year": {"$gte": 2020}}]} | Matches with the genre “drama” or a year greater than or equal to 2020. |
Get the status of a file
Use the describe_file
operation to get the status and metadata for your Assistant as in the following example:
This operation returns a response like the following:
You can check the status a file using the Pinecone console. In the Assistant playground, click the file for more details.
Delete a file
Use the delete file
operation to delete a file.
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.
Was this page helpful?