#I gave GPT-4 access to my email
10 messages · Page 1 of 1 (latest)
Interesting, I was working on this over the weekend but didn't consider piping IMAP -> redis and then reading from there
appreciation if you could share your experience, tkz
@zinc ruin me? It's pretty straightforward
- collect emails into somewhere
- pipe email content to GPT along with a prompt
The challenge @unique rover will run into (at least I did) is that once the token cap is hit, GPT will forget the content of the emails. So you need to strictly limit the amount of context sent with each query. This limitation will be removed once you have access to this:
thank you Tangy to help, it's clear though I don't know any code👍
@zinc ruin just... ask GPT-4 to do it for you
I implemented it such that gpt-4 can search for emails, get the result, and then it discards it from the conversation but preserves some basic context, so that the AI can easily know what the conversation is about, and then search for more information if it is needed
it makes API costs significantly cheaper but maintains pretty much the exact same functionality as keeping the email data in the context
Essentially the token cap is hit once you have too many regular messages with the bot
**
Disclaimer, the text below is from my research searching through the web. I am not an expert.**
when the amount of text is significantly over the context window, the typical procedure is to use semantic search. Semantic search consists of transforming text into a vector and then comparing vectors instead of comparing strings of text.
The advantage is that the components of the vector encode information about "universal features" of language. Basically when the vectors are close to each other it usually means that the corresponding text seems somewhat related, that is it would make sense to think about text A after having read about text B perhaps similarly to the game "I will say a word tell me what is the first thing you think of".
Openai has a model for semantic search using the ada embedding model. If I remember correctly that is what they use in the chatgpt retrieval plugin. There are different models for embedding text, some noticeably cheaper than the one by openai and there was a paper showing that a previous version of the ada model was not that much better than other models while being significantly more expensive (the cost seemed to have decreased since). I do not know how true that is with the current version of the ada model.
it can be a bit tedious to set up semantic search using the embedding model and a direct approach can be inefficient when there is a lot of data. As far as I understand, that's the utility of using something like langchain (explained later in the text) and vector databases like pinecone and weaviate (I think I also read that Qdrant is good but I only saw that once). One advantage of using an advanced algorithm in a vector database is that you can have clusters of your embeddings to avoid searching through every single embedding stored.