Skip to content
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

Refactoring CLI to use config file, connect to Llama Index data sources, and allow for multiple agents #154

Merged
merged 31 commits into from
Oct 30, 2023

Conversation

sarahwooders
Copy link
Collaborator

@sarahwooders sarahwooders commented Oct 27, 2023

Builds on top of #146

Example running on hugging face dataset (loaded with Llama Index):

image

Updated CLI

Starting Agent

> memgpt run [--agent <agent-name>] 

Configuring defaults

> memgpt configure 

? Do you want to enable MemGPT with Open AI? Yes
? Use OpenAI as default provider? Yes
? Do you want to enable MemGPT with Azure? No
? Select default model (recommended: gpt-4): gpt-4
['/Users/sarahwooders/repos/MemGPT/memgpt']
['sam_pov', 'memgpt_starter', 'memgpt_doc', 'sam_simple_pov_gpt35', 'sam', 'memgpt_doc', 'basic']
? Select default persona: sam_pov
['cs_phd', 'basic', 'basic']
? Select default human: cs_phd
Saving config to /Users/sarahwooders/.memgpt/config

Loading External Data

External data connectors via Llama Index connectors implemented in cli/cli_load.py:

memgpt load [directory/database] [ARGS]

This data source can now be attached to an agent by running memgpt run --data-source <source-name>.

Listing Options (Agents, Humans, Personas, Data Sources)

> memgpt list [agents/humans/personas/sources]

> memgpt list humans

+------------+---------------------------------------------------------------------------------------------+
|    Name    |                                             Text                                            |
+------------+---------------------------------------------------------------------------------------------+
| cs_phd.txt | This is what I know so far about the user, I should expand this as I learn more about them. |
|            |                                                                                             |
|            |                                       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     |
| basic.txt  |                                       First name: Chad                                      |
|   basic    |                                       First name: Chad                                      |
+------------+---------------------------------------------------------------------------------------------+

Adding Personas/Humans

memgpt add [persona/human] --name <name> [-f <filepath>] [--text <text>]

Directory Structure

Configuration, credentials, agent state, and persona/human options are all saved in ~/.memgpt.

~/.memgpt
    /agents 
       /<agent_name> 
          config.json # agent config 
          /agent_state # message state
          /persistence_manager # persistence manager state
      ...
    /humans
        <human_name> # file with human persona 
        ...
    /personas
        <persona_name> # file with persona  
        ...
   /archival 
       /<index-name> # directory containing saved Llama Index 
        ...
   config # config file 

Legacy Support

Both legacy commands should still work:

> memgpt 
> python main.py

To-Dos

  • Connect Llama Index embedding configuration with MemGPTConfig values
  • Graceful Ctrl-D/Ctrl-C exits
  • Test agent checkpointing
  • Beautify messages ✨

@sarahwooders sarahwooders marked this pull request as draft October 27, 2023 19:31
@vivi vivi mentioned this pull request Oct 27, 2023
1 task
@sarahwooders sarahwooders marked this pull request as ready for review October 29, 2023 19:16
@sarahwooders sarahwooders changed the title [DRAFT] Refactoring CLI to use config file, connect to Llama Index data sources, and allow for multiple agents Refactoring CLI to use config file, connect to Llama Index data sources, and allow for multiple agents Oct 30, 2023
@cpacker
Copy link
Collaborator

cpacker commented Oct 30, 2023

If you say no to using OpenAI, and let the process crash out:

image

Then you run memgpt run afterwards and say "No" to select existing agent, it ends with:

image

instead of taking back to the first loop asking for an OpenAI key / if you want to use OpenAI (if you set OPENAI_API_KEY it allows you to progress)

memgpt/main.py Outdated Show resolved Hide resolved
memgpt/cli/cli_config.py Outdated Show resolved Hide resolved
@sarahwooders
Copy link
Collaborator Author

@cpacker do you have a local model endpoint to test with? I fixed the hugging face embeddings model, so the vector index should work locally now.

@sarahwooders sarahwooders merged commit b7f9560 into letta-ai:main Oct 30, 2023
1 check passed
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
…es, and allow for multiple agents (#154)

* Migrate to `memgpt run` and `memgpt configure` 
* Add Llama index data sources via `memgpt load` 
* Save config files for defaults and agents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants