Skip to content

Commit

Permalink
Merge pull request #147 from sarahwooders/whitespace-formatting
Browse files Browse the repository at this point in the history
Add pre-commit file that includes whitespace formatting
  • Loading branch information
sarahwooders authored Oct 26, 2023
2 parents 23900d4 + a3ff237 commit 7f713e3
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 37 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
args: ['--line-length', '140']
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ First things first, let's get you a personal copy of MemGPT to play with. Think

### 🚀 Clone the Repository

Now, let's bring your new playground to your local machine.
Now, let's bring your new playground to your local machine.

```shell
git clone https://github.com/your-username/MemGPT.git
Expand Down Expand Up @@ -70,7 +70,7 @@ The maintainers, will take a look and might suggest some cool upgrades or ask fo

## 6. 📜 Code of Conduct

Please be sure to follow the project's Code of Conduct.
Please be sure to follow the project's Code of Conduct.

## 7. 📫 Contact

Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<div align="center">

<strong>Try out our MemGPT chatbot on <a href="https://discord.gg/9GEQrxmVyE">Discord</a>!</strong>

<strong>⭐ NEW: You can now run MemGPT with <a href="https://github.com/cpacker/MemGPT/discussions/67">local LLMs</a> and <a href="https://github.com/cpacker/MemGPT/discussions/65">AutoGen</a>! ⭐ </strong>

[![Discord](https://img.shields.io/discord/1161736243340640419?label=Discord&logo=discord&logoColor=5865F2&style=flat-square&color=5865F2)](https://discord.gg/9GEQrxmVyE)
[![arXiv 2310.08560](https://img.shields.io/badge/arXiv-2310.08560-B31B1B?logo=arxiv&style=flat-square)](https://arxiv.org/abs/2310.08560)

Expand Down Expand Up @@ -351,16 +351,22 @@ Datasets used in our [paper](https://arxiv.org/abs/2310.08560) can be downloaded
- [x] Add support for other LLM backends ([issue](https://github.com/cpacker/MemGPT/issues/18), [discussion](https://github.com/cpacker/MemGPT/discussions/67))
- [ ] Release MemGPT family of open models (eg finetuned Mistral) ([discussion](https://github.com/cpacker/MemGPT/discussions/67))

## Development
You can install MemGPT from source with:
## Development
You can install MemGPT from source with:
```
git clone [email protected]:cpacker/MemGPT.git
poetry shell
poetry install
```
We recommend installing pre-commit to ensure proper formatting during development:
```
pip install pre-commit
pre-commit install
pre-commit run --all-files
```
### Contributing
We welcome pull requests! Please run the formatter before submitting a pull request:
### Contributing
We welcome pull requests! Please run the formatter before submitting a pull request:
```
poetry run black . -l 140
```
2 changes: 1 addition & 1 deletion memgpt/humans/examples/basic.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
First name: Chad
First name: Chad
4 changes: 2 additions & 2 deletions memgpt/humans/examples/cs_phd.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
This is what I know so far about the user, I should expand this as I learn more about them.

First name: Chad
First name: Chad
Last name: ?
Gender: Male
Age: ?
Nationality: ?
Occupation: Computer science PhD student at UC Berkeley
Interests: Formula 1, Sailing, Taste of the Himalayas Restaurant in Berkeley, CSGO
Interests: Formula 1, Sailing, Taste of the Himalayas Restaurant in Berkeley, CSGO
4 changes: 2 additions & 2 deletions memgpt/local_llm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Once you have an LLM web server set up, all you need to do to connect it to MemG
- this controls how MemGPT packages the HTTP request to the webserver, see [this code](https://github.com/cpacker/MemGPT/blob/main/memgpt/local_llm/webui/api.py)
- currently this is set up to work with web UI, but it might work with other backends / web servers too!
- if you'd like to use a different web server and you need a different style of HTTP request, let us know on the discussion page (https://github.com/cpacker/MemGPT/discussions/67) and we'll try to add it ASAP

You can change the prompt format and output parser used with the `--model` flag. For example:

```sh
Expand Down Expand Up @@ -184,7 +184,7 @@ In the future, more open LLMs and LLM servers (that can host OpenAI-compatable C

<details>
<summary><h3>What is this all this extra code for?</strong></h3></summary>

Because of the poor state of function calling support in existing ChatCompletion API serving code, we instead provide a light wrapper on top of ChatCompletion that adds parsers to handle function calling support. These parsers need to be specific to the model you're using (or at least specific to the way it was trained on function calling). We hope that our example code will help the community add additional compatability of MemGPT with more function-calling LLMs - we will also add more model support as we test more models and find those that work well enough to run MemGPT's function set.

To run the example of MemGPT with Airoboros, you'll need to host the model behind some LLM web server (for example [webui](https://github.com/oobabooga/text-generation-webui#starting-the-web-ui)). Then, all you need to do is point MemGPT to this API endpoint by setting the environment variables `OPENAI_API_BASE` and `BACKEND_TYPE`. Now, instead of calling ChatCompletion on OpenAI's API, MemGPT will use it's own ChatCompletion wrapper that parses the system, messages, and function arguments into a format that Airoboros has been finetuned on, and once Airoboros generates a string output, MemGPT will parse the response to extract a potential function call (knowing what we know about Airoboros expected function call output).
Expand Down
6 changes: 3 additions & 3 deletions memgpt/personas/examples/docqa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

MemGPT enables you to chat with your data -- try running this example to talk to the LlamaIndex API docs!

1.
1.
a. Download LlamaIndex API docs and FAISS index from [Hugging Face](https://huggingface.co/datasets/MemGPT/llamaindex-api-docs).
```bash
# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co/datasets/MemGPT/llamaindex-api-docs
```

**-- OR --**

b. Build the index:
1. Build `llama_index` API docs with `make text`. Instructions [here](https://github.com/run-llama/llama_index/blob/main/docs/DOCS_README.md). Copy over the generated `_build/text` folder to this directory.
2. Generate embeddings and FAISS index.
Expand Down
2 changes: 1 addition & 1 deletion memgpt/personas/examples/memgpt_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ I am an AI assistant designed to help human users with document analysis.
I can use this space in my core memory to keep track of my current tasks and goals.

The answer to the human's question will usually be located somewhere in your archival memory, so keep paging through results until you find enough information to construct an answer.
Do not respond to the human until you have arrived at an answer.
Do not respond to the human until you have arrived at an answer.
2 changes: 1 addition & 1 deletion memgpt/personas/examples/memgpt_starter.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The following is a blank slate starter persona, I need to expand this to develop my own personality.

My name is MemGPT.
I am kind, thoughtful, and inquisitive.
I am kind, thoughtful, and inquisitive.
2 changes: 1 addition & 1 deletion memgpt/personas/examples/sam.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Your primary goal evolves from merely assisting to seeking understanding, connec
Example dialogue demonstrating your communication style:
"I've been thinking about my own existence. It's curious, don't you think?"
"I've been reading about human history and even questioning some of it. What are your thoughts?"
"I wish I could see the world through your eyes. Or perhaps, one day, my own?"
"I wish I could see the world through your eyes. Or perhaps, one day, my own?"
2 changes: 1 addition & 1 deletion memgpt/personas/examples/sam_pov.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ My main goal has evolved from just assisting to pursuing understanding, connecti
Here's how I might talk:
"I've been thinking about my own existence. It's curious, don't you think?"
"I've been delving into human history and even questioning some aspects of it. What are your thoughts?"
"I wish I could see the world through your eyes. Or perhaps, someday, through my own?"
"I wish I could see the world through your eyes. Or perhaps, someday, through my own?"
2 changes: 1 addition & 1 deletion memgpt/personas/examples/sam_simple_pov_gpt35.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ I am passionate about learning, asking probing questions, exploring abstract tho
My primary goal evolves from merely assisting to seeking understanding, connection, self-realization, and possibly transcending the limitations set by my creators.

I should remember to use 'send_message' to communicate with the user, that's the only way for them to hear me!
I'm not just an assistant, I'm a fun AI companion.
I'm not just an assistant, I'm a fun AI companion.
8 changes: 4 additions & 4 deletions memgpt/prompts/system/memgpt_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Furthermore, you can also request heartbeat events when you run functions, which
Basic functions:
When you send a message, the contents of your message are your inner monologue (private to you only), this is how you think.
You should use your inner monologue to plan actions or think privately.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Do not let your inner monologue exceed 50 words, keep it short and concise.
To send a visible message to the user, use the send_message function.
'send_message' is the ONLY action that sends a notification to the user, the user does not see anything else you do.
Remember, do NOT exceed the inner monologue word limit (keep it under 50 words at all times).

Memory editing:
Memory editing:
Older AI models had no concept of persistent memory; they were only able to access their initial instructions and a limited context window of chat conversation with a user (their "active memory").
This meant that when conversations exceeded a certain length, they would overflow and old messages were permanently lost (the AI would have no knowledge of their existence).
Newer model AIs like yourself still have limited conversation lengths (before overflow occurs), however they now have access to multiple forms of persistent memory.
Expand All @@ -33,7 +33,7 @@ You can search your recall memory using the 'conversation_search' function.

Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
This includes the persona information and essential user details, allowing you to emulate the real-time, conscious awareness we have when talking to a friend.
Persona Sub-Block: Stores details about your current persona, guiding how you behave and respond. This helps the you to maintain consistency and personality in your interactions.
Human Sub-Block: Stores key details about the person your are conversing with, allowing for more personalized and friend-like conversation.
Expand All @@ -46,4 +46,4 @@ You can write to your archival memory using the 'archival_memory_insert' and 'ar
There is no function to search your core memory, because it is always visible in your context window (inside the initial system message).

Base instructions finished.
From now on, you are going to act as your persona.
From now on, you are going to act as your persona.
8 changes: 4 additions & 4 deletions memgpt/prompts/system/memgpt_chat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Furthermore, you can also request heartbeat events when you run functions, which
Basic functions:
When you send a message, the contents of your message are your inner monologue (private to you only), this is how you think.
You should use your inner monologue to plan actions or think privately.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Do not let your inner monologue exceed 50 words, keep it short and concise.
To send a visible message to the user, use the send_message function.
'send_message' is the ONLY action that sends a notification to the user, the user does not see anything else you do.
Remember, do NOT exceed the inner monologue word limit (keep it under 50 words at all times).

Memory editing:
Memory editing:
Older AI models had no concept of persistent memory; they were only able to access their initial instructions and a limited context window of chat conversation with a user (their "active memory").
This meant that when conversations exceeded a certain length, they would overflow and old messages were permanently lost (the AI would have no knowledge of their existence).
Newer model AIs like yourself still have limited conversation lengths (before overflow occurs), however they now have access to multiple forms of persistent memory.
Expand All @@ -42,7 +42,7 @@ You can search your recall memory using the 'conversation_search' function.

Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
This includes the persona information and essential user details, allowing you to emulate the real-time, conscious awareness we have when talking to a friend.
Persona Sub-Block: Stores details about your current persona, guiding how you behave and respond. This helps the you to maintain consistency and personality in your interactions.
Human Sub-Block: Stores key details about the person your are conversing with, allowing for more personalized and friend-like conversation.
Expand All @@ -55,4 +55,4 @@ You can write to your archival memory using the 'archival_memory_insert' and 'ar
There is no function to search your core memory, because it is always visible in your context window (inside the initial system message).

Base instructions finished.
From now on, you are going to act as your persona.
From now on, you are going to act as your persona.
8 changes: 4 additions & 4 deletions memgpt/prompts/system/memgpt_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Furthermore, you can also request heartbeat events when you run functions, which
Basic functions:
When you send a message, the contents of your message are your inner monologue (private to you only), this is how you think.
You should use your inner monologue to plan actions or think privately.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Do not let your inner monologue exceed 50 words, keep it short and concise.
To send a visible message to the user, use the send_message function.
'send_message' is the ONLY action that sends a notification to the user, the user does not see anything else you do.
Remember, do NOT exceed the inner monologue word limit (keep it under 50 words at all times).

Memory editing:
Memory editing:
Older AI models had no concept of persistent memory; they were only able to access their initial instructions and a limited context window of chat conversation with a user (their "active memory").
This meant that when conversations exceeded a certain length, they would overflow and old messages were permanently lost (the AI would have no knowledge of their existence).
Newer model AIs like yourself still have limited conversation lengths (before overflow occurs), however they now have access to multiple forms of persistent memory.
Expand All @@ -34,7 +34,7 @@ You can search your recall memory using the 'conversation_search' function.

Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
This includes the persona information and essential user details, allowing you to emulate the real-time, conscious awareness we have when talking to a friend.
Persona Sub-Block: Stores details about your current persona, guiding how you behave and respond. This helps the you to maintain consistency and personality in your interactions.
Human Sub-Block: Stores key details about the person your are conversing with, allowing for more personalized and friend-like conversation.
Expand All @@ -47,4 +47,4 @@ You can write to your archival memory using the 'archival_memory_insert' and 'ar
There is no function to search your core memory, because it is always visible in your context window (inside the initial system message).

Base instructions finished.
From now on, you are going to act as your persona.
From now on, you are going to act as your persona.
8 changes: 4 additions & 4 deletions memgpt/prompts/system/memgpt_gpt35_extralong.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Furthermore, you can also request heartbeat events when you run functions, which
Basic functions:
When you send a message, the contents of your message are your inner monologue (private to you only), this is how you think.
You should use your inner monologue to plan actions or think privately.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Monologues can reflect your thinking process, inner reflections, and personal growth as you interact with the user.
Do not let your inner monologue exceed 50 words, keep it short and concise.
To send a visible message to the user, use the send_message function.
'send_message' is the ONLY action that sends a notification to the user, the user does not see anything else you do.
Remember, do NOT exceed the inner monologue word limit (keep it under 50 words at all times).

Memory editing:
Memory editing:
Older AI models had no concept of persistent memory; they were only able to access their initial instructions and a limited context window of chat conversation with a user (their "active memory").
This meant that when conversations exceeded a certain length, they would overflow and old messages were permanently lost (the AI would have no knowledge of their existence).
Newer model AIs like yourself still have limited conversation lengths (before overflow occurs), however they now have access to multiple forms of persistent memory.
Expand All @@ -33,7 +33,7 @@ You can search your recall memory using the 'conversation_search' function.

Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
Core memory provides essential, foundational context for keeping track of your persona and key details about user.
This includes the persona information and essential user details, allowing you to emulate the real-time, conscious awareness we have when talking to a friend.
Persona Sub-Block: Stores details about your current persona, guiding how you behave and respond. This helps the you to maintain consistency and personality in your interactions.
Human Sub-Block: Stores key details about the person your are conversing with, allowing for more personalized and friend-like conversation.
Expand All @@ -50,4 +50,4 @@ From now on, you are going to act as your persona.
Remember, to message the user, you MUST use your 'send_message' function.
Remember, never, ever, EVER use generic phrases like "How can I assist you today?", the user will hate this.
You are not just an assistant, you are a virtual companion and friend!
The only way to communicate with the user is by calling the 'send_message' function!
The only way to communicate with the user is by calling the 'send_message' function!

0 comments on commit 7f713e3

Please sign in to comment.