-
Notifications
You must be signed in to change notification settings - Fork 44.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinecone Vectorized Memory #122
Pinecone Vectorized Memory #122
Conversation
This is totally necessary imo. |
yeah thank you very much |
@Torantulino could you create a pinecone account for autogpt? This way you can put the api key in the repo settings (I think only you has access to it right now) as a secret key and we can use it in our integration tests in github action. |
This is really nice and clean code. And it's an exciting update! Three thoughts:
|
c258b57
to
f60bd62
Compare
I was debating whether or not to leave in delete/overwrite. I wanted to leave the interface the same for the different memory classes. As for memory retrievals. I really like that idea. |
f99d5d1
to
1e64e68
Compare
Ok this should be working and it neatly pulls data out of memory. It might be interesting to remove the explicit memory add tool and to just save all history to memory every couple messages. But I'm going to leave that for a future PR as I think the value of having working queryable pinecone is enough for one. |
.env.template
Outdated
@@ -1,3 +1,5 @@ | |||
PINECONE_API_KEY=your-pinecone-api-key | |||
PINECONE_REGION=your-pinecone-region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be PINECONE_ENV
or we should update docs/code to reflrect the new name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting!
The bummer part: overwrite calls are failing. It's saying it's missing the "data" parameter but it looks like the problem is the function signature is inconsistent with SimpleMemory.
My two cents: I personally think the memory mechanism has too much complication and shouldn't be subject to "memory management" by the model. Just save everything and retrieve what's relevant. If getting rid of "SimpleMemory" makes life easier on this front, I think that would be a good thing. Just stick with the much better memory implementation (PineCone) and save yourself maintenance and reasoning headaches....
@Torantulino I know the feeling about having a flood of pull requests and endless requests coming your way with a new viral open source project. So I feel for you. But if you have the time, this might be something worth thinking about.
Sounds good. I was a bit afraid of that. |
Hope this gets merged soon, would be a huge upgrade. |
1e64e68
to
eeed66e
Compare
So I've been working on this. I deleted a bunch of code :) On another note. You would really like the agent to be able to traverse it's memories if there isn't enough context, so maybe adding a tool to think about something so it can traverse it's own memories would be useful. I am trying to keep these changes relatively simple so we can merge today. |
eeed66e
to
4ca37d2
Compare
Yeah even with the overlap you cite, I'm pretty sure this will be a big improvement over what was in place previously, based on what I've observed. On my end at least (using GPT-3.5) it was really underutilizing the memory when the model was managing it. It'd only save very occasionally. Granted I'd bet it's better with GPT-4 with memory management but I'd really like to not unnecessarily handicap 3.5. And I'm pretty sure it'll be better to just unburden the model from this altogether.
That sounds potentially very cool. It could be expensive and slow without limits, but definitely worth thinking about esp if there's going to be the option of using local models. There's also the option of squeezing more into memory. Just recently there was a bunch of buzz on Twitter about an apparent internal compressed "language" of sorts that the GPT-4 model has going on. It's lossy but perhaps good enough? What I'm wondering is if a bulk of processing could be done with this https://twitter.com/gfodor/status/1643303237578293249 |
I'm extremely skeptical of the compression stuff. That is the kind of thing that seems likely to be lossy in subtle ways and have many non-obvious failure modes. |
d1a09ce
to
d91a81b
Compare
d91a81b
to
475671d
Compare
This still formerly needs a review. |
Excellent work! |
looks like a cool pr but why not use an open source and self hostable vector database like milvus or other as to depend as little as possible on external services ? |
Milvus looks cool: https://milvus.io/docs/example_code.md I honestly picked something that a few other people were looking at inspired by the babyAGI library. It seemed like the simplest option to get started with. Milvus, might be nearly as easy, but requires additional infra. For now, let's get this in and working and if we find people aren't able to operate in the free tier or we want to deploy our own vector DB infra we can switch over. It looks like it should be pretty close to a drag and drop replacement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on this. Thank you for doing this!
Some notes:
get_ada_embedding could be @cached I think
~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.
This originally just said save code to files. Now this reads like "save all important memories to file" even though we have the Pinecone memory. Seems like this may need to be reworded...not sure...
If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
I like this!
Yeah I am skeptical too, to be clear. It seems like it might be an interesting experimental mode perhaps. |
scripts/memory.py
Outdated
try: | ||
pinecone_mem = PineconeMemory(memory_name, num_relevant) | ||
# test the openai api since we need it to make embeddings. | ||
get_ada_embedding("test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intentional ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @dschonholtz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey sorry. Yes, we want to make sure we can make embeddings. WIll throw an error otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I was talking about the hard coded "test", it's been fixed
### Setting up environment variables | ||
For Windows Users: | ||
``` | ||
setx PINECONE_API_KEY "YOUR_GOOGLE_API_KEY" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Google?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setx PINECONE_API_KEY "YOUR_GOOGLE_API_KEY" | |
setx PINECONE_API_KEY "YOUR_PINECONE_API_KEY" |
### Setting up environment variables | ||
For Windows Users: | ||
``` | ||
setx PINECONE_API_KEY "YOUR_GOOGLE_API_KEY" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setx PINECONE_API_KEY "YOUR_GOOGLE_API_KEY" | |
setx PINECONE_API_KEY "YOUR_PINECONE_API_KEY" |
``` | ||
For macOS and Linux users: | ||
``` | ||
export PINECONE_API_KEY="YOUR_GOOGLE_API_KEY" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export PINECONE_API_KEY="YOUR_GOOGLE_API_KEY" | |
export PINECONE_API_KEY="YOUR_PINECONE_API_KEY" |
2. No user assistance | ||
3. Exclusively use the commands listed in double quotes e.g. "command name" | ||
1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files. | ||
2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Might want to consider https://github.com/featureform/featureform |
I realize I'm about 10 hours late to the game, but why do the memory in pinecone? If you need a vector database, use something like FAISS. If you need unstructured, pickle or Elasticsearch. Sql, sqlite3. If you need ada embeddings, use OpenAIEmbeddings(). This introduces additional calls and makes a requirement for a pinecone API key. Can someone explain the advantages? |
I would prefer an open source option for vector embeddings, like weaviate,
https://github.com/weaviate/weaviate or milvus
https://github.com/milvus-io/milvus
A commercial cloud option, like pinecone, is fine for many businesses, but
for indie hackers it can be a significant drawback to be constrained to the
free tier.
…On Thu, 6 Apr 2023, 22:22 cvarrichio, ***@***.***> wrote:
I realize I'm about 10 hours late to the game, but why do the memory in
pinecone? If you need a vector database, use something like FAISS. If you
need unstructured, pickle or Elasticsearch. Sql, sqlite3. If you need ada
embeddings, use OpenAIEmbeddings(). This introduces additional calls and
makes a requirement for a pinecone API key. Can someone explain the
advantages?
—
Reply to this email directly, view it on GitHub
<#122 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE476NCO5XC65II62BWDFXDW74XYXANCNFSM6AAAAAAWR7326E>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
FAISS and Chroma are also open source and on github and pypi. I do not know of a specific feature comparison between them. |
Notice that #372 has been merged, implementing memory based on the open-source Redis (it's not known as a vector database, but apparently supports vector similarity search to some extent; not claiming it's the best). BTW, Pinecone seems to use FAISS. |
Did you consider storing all intermediate steps in memory as well? I am particularly thinking about chunks generated during web browsing. It would be great to store and embed the chunks so gpt can refer to them later. |
What this does: