Build a Question Answering App Using Pinecone And Python

A pinecone flying in the air
Picture by Antonio Janeski on Unsplash

Vector representations of objects

Distance metrics

  • Semantic textual content search
  • Picture similarity search
  • Video/Audio/Textual content suggestions
  • Time collection similarity search
  • Doc de-duplication detection
  • Totally managed service — no want to fret about infrastructure
  • Excessive efficiency and scalability
  • Consumer-friendly interface, detailed documentation, quite a few instance prototypes, free for experimental initiatives
Picture supply from Pipecone’s official documentation at https://www.pinecone.io/docs/overview/
  1. Join a free account.
  2. Create an index.
Creating a brand new index through the Console
Comcast buyer complaints extract from kaggle.com
pip set up -qU matplotlib pinecone-client ipywidgets
pip set up -qU sentence-transformers --no-cache-dir
The query answering app
  • The pandas library is used to learn and manipulate the info.
  • The pinecone library gives Pinecone operations like indexing and querying.
  • itertools is used to provide extra complicated iterators.
  • We want sentence_transformers to outline our mannequin — average_word_embeddings_glove.6B.300d. It’s an unsupervised studying algorithm for retrieving vector representations for phrases.
  • The api_key must be your private key taken from Pinecone’s Console.
  • The index_name ought to match the one you created through the Console earlier.
  • Be certain to rename your .csv file accordingly to match the DATA_FILE.
  • The query_questions array comprises the consumer queries to verify in opposition to.
  • The query_vectors extract embeddings for the vectors.
  • The query_results comprises the outcome with essentially the most related listed questions.
  • Ultimately, we iterate via the questions and the outcomes and show essentially the most related questions based mostly on the index similarity. For a greater understanding, we present the ticket id of the query, the query itself, and the rating to point the knowledge of the outcome.
Question outcomes from Pinecone vector search

More Posts