Goal: My goal is to use pinecone vectors instead of retool vectors
Steps: I basically have all the bit&pieces together (chat widget & workflow to fetch pinecone vectors etc.
Is it possible to use pinecone as contect with the chat widget & AI actions? Or do i need to build custom "chat" in order to utilize other than retool vectors?
You can build a custom chat if you want, that's the solution I've gone with for my company but it depends on the requirements you have (mostly legal ones regarding data security & storage). For just a proof-of-concept though you could use the chat widget and provide the chat history for it to display, which would allow you to 'calculate' and store the conversation on your own terms. This will require the use of Python to make things easy, so pinecone and openai will occur in a workflow where you can easily install all the necessary libraries
from openai import OpenAI
from openai.embeddings_utils import get_embedding, cosine_similarity
client = OpenAI()
def get_embedding(text, model="text-embedding-3-small"):
text = text.replace("\n", " ")
return client.embeddings.create(input = [text], model=model).data[0].embedding
def search_reviews(df, product_description, n=3, pprint=True):
embedding = get_embedding(product_description, model='text-embedding-3-small')
df['similarities'] = df.ada_embedding.apply(lambda x: cosine_similarity(x, embedding))
res = df.sort_values('similarities', ascending=False).head(n)
return res
res = search_reviews(df, 'delicious beans', n=3)
return res