Skip to content

An Azure Developer template to launch a new Pinecone Assistant using Azure blob storage as the source.

License

Notifications You must be signed in to change notification settings

pinecone-io/pinecone-assistant-azd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinecone Assistants Sample App

Use this sample app to interact with assistants you have created in the Pinecone console. This app allows you to create a deployable Next.js application to interact with your assistants and their uploaded files.

Built With

  • Pinecone Assistant
  • Azure azd templates
  • Next.js + Tailwind + Python
  • Node version 20 or higher

Running the Sample App

Want to move fast?

The quickest way to try this azd template out is using GitHub Codespaces or in a VS Code Dev Container:

Open in GitHub Codespaces Open in Dev Container

You can also get started quickly using a terminal. Simply run azd init -t pinecone-io/pinecone-assistant-azd to clone the project.

Note

This template is only guaranteed to work on MacOS or Linux. It lacks Windows support, so if you would like to add that, please feel free to do so and submit a PR.

Create a Pinecone API key

Grab an API key here

Environment Variables

There are two required environment variables:

  1. PINECONE_API_KEY: You can get this from the Pinecone console. If you're running the app locally then add this to your environment. If you're running in Github CI, be sure to add it as a secret in your repository. To configure required secrets for connecting to Azure, simply run azd pipeline config.
  2. PINECONE_ASSISTANT_NAME: This defaults to example-assistant but you can name it whatever you like. If the assistant doesn't exist one will be created during post-deploy operations.

All of the other environment variables in .env.template are completely optional.

This app uses two additional optional environment variables to control certain features:

  1. SHOW_ASSISTANT_FILES: Set to 'true' to display the files uploaded to your Pinecone Assistant. Default is 'false'.
  2. SHOW_CITATIONS: Set to 'true' to display citations and references in the assistant's responses. Default is 'true'.

You can set these variables in your .env.local file:

SHOW_ASSISTANT_FILES=true
SHOW_CITATIONS=true

Start the project

Before doing anything else be sure to clone the repo. Then, deploy the app:

# follow the prompts to sign in to your Azure account
azd auth login

# install dependencies
npm i

# create a `.env.local` file from the provided template
npm run env:init

# follow the prompts to provision the infrastructure resources in Azure
azd provision

# deploy the app to the provisioned infrastructure
azd deploy

Note:

Be sure to use an Azure environment name =< 6 characters or the deployment will fail.

Note:

If deployment fails initially, try running

sh ./.azd/hooks/postprovision.sh

to make sure your environment is setup properly.

This will provision the necessary Azure resources, run the Python import script to seed your new assistant with the sample PDFs in /assets, and deploy the application to Azure.

Adding new files to the Assistant

To add new files, you can upload them directly in the Pinecone console. Or, download them to your local filesystem in the project's assets/ directory. You can then run

python src/file_manager/upload.py

The script will find any new PDF or text files (ending in pdf or txt) in that directory and add them to the Assistant.

Note:

The script ignores any files it's seen before, as tracked in the processed_files file. Remove or edit that file, or give the new versions different names, if you want to replace or supplement files you've previously uploaded.

Project structure

TODO

Known Issues


Troubleshooting

Experiencing any issues with the sample app? Submit an issue, create a PR, or post in our community forum!


About

An Azure Developer template to launch a new Pinecone Assistant using Azure blob storage as the source.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published