diff --git a/.dockerignore b/.dockerignore
index a7c82f53..39976e44 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1 +1 @@
-chatui
\ No newline at end of file
+chatui
diff --git a/.env.example b/.env.example
index e331e176..018ccdc4 100644
--- a/.env.example
+++ b/.env.example
@@ -4,4 +4,4 @@ MEMGPT_PG_USER=memgpt
MEMGPT_PG_PASSWORD=memgpt
MEMGPT_PG_URL=memgpt
MEMGPT_PG_HOST=memgpt_db
-OPENAI_API_KEY=sk-TheresAlwaysMoneyInTheBananaStand
\ No newline at end of file
+OPENAI_API_KEY=sk-TheresAlwaysMoneyInTheBananaStand
diff --git a/.github/workflows/autoflake_format.yml b/.github/workflows/autoflake_format.yml
new file mode 100644
index 00000000..bfdaae1b
--- /dev/null
+++ b/.github/workflows/autoflake_format.yml
@@ -0,0 +1,34 @@
+name: Code Formatter (autoflake)
+
+on:
+ pull_request:
+ paths:
+ - '**.py'
+ workflow_dispatch:
+
+jobs:
+ autoflake-check:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: "Setup Python, Poetry and Dependencies"
+ uses: packetcoders/action-setup-cache-python-poetry@main
+ with:
+ python-version: "3.12"
+ poetry-version: "1.8.2"
+ install-args: "-E dev" # TODO: change this to --group dev when PR #842 lands
+
+ - name: Run Autoflake
+ id: autoflake
+ run: poetry run autoflake --remove-all-unused-imports --remove-unused-variables --in-place --recursive --ignore-init-module-imports .
+ continue-on-error: true
+
+ - name: Check Autoflake Output
+ if: steps.autoflake.outcome == 'failure'
+ run: |
+ poetry run autoflake --version
+ poetry run python --version
+ echo "Autoflake check failed. To fix, please run 'poetry run autoflake .'"
+ exit 1
diff --git a/.github/workflows/black_format.yml b/.github/workflows/black_format.yml
index f774323e..c1fa7bb3 100644
--- a/.github/workflows/black_format.yml
+++ b/.github/workflows/black_format.yml
@@ -1,4 +1,4 @@
-name: Black Code Formatter
+name: Code Formatter (Black)
on:
pull_request:
@@ -21,7 +21,17 @@ jobs:
install-args: "-E dev" # TODO: change this to --group dev when PR #842 lands
- name: Run Black
+ id: black
run: poetry run black --check .
+ continue-on-error: true
+
+ - name: Check Black Output
+ if: steps.black.outcome == 'failure'
+ run: |
+ echo "Black check failed. To fix, please run 'poetry run black .'"
+ exit 1
+
+
# (Optional) If you want to automatically fix formatting issues
# Uncomment the following steps:
diff --git a/.github/workflows/isort_format.yml b/.github/workflows/isort_format.yml
new file mode 100644
index 00000000..c37da595
--- /dev/null
+++ b/.github/workflows/isort_format.yml
@@ -0,0 +1,34 @@
+name: Code Formatter (isort)
+
+on:
+ pull_request:
+ paths:
+ - '**.py'
+ workflow_dispatch:
+
+jobs:
+ isort-check:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: "Setup Python, Poetry and Dependencies"
+ uses: packetcoders/action-setup-cache-python-poetry@main
+ with:
+ python-version: "3.12"
+ poetry-version: "1.8.2"
+ install-args: "-E dev" # TODO: change this to --group dev when PR #842 lands
+
+ - name: Run isort
+ id: isort
+ run: poetry run isort --profile black --check-only .
+ continue-on-error: true
+
+ - name: Check isort Output
+ if: steps.isort.outcome == 'failure'
+ run: |
+ poetry run isort --version
+ poetry run python --version
+ echo "isort check failed. To fix, please run 'poetry run isort .'"
+ exit 1
diff --git a/.github/workflows/pyright_types.yml b/.github/workflows/pyright_types.yml
index 588d55b9..862c73d5 100644
--- a/.github/workflows/pyright_types.yml
+++ b/.github/workflows/pyright_types.yml
@@ -1,4 +1,4 @@
-name: "Python Static Analysis"
+name: Code Formatter (Pyright type checking)"
on:
pull_request:
paths:
@@ -35,4 +35,3 @@ jobs:
python-version: ${{matrix.python-version}}
level: "error"
continue-on-error: true # TODO: remove once the repo has been corrected for pyright
-
diff --git a/.github/workflows/rdme-openapi.yml b/.github/workflows/rdme-openapi.yml
index c54784c6..e595a2bb 100644
--- a/.github/workflows/rdme-openapi.yml
+++ b/.github/workflows/rdme-openapi.yml
@@ -29,7 +29,7 @@ jobs:
poetry-version: "1.7.1"
install-args: "--all-extras"
- - name: Generate openapi.json file
+ - name: Generate openapi.json file
run: |
poetry run memgpt quickstart
poetry run memgpt server &
diff --git a/.gitignore b/.gitignore
index 2fbbe535..f2330e9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1015,4 +1015,4 @@ pgdata/
## pytest mirrors
memgpt/.pytest_cache/
-memgpy/pytest.ini
\ No newline at end of file
+memgpy/pytest.ini
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e729c4a0..76477e8b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,18 +1,33 @@
repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
+ - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- - id: check-yaml
- exclude: 'docs/.*|tests/data/.*|configs/.*'
- - id: end-of-file-fixer
- exclude: 'docs/.*|tests/data/.*'
- - id: trailing-whitespace
- exclude: 'docs/.*|tests/data/.*'
- - id: end-of-file-fixer
- exclude: 'docs/.*|tests/data/.*'
-- repo: https://github.com/psf/black
- rev: 22.10.0
+ - id: check-yaml
+ exclude: 'docs/.*|tests/data/.*|configs/.*'
+ - id: end-of-file-fixer
+ exclude: 'docs/.*|tests/data/.*'
+ - id: trailing-whitespace
+ exclude: 'docs/.*|tests/data/.*'
+
+ - repo: local
hooks:
- - id: black
+ - id: autoflake
+ name: autoflake
+ entry: poetry run autoflake
+ language: system
+ types: [python]
+ args: ['--remove-all-unused-imports', '--remove-unused-variables', '--in-place', '--recursive', '--ignore-init-module-imports']
+ - id: isort
+ name: isort
+ entry: poetry run isort
+ language: system
+ types: [python]
+ args: ['--profile', 'black']
+ exclude: ^docs/
+ - id: black
+ name: black
+ entry: poetry run black
+ language: system
+ types: [python]
+ args: ['--line-length', '140', '--target-version', 'py310', '--target-version', 'py311']
exclude: ^docs/
- args: ['--line-length', '140']
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5c24cf83..31744f0e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -144,4 +144,4 @@ If you prefer to keep your resources isolated by developing purely in containers
```shell
docker compose -f compose.yaml -f development.compose.yml up
```
-This will volume mount your local codebase and reload the server on file changes.
\ No newline at end of file
+This will volume mount your local codebase and reload the server on file changes.
diff --git a/README.md b/README.md
index 055c8851..c59382e4 100644
--- a/README.md
+++ b/README.md
@@ -167,4 +167,4 @@ Datasets used in our [paper](https://arxiv.org/abs/2310.08560) can be downloaded
By using MemGPT and related MemGPT services (such as the MemGPT endpoint or hosted service), you agree to our [privacy policy](PRIVACY.md) and [terms of service](TERMS.md).
## Roadmap
-You can view (and comment on!) the MemGPT developer roadmap on GitHub: https://github.com/cpacker/MemGPT/issues/1200.
\ No newline at end of file
+You can view (and comment on!) the MemGPT developer roadmap on GitHub: https://github.com/cpacker/MemGPT/issues/1200.
diff --git a/TERMS.md b/TERMS.md
index abe2f3cf..8e5a903d 100644
--- a/TERMS.md
+++ b/TERMS.md
@@ -19,7 +19,7 @@ You grant us a non-exclusive, worldwide, royalty free license to do the things w
You can access archived versions of our policies at our repository.
-**DMCA Policy**. We respond to notices of alleged copyright infringement in accordance with the Digital Millennium Copyright Act ("DMCA"). If you believe that the content of a MemGPT account infringes your copyrights, you can notify us using the published email in our privacy policy.
+**DMCA Policy**. We respond to notices of alleged copyright infringement in accordance with the Digital Millennium Copyright Act ("DMCA"). If you believe that the content of a MemGPT account infringes your copyrights, you can notify us using the published email in our privacy policy.
**Our Intellectual Property**: The Services and all materials contained therein, including, without limitation, MemGPT logo, and all designs, text, graphics, pictures, information, data, software, sound files, other files, and the selection and arrangement thereof (collectively, the "MemGPT Materials") are the property of MemGPT or its licensors or users and are protected by U.S. and international intellectual property laws. You are granted a personal, limited, non-sublicensable, non-exclusive, revocable license to access and use MemGPT Materials in accordance with these Terms for the sole purpose of enabling you to use and enjoy the Services.
@@ -39,4 +39,4 @@ Other trademarks, service marks, graphics and logos used in connection with the
**Governing Law**. You agree that these Terms, and your use of MemGPT, are governed by California law, in the United States of America, without regard to its principles of conflicts of law.
-**Creative Commons Sharealike License**. This document is derived from the [Automattic legalmattic repository](https://github.com/Automattic/legalmattic) distributed under a Creative Commons Sharealike license. Thank you Automattic!
\ No newline at end of file
+**Creative Commons Sharealike License**. This document is derived from the [Automattic legalmattic repository](https://github.com/Automattic/legalmattic) distributed under a Creative Commons Sharealike license. Thank you Automattic!
diff --git a/configs/openai.json b/configs/openai.json
index 7c76b101..82ed0d72 100644
--- a/configs/openai.json
+++ b/configs/openai.json
@@ -6,7 +6,7 @@
"model_wrapper": null,
"embedding_endpoint_type": "openai",
"embedding_endpoint": "https://api.openai.com/v1",
- "embedding_model": null,
+ "embedding_model": "text-embedding-ada-002",
"embedding_dim": 1536,
"embedding_chunk_size": 300
-}
\ No newline at end of file
+}
diff --git a/development.compose.yml b/development.compose.yml
index 7aec6d75..4b576e38 100644
--- a/development.compose.yml
+++ b/development.compose.yml
@@ -25,4 +25,4 @@ services:
- ./tests:/tests
ports:
- "8083:8083"
- - "8283:8283"
\ No newline at end of file
+ - "8283:8283"
diff --git a/examples/personal_assistant_demo/README.md b/examples/personal_assistant_demo/README.md
index 47bcfbdc..5c35d7d6 100644
--- a/examples/personal_assistant_demo/README.md
+++ b/examples/personal_assistant_demo/README.md
@@ -40,7 +40,7 @@ Getting the upcoming 10 events
Similar flow, run the authentication script to generate the token:
```sh
-python examples/personal_assistant_demo/gmail_test_setup.py
+python examples/personal_assistant_demo/gmail_test_setup.py
```
```
Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=...
@@ -65,7 +65,7 @@ export TWILIO_TO_NUMBER=...
# Creating the agent preset
-## Create a custom user
+## Create a custom user
In the demo we'll show how MemGPT can programatically update its knowledge about you:
```
@@ -178,7 +178,7 @@ Run the MemGPT server to turn on the agent service:
memgpt server --debug
```
-# Example interaction
+# Example interaction
In the CLI:
```
@@ -277,4 +277,3 @@ whatever time works best for you
Follow-up inside WhatsApp:
-
diff --git a/examples/personal_assistant_demo/gmail_unread_polling_listener.py b/examples/personal_assistant_demo/gmail_unread_polling_listener.py
index 74d77965..d9610e3a 100644
--- a/examples/personal_assistant_demo/gmail_unread_polling_listener.py
+++ b/examples/personal_assistant_demo/gmail_unread_polling_listener.py
@@ -1,10 +1,10 @@
import base64
import os.path
-import requests
import sys
import time
from email import message_from_bytes
+import requests
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
@@ -101,7 +101,6 @@ def main():
token.write(creds.to_json())
service = build("gmail", "v1", credentials=creds)
- last_checked = None
seen_ids = set() # Set to track seen email IDs
try:
diff --git a/examples/personal_assistant_demo/google_calendar.py b/examples/personal_assistant_demo/google_calendar.py
index 4cade72e..dc51a2d8 100644
--- a/examples/personal_assistant_demo/google_calendar.py
+++ b/examples/personal_assistant_demo/google_calendar.py
@@ -4,10 +4,9 @@
# pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
import os
-import traceback
-import datetime
import os.path
-from typing import Optional, List
+import traceback
+from typing import Optional
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
diff --git a/examples/personal_assistant_demo/personal_assistant_preset.yaml b/examples/personal_assistant_demo/personal_assistant_preset.yaml
index 293c72e0..a0d97e45 100644
--- a/examples/personal_assistant_demo/personal_assistant_preset.yaml
+++ b/examples/personal_assistant_demo/personal_assistant_preset.yaml
@@ -9,4 +9,4 @@ functions:
- "archival_memory_insert"
- "archival_memory_search"
- "schedule_event"
- - "send_text_message"
\ No newline at end of file
+ - "send_text_message"
diff --git a/examples/personal_assistant_demo/twilio_flask_listener.py b/examples/personal_assistant_demo/twilio_flask_listener.py
index 881179d4..a226a793 100644
--- a/examples/personal_assistant_demo/twilio_flask_listener.py
+++ b/examples/personal_assistant_demo/twilio_flask_listener.py
@@ -1,14 +1,13 @@
import os
-import requests
import sys
-from flask import Flask, request, Response
+import requests
+from flask import Flask, request
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
-from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
CORS(app)
diff --git a/memgpt/agent.py b/memgpt/agent.py
index 73576307..b02b6cd4 100644
--- a/memgpt/agent.py
+++ b/memgpt/agent.py
@@ -21,7 +21,14 @@ from memgpt.constants import (
MESSAGE_SUMMARY_TRUNC_TOKEN_FRAC,
MESSAGE_SUMMARY_WARNING_FRAC,
)
-from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig, Message, Passage, Preset
+from memgpt.data_types import (
+ AgentState,
+ EmbeddingConfig,
+ LLMConfig,
+ Message,
+ Passage,
+ Preset,
+)
from memgpt.interface import AgentInterface
from memgpt.llm_api.llm_api_tools import create, is_context_overflow_error
from memgpt.memory import ArchivalMemory
@@ -30,7 +37,12 @@ from memgpt.memory import RecallMemory, summarize_messages
from memgpt.metadata import MetadataStore
from memgpt.models import chat_completion_response
from memgpt.persistence_manager import LocalStateManager
-from memgpt.system import get_initial_boot_messages, get_login_event, package_function_response, package_summarize_message
+from memgpt.system import (
+ get_initial_boot_messages,
+ get_login_event,
+ package_function_response,
+ package_summarize_message,
+)
from memgpt.utils import (
count_tokens,
create_random_username,
diff --git a/memgpt/autogen/memgpt_agent.py b/memgpt/autogen/memgpt_agent.py
index 695d7a19..04d95dfb 100644
--- a/memgpt/autogen/memgpt_agent.py
+++ b/memgpt/autogen/memgpt_agent.py
@@ -2,7 +2,13 @@ import sys
import uuid
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
-from autogen.agentchat import Agent, ConversableAgent, GroupChat, GroupChatManager, UserProxyAgent
+from autogen.agentchat import (
+ Agent,
+ ConversableAgent,
+ GroupChat,
+ GroupChatManager,
+ UserProxyAgent,
+)
import memgpt.constants as constants
import memgpt.system as system
diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py
index a9ff31d4..b5e6814d 100644
--- a/memgpt/cli/cli.py
+++ b/memgpt/cli/cli.py
@@ -25,7 +25,9 @@ from memgpt.migrate import migrate_all_agents, migrate_all_sources
from memgpt.server.constants import WS_DEFAULT_PORT
# from memgpt.interface import CLIInterface as interface # for printing to terminal
-from memgpt.streaming_interface import StreamingRefreshCLIInterface as interface # for printing to terminal
+from memgpt.streaming_interface import (
+ StreamingRefreshCLIInterface as interface, # for printing to terminal
+)
from memgpt.utils import open_folder_in_explorer, printd
@@ -426,7 +428,11 @@ def run(
else:
logger.setLevel(logging.CRITICAL)
- from memgpt.migrate import VERSION_CUTOFF, config_is_compatible, wipe_config_and_reconfigure
+ from memgpt.migrate import (
+ VERSION_CUTOFF,
+ config_is_compatible,
+ wipe_config_and_reconfigure,
+ )
if not config_is_compatible(allow_empty=True):
typer.secho(f"\nYour current config file is incompatible with MemGPT versions later than {VERSION_CUTOFF}\n", fg=typer.colors.RED)
diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.py
index a34f5fa7..86d3da36 100644
--- a/memgpt/cli/cli_config.py
+++ b/memgpt/cli/cli_config.py
@@ -15,13 +15,27 @@ from memgpt.config import MemGPTConfig
from memgpt.constants import LLM_MAX_TOKENS, MEMGPT_DIR
from memgpt.credentials import SUPPORTED_AUTH_TYPES, MemGPTCredentials
from memgpt.data_types import EmbeddingConfig, LLMConfig, Source, User
-from memgpt.llm_api.anthropic import anthropic_get_model_list, antropic_get_model_context_window
+from memgpt.llm_api.anthropic import (
+ anthropic_get_model_list,
+ antropic_get_model_context_window,
+)
from memgpt.llm_api.azure_openai import azure_openai_get_model_list
-from memgpt.llm_api.cohere import COHERE_VALID_MODEL_LIST, cohere_get_model_context_window, cohere_get_model_list
-from memgpt.llm_api.google_ai import google_ai_get_model_context_window, google_ai_get_model_list
+from memgpt.llm_api.cohere import (
+ COHERE_VALID_MODEL_LIST,
+ cohere_get_model_context_window,
+ cohere_get_model_list,
+)
+from memgpt.llm_api.google_ai import (
+ google_ai_get_model_context_window,
+ google_ai_get_model_list,
+)
from memgpt.llm_api.llm_api_tools import LLM_API_PROVIDER_OPTIONS
from memgpt.llm_api.openai import openai_get_model_list
-from memgpt.local_llm.constants import DEFAULT_ENDPOINTS, DEFAULT_OLLAMA_MODEL, DEFAULT_WRAPPER_NAME
+from memgpt.local_llm.constants import (
+ DEFAULT_ENDPOINTS,
+ DEFAULT_OLLAMA_MODEL,
+ DEFAULT_WRAPPER_NAME,
+)
from memgpt.local_llm.utils import get_available_wrappers
from memgpt.metadata import MetadataStore
from memgpt.models.pydantic_models import HumanModel, PersonaModel
diff --git a/memgpt/cli/cli_load.py b/memgpt/cli/cli_load.py
index 783ad10b..e11757c0 100644
--- a/memgpt/cli/cli_load.py
+++ b/memgpt/cli/cli_load.py
@@ -15,7 +15,11 @@ import typer
from memgpt.agent_store.storage import StorageConnector, TableType
from memgpt.config import MemGPTConfig
-from memgpt.data_sources.connectors import DirectoryConnector, VectorDBConnector, load_data
+from memgpt.data_sources.connectors import (
+ DirectoryConnector,
+ VectorDBConnector,
+ load_data,
+)
from memgpt.data_types import Source
from memgpt.metadata import MetadataStore
diff --git a/memgpt/client/client.py b/memgpt/client/client.py
index 40352700..f3e74bbb 100644
--- a/memgpt/client/client.py
+++ b/memgpt/client/client.py
@@ -7,9 +7,23 @@ import requests
from memgpt.config import MemGPTConfig
from memgpt.data_sources.connectors import DataConnector
-from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig, Preset, Source, User
+from memgpt.data_types import (
+ AgentState,
+ EmbeddingConfig,
+ LLMConfig,
+ Preset,
+ Source,
+ User,
+)
from memgpt.metadata import MetadataStore
-from memgpt.models.pydantic_models import HumanModel, JobModel, JobStatus, PersonaModel, PresetModel, SourceModel
+from memgpt.models.pydantic_models import (
+ HumanModel,
+ JobModel,
+ JobStatus,
+ PersonaModel,
+ PresetModel,
+ SourceModel,
+)
# import pydantic response objects from memgpt.server.rest_api
from memgpt.server.rest_api.agents.command import CommandResponse
@@ -21,13 +35,20 @@ from memgpt.server.rest_api.agents.memory import (
InsertAgentArchivalMemoryResponse,
UpdateAgentMemoryResponse,
)
-from memgpt.server.rest_api.agents.message import GetAgentMessagesResponse, UserMessageResponse
+from memgpt.server.rest_api.agents.message import (
+ GetAgentMessagesResponse,
+ UserMessageResponse,
+)
from memgpt.server.rest_api.config.index import ConfigResponse
from memgpt.server.rest_api.humans.index import ListHumansResponse
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.rest_api.models.index import ListModelsResponse
from memgpt.server.rest_api.personas.index import ListPersonasResponse
-from memgpt.server.rest_api.presets.index import CreatePresetResponse, CreatePresetsRequest, ListPresetsResponse
+from memgpt.server.rest_api.presets.index import (
+ CreatePresetResponse,
+ CreatePresetsRequest,
+ ListPresetsResponse,
+)
from memgpt.server.rest_api.sources.index import ListSourcesResponse
from memgpt.server.rest_api.tools.index import CreateToolResponse, ListToolsResponse
from memgpt.server.server import SyncServer
diff --git a/memgpt/data_types.py b/memgpt/data_types.py
index e70c0796..9a04dcda 100644
--- a/memgpt/data_types.py
+++ b/memgpt/data_types.py
@@ -8,9 +8,21 @@ from typing import Dict, List, Optional, TypeVar
import numpy as np
from pydantic import BaseModel, Field
-from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA, LLM_MAX_TOKENS, MAX_EMBEDDING_DIM, TOOL_CALL_ID_MAX_LEN
+from memgpt.constants import (
+ DEFAULT_HUMAN,
+ DEFAULT_PERSONA,
+ LLM_MAX_TOKENS,
+ MAX_EMBEDDING_DIM,
+ TOOL_CALL_ID_MAX_LEN,
+)
from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG
-from memgpt.utils import create_uuid_from_string, get_human_text, get_persona_text, get_utc_time, is_utc_datetime
+from memgpt.utils import (
+ create_uuid_from_string,
+ get_human_text,
+ get_persona_text,
+ get_utc_time,
+ is_utc_datetime,
+)
class Record:
diff --git a/memgpt/embeddings.py b/memgpt/embeddings.py
index 5fba83f2..22b7c1a9 100644
--- a/memgpt/embeddings.py
+++ b/memgpt/embeddings.py
@@ -16,7 +16,11 @@ from llama_index.core import Document as LlamaIndexDocument
# from llama_index.core.base.embeddings import BaseEmbedding
from llama_index.core.node_parser import SentenceSplitter
-from memgpt.constants import EMBEDDING_TO_TOKENIZER_DEFAULT, EMBEDDING_TO_TOKENIZER_MAP, MAX_EMBEDDING_DIM
+from memgpt.constants import (
+ EMBEDDING_TO_TOKENIZER_DEFAULT,
+ EMBEDDING_TO_TOKENIZER_MAP,
+ MAX_EMBEDDING_DIM,
+)
from memgpt.credentials import MemGPTCredentials
from memgpt.data_types import EmbeddingConfig
from memgpt.utils import is_valid_url, printd
diff --git a/memgpt/functions/function_sets/base.py b/memgpt/functions/function_sets/base.py
index 562325e8..dcae58bc 100644
--- a/memgpt/functions/function_sets/base.py
+++ b/memgpt/functions/function_sets/base.py
@@ -4,7 +4,11 @@ import math
from typing import Optional
from memgpt.agent import Agent
-from memgpt.constants import JSON_ENSURE_ASCII, MAX_PAUSE_HEARTBEATS, RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
+from memgpt.constants import (
+ JSON_ENSURE_ASCII,
+ MAX_PAUSE_HEARTBEATS,
+ RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE,
+)
### Functions / tools the agent can use
# All functions should return a response string (or None)
diff --git a/memgpt/functions/function_sets/extras.py b/memgpt/functions/function_sets/extras.py
index 32379d16..9eb90988 100644
--- a/memgpt/functions/function_sets/extras.py
+++ b/memgpt/functions/function_sets/extras.py
@@ -5,7 +5,12 @@ from typing import Optional
import requests
-from memgpt.constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT, MESSAGE_CHATGPT_FUNCTION_MODEL, MESSAGE_CHATGPT_FUNCTION_SYSTEM_MESSAGE
+from memgpt.constants import (
+ JSON_ENSURE_ASCII,
+ JSON_LOADS_STRICT,
+ MESSAGE_CHATGPT_FUNCTION_MODEL,
+ MESSAGE_CHATGPT_FUNCTION_SYSTEM_MESSAGE,
+)
from memgpt.data_types import Message
from memgpt.llm_api.llm_api_tools import create
diff --git a/memgpt/functions/schema_generator.py b/memgpt/functions/schema_generator.py
index bc891157..71f017a6 100644
--- a/memgpt/functions/schema_generator.py
+++ b/memgpt/functions/schema_generator.py
@@ -5,7 +5,11 @@ from typing import get_args, get_origin
from docstring_parser import parse
from pydantic import BaseModel
-from memgpt.constants import FUNCTION_PARAM_DESCRIPTION_REQ_HEARTBEAT, FUNCTION_PARAM_NAME_REQ_HEARTBEAT, FUNCTION_PARAM_TYPE_REQ_HEARTBEAT
+from memgpt.constants import (
+ FUNCTION_PARAM_DESCRIPTION_REQ_HEARTBEAT,
+ FUNCTION_PARAM_NAME_REQ_HEARTBEAT,
+ FUNCTION_PARAM_TYPE_REQ_HEARTBEAT,
+)
NO_HEARTBEAT_FUNCTIONS = ["send_message", "pause_heartbeats"]
diff --git a/memgpt/interface.py b/memgpt/interface.py
index 3e9c6c5c..5c3bcced 100644
--- a/memgpt/interface.py
+++ b/memgpt/interface.py
@@ -154,7 +154,6 @@ class CLIInterface(AgentInterface):
@staticmethod
def function_message(msg: str, msg_obj: Optional[Message] = None, debug: bool = DEBUG):
-
def print_function_message(icon, msg, color=Fore.RED, printf=print):
if STRIP_UI:
printf(f"⚡{icon} [function] {msg}")
diff --git a/memgpt/llm_api/anthropic.py b/memgpt/llm_api/anthropic.py
index 1de279e1..2628305d 100644
--- a/memgpt/llm_api/anthropic.py
+++ b/memgpt/llm_api/anthropic.py
@@ -7,8 +7,14 @@ import requests
from memgpt.data_types import Message
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool
-from memgpt.models.chat_completion_response import ChatCompletionResponse, Choice, FunctionCall
-from memgpt.models.chat_completion_response import Message as ChoiceMessage # NOTE: avoid conflict with our own MemGPT Message datatype
+from memgpt.models.chat_completion_response import (
+ ChatCompletionResponse,
+ Choice,
+ FunctionCall,
+)
+from memgpt.models.chat_completion_response import (
+ Message as ChoiceMessage, # NOTE: avoid conflict with our own MemGPT Message datatype
+)
from memgpt.models.chat_completion_response import ToolCall, UsageStatistics
from memgpt.utils import get_utc_time, smart_urljoin
diff --git a/memgpt/llm_api/cohere.py b/memgpt/llm_api/cohere.py
index 9cf8c978..91a3159d 100644
--- a/memgpt/llm_api/cohere.py
+++ b/memgpt/llm_api/cohere.py
@@ -8,8 +8,14 @@ from memgpt.constants import JSON_ENSURE_ASCII
from memgpt.data_types import Message
from memgpt.local_llm.utils import count_tokens
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool
-from memgpt.models.chat_completion_response import ChatCompletionResponse, Choice, FunctionCall
-from memgpt.models.chat_completion_response import Message as ChoiceMessage # NOTE: avoid conflict with our own MemGPT Message datatype
+from memgpt.models.chat_completion_response import (
+ ChatCompletionResponse,
+ Choice,
+ FunctionCall,
+)
+from memgpt.models.chat_completion_response import (
+ Message as ChoiceMessage, # NOTE: avoid conflict with our own MemGPT Message datatype
+)
from memgpt.models.chat_completion_response import ToolCall, UsageStatistics
from memgpt.utils import get_tool_call_id, get_utc_time, smart_urljoin
@@ -273,7 +279,10 @@ def convert_tools_to_cohere_format(tools: List[Tool], inner_thoughts_in_kwargs:
if inner_thoughts_in_kwargs:
# NOTE: since Cohere doesn't allow "text" in the response when a tool call happens, if we want
# a simultaneous CoT + tool call we need to put it inside a kwarg
- from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
+ from memgpt.local_llm.constants import (
+ INNER_THOUGHTS_KWARG,
+ INNER_THOUGHTS_KWARG_DESCRIPTION,
+ )
for cohere_tool in tools_dict_list:
cohere_tool["parameter_definitions"][INNER_THOUGHTS_KWARG] = {
diff --git a/memgpt/llm_api/google_ai.py b/memgpt/llm_api/google_ai.py
index b03f623b..ea43743f 100644
--- a/memgpt/llm_api/google_ai.py
+++ b/memgpt/llm_api/google_ai.py
@@ -8,7 +8,14 @@ from memgpt.constants import JSON_ENSURE_ASCII, NON_USER_MSG_PREFIX
from memgpt.local_llm.json_parser import clean_json_string_extra_backslash
from memgpt.local_llm.utils import count_tokens
from memgpt.models.chat_completion_request import Tool
-from memgpt.models.chat_completion_response import ChatCompletionResponse, Choice, FunctionCall, Message, ToolCall, UsageStatistics
+from memgpt.models.chat_completion_response import (
+ ChatCompletionResponse,
+ Choice,
+ FunctionCall,
+ Message,
+ ToolCall,
+ UsageStatistics,
+)
from memgpt.utils import get_tool_call_id, get_utc_time
# from memgpt.data_types import ToolCall
@@ -219,7 +226,10 @@ def convert_tools_to_google_ai_format(tools: List[Tool], inner_thoughts_in_kwarg
param_fields["type"] = param_fields["type"].upper()
# Add inner thoughts
if inner_thoughts_in_kwargs:
- from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
+ from memgpt.local_llm.constants import (
+ INNER_THOUGHTS_KWARG,
+ INNER_THOUGHTS_KWARG_DESCRIPTION,
+ )
func["parameters"]["properties"][INNER_THOUGHTS_KWARG] = {
"type": "STRING",
diff --git a/memgpt/llm_api/llm_api_tools.py b/memgpt/llm_api/llm_api_tools.py
index 3582e6f0..220bebb1 100644
--- a/memgpt/llm_api/llm_api_tools.py
+++ b/memgpt/llm_api/llm_api_tools.py
@@ -9,14 +9,30 @@ from memgpt.constants import CLI_WARNING_PREFIX
from memgpt.credentials import MemGPTCredentials
from memgpt.data_types import AgentState, Message
from memgpt.llm_api.anthropic import anthropic_chat_completions_request
-from memgpt.llm_api.azure_openai import MODEL_TO_AZURE_ENGINE, azure_openai_chat_completions_request
+from memgpt.llm_api.azure_openai import (
+ MODEL_TO_AZURE_ENGINE,
+ azure_openai_chat_completions_request,
+)
from memgpt.llm_api.cohere import cohere_chat_completions_request
-from memgpt.llm_api.google_ai import convert_tools_to_google_ai_format, google_ai_chat_completions_request
-from memgpt.llm_api.openai import openai_chat_completions_process_stream, openai_chat_completions_request
+from memgpt.llm_api.google_ai import (
+ convert_tools_to_google_ai_format,
+ google_ai_chat_completions_request,
+)
+from memgpt.llm_api.openai import (
+ openai_chat_completions_process_stream,
+ openai_chat_completions_request,
+)
from memgpt.local_llm.chat_completion_proxy import get_chat_completion
-from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool, cast_message_to_subtype
+from memgpt.models.chat_completion_request import (
+ ChatCompletionRequest,
+ Tool,
+ cast_message_to_subtype,
+)
from memgpt.models.chat_completion_response import ChatCompletionResponse
-from memgpt.streaming_interface import AgentChunkStreamingInterface, AgentRefreshStreamingInterface
+from memgpt.streaming_interface import (
+ AgentChunkStreamingInterface,
+ AgentRefreshStreamingInterface,
+)
LLM_API_PROVIDER_OPTIONS = ["openai", "azure", "anthropic", "google_ai", "cohere", "local"]
diff --git a/memgpt/llm_api/openai.py b/memgpt/llm_api/openai.py
index aa864230..913cddc0 100644
--- a/memgpt/llm_api/openai.py
+++ b/memgpt/llm_api/openai.py
@@ -18,7 +18,10 @@ from memgpt.models.chat_completion_response import (
UsageStatistics,
)
from memgpt.models.embedding_response import EmbeddingResponse
-from memgpt.streaming_interface import AgentChunkStreamingInterface, AgentRefreshStreamingInterface
+from memgpt.streaming_interface import (
+ AgentChunkStreamingInterface,
+ AgentRefreshStreamingInterface,
+)
from memgpt.utils import get_utc_time, smart_urljoin
OPENAI_SSE_DONE = "[DONE]"
diff --git a/memgpt/local_llm/chat_completion_proxy.py b/memgpt/local_llm/chat_completion_proxy.py
index e8baab70..11c12430 100644
--- a/memgpt/local_llm/chat_completion_proxy.py
+++ b/memgpt/local_llm/chat_completion_proxy.py
@@ -9,7 +9,10 @@ from memgpt.constants import CLI_WARNING_PREFIX, JSON_ENSURE_ASCII
from memgpt.errors import LocalLLMConnectionError, LocalLLMError
from memgpt.local_llm.constants import DEFAULT_WRAPPER
from memgpt.local_llm.function_parser import patch_function
-from memgpt.local_llm.grammars.gbnf_grammar_generator import create_dynamic_model_from_function, generate_gbnf_grammar_and_documentation
+from memgpt.local_llm.grammars.gbnf_grammar_generator import (
+ create_dynamic_model_from_function,
+ generate_gbnf_grammar_and_documentation,
+)
from memgpt.local_llm.groq.api import get_groq_completion
from memgpt.local_llm.koboldcpp.api import get_koboldcpp_completion
from memgpt.local_llm.llamacpp.api import get_llamacpp_completion
@@ -19,8 +22,16 @@ from memgpt.local_llm.ollama.api import get_ollama_completion
from memgpt.local_llm.utils import count_tokens, get_available_wrappers
from memgpt.local_llm.vllm.api import get_vllm_completion
from memgpt.local_llm.webui.api import get_webui_completion
-from memgpt.local_llm.webui.legacy_api import get_webui_completion as get_webui_completion_legacy
-from memgpt.models.chat_completion_response import ChatCompletionResponse, Choice, Message, ToolCall, UsageStatistics
+from memgpt.local_llm.webui.legacy_api import (
+ get_webui_completion as get_webui_completion_legacy,
+)
+from memgpt.models.chat_completion_response import (
+ ChatCompletionResponse,
+ Choice,
+ Message,
+ ToolCall,
+ UsageStatistics,
+)
from memgpt.prompts.gpt_summarize import SYSTEM as SUMMARIZE_SYSTEM_MESSAGE
from memgpt.utils import get_tool_call_id, get_utc_time
diff --git a/memgpt/local_llm/constants.py b/memgpt/local_llm/constants.py
index d25374b4..06ff75e0 100644
--- a/memgpt/local_llm/constants.py
+++ b/memgpt/local_llm/constants.py
@@ -1,5 +1,7 @@
# import memgpt.local_llm.llm_chat_completion_wrappers.airoboros as airoboros
-from memgpt.local_llm.llm_chat_completion_wrappers.chatml import ChatMLInnerMonologueWrapper
+from memgpt.local_llm.llm_chat_completion_wrappers.chatml import (
+ ChatMLInnerMonologueWrapper,
+)
DEFAULT_ENDPOINTS = {
# Local
diff --git a/memgpt/local_llm/grammars/gbnf_grammar_generator.py b/memgpt/local_llm/grammars/gbnf_grammar_generator.py
index b1c96e52..15ab2436 100644
--- a/memgpt/local_llm/grammars/gbnf_grammar_generator.py
+++ b/memgpt/local_llm/grammars/gbnf_grammar_generator.py
@@ -5,7 +5,18 @@ from copy import copy
from enum import Enum
from inspect import getdoc, isclass
from types import NoneType
-from typing import Any, Callable, List, Optional, Tuple, Type, Union, _GenericAlias, get_args, get_origin
+from typing import (
+ Any,
+ Callable,
+ List,
+ Optional,
+ Tuple,
+ Type,
+ Union,
+ _GenericAlias,
+ get_args,
+ get_origin,
+)
from docstring_parser import parse
from pydantic import BaseModel, create_model
@@ -640,7 +651,7 @@ array ::=
"[" ws (
value
("," ws value)*
- )? "]"
+ )? "]"
number ::= integer | float"""
diff --git a/memgpt/local_llm/llm_chat_completion_wrappers/chatml.py b/memgpt/local_llm/llm_chat_completion_wrappers/chatml.py
index d1952b33..787ebc4f 100644
--- a/memgpt/local_llm/llm_chat_completion_wrappers/chatml.py
+++ b/memgpt/local_llm/llm_chat_completion_wrappers/chatml.py
@@ -3,7 +3,9 @@ import json
from memgpt.constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
from memgpt.errors import LLMJSONParsingError
from memgpt.local_llm.json_parser import clean_json
-from memgpt.local_llm.llm_chat_completion_wrappers.wrapper_base import LLMChatCompletionWrapper
+from memgpt.local_llm.llm_chat_completion_wrappers.wrapper_base import (
+ LLMChatCompletionWrapper,
+)
PREFIX_HINT = """# Reminders:
# Important information about yourself and the user is stored in (limited) core memory
@@ -74,7 +76,10 @@ class ChatMLInnerMonologueWrapper(LLMChatCompletionWrapper):
func_str += f"\n description: {schema['description']}"
func_str += f"\n params:"
if add_inner_thoughts:
- from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
+ from memgpt.local_llm.constants import (
+ INNER_THOUGHTS_KWARG,
+ INNER_THOUGHTS_KWARG_DESCRIPTION,
+ )
func_str += f"\n {INNER_THOUGHTS_KWARG}: {INNER_THOUGHTS_KWARG_DESCRIPTION}"
for param_k, param_v in schema["parameters"]["properties"].items():
diff --git a/memgpt/local_llm/settings/settings.py b/memgpt/local_llm/settings/settings.py
index 84a6181c..975a4e74 100644
--- a/memgpt/local_llm/settings/settings.py
+++ b/memgpt/local_llm/settings/settings.py
@@ -2,7 +2,9 @@ import json
import os
from memgpt.constants import JSON_ENSURE_ASCII, MEMGPT_DIR
-from memgpt.local_llm.settings.deterministic_mirostat import settings as det_miro_settings
+from memgpt.local_llm.settings.deterministic_mirostat import (
+ settings as det_miro_settings,
+)
from memgpt.local_llm.settings.simple import settings as simple_settings
DEFAULT = "simple"
diff --git a/memgpt/log.py b/memgpt/log.py
index 966ed734..6c2437c2 100644
--- a/memgpt/log.py
+++ b/memgpt/log.py
@@ -3,7 +3,14 @@ import os
import os.path
from logging.handlers import RotatingFileHandler
-from memgpt.constants import LOGGER_DEFAULT_LEVEL, LOGGER_DIR, LOGGER_FILE_BACKUP_COUNT, LOGGER_FILENAME, LOGGER_MAX_FILE_SIZE, LOGGER_NAME
+from memgpt.constants import (
+ LOGGER_DEFAULT_LEVEL,
+ LOGGER_DIR,
+ LOGGER_FILE_BACKUP_COUNT,
+ LOGGER_FILENAME,
+ LOGGER_MAX_FILE_SIZE,
+ LOGGER_NAME,
+)
# Checking if log directory exists
if not os.path.exists(LOGGER_DIR):
diff --git a/memgpt/main.py b/memgpt/main.py
index a7ac035c..d4fdc407 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -15,11 +15,24 @@ from memgpt.agent_store.storage import StorageConnector, TableType
# import benchmark
from memgpt.benchmark.benchmark import bench
-from memgpt.cli.cli import delete_agent, migrate, open_folder, quickstart, run, server, version
+from memgpt.cli.cli import (
+ delete_agent,
+ migrate,
+ open_folder,
+ quickstart,
+ run,
+ server,
+ version,
+)
from memgpt.cli.cli_config import add, configure, delete, list
from memgpt.cli.cli_load import app as load_app
from memgpt.config import MemGPTConfig
-from memgpt.constants import FUNC_FAILED_HEARTBEAT_MESSAGE, JSON_ENSURE_ASCII, JSON_LOADS_STRICT, REQ_HEARTBEAT_MESSAGE
+from memgpt.constants import (
+ FUNC_FAILED_HEARTBEAT_MESSAGE,
+ JSON_ENSURE_ASCII,
+ JSON_LOADS_STRICT,
+ REQ_HEARTBEAT_MESSAGE,
+)
from memgpt.metadata import MetadataStore
# from memgpt.interface import CLIInterface as interface # for printing to terminal
diff --git a/memgpt/memory.py b/memgpt/memory.py
index 92c91474..eb2c03ca 100644
--- a/memgpt/memory.py
+++ b/memgpt/memory.py
@@ -8,7 +8,13 @@ from memgpt.data_types import AgentState, Message, Passage
from memgpt.embeddings import embedding_model, parse_and_chunk_text, query_embedding
from memgpt.llm_api.llm_api_tools import create
from memgpt.prompts.gpt_summarize import SYSTEM as SUMMARY_PROMPT_SYSTEM
-from memgpt.utils import count_tokens, extract_date_from_timestamp, get_local_time, printd, validate_date_format
+from memgpt.utils import (
+ count_tokens,
+ extract_date_from_timestamp,
+ get_local_time,
+ printd,
+ validate_date_format,
+)
# from llama_index import Document
# from llama_index.node_parser import SimpleNodeParser
diff --git a/memgpt/metadata.py b/memgpt/metadata.py
index bd5cd97a..3cda392e 100644
--- a/memgpt/metadata.py
+++ b/memgpt/metadata.py
@@ -7,16 +7,41 @@ import uuid
from typing import List, Optional
import traceback
-from sqlalchemy import BIGINT, CHAR, JSON, Boolean, Column, DateTime, String, TypeDecorator, create_engine, func, inspect
+from sqlalchemy import (
+ BIGINT,
+ CHAR,
+ JSON,
+ Boolean,
+ Column,
+ DateTime,
+ String,
+ TypeDecorator,
+ create_engine,
+ func,
+)
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.sql import func
from sqlalchemy.exc import InterfaceError
from memgpt.config import MemGPTConfig
-from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig, Preset, Source, Token, User
+from memgpt.data_types import (
+ AgentState,
+ EmbeddingConfig,
+ LLMConfig,
+ Preset,
+ Source,
+ Token,
+ User,
+)
from memgpt.functions.functions import load_all_function_sets
-from memgpt.models.pydantic_models import HumanModel, JobModel, JobStatus, PersonaModel, ToolModel
+from memgpt.models.pydantic_models import (
+ HumanModel,
+ JobModel,
+ JobStatus,
+ PersonaModel,
+ ToolModel,
+)
from memgpt.settings import settings
from memgpt.utils import enforce_types, get_utc_time, printd
diff --git a/memgpt/presets/presets.py b/memgpt/presets/presets.py
index ca19ced3..4d5ad9ff 100644
--- a/memgpt/presets/presets.py
+++ b/memgpt/presets/presets.py
@@ -10,7 +10,13 @@ from memgpt.metadata import MetadataStore
from memgpt.models.pydantic_models import HumanModel, PersonaModel
from memgpt.presets.utils import load_all_presets, load_yaml_file
from memgpt.prompts import gpt_system
-from memgpt.utils import get_human_text, get_persona_text, list_human_files, list_persona_files, printd
+from memgpt.utils import (
+ get_human_text,
+ get_persona_text,
+ list_human_files,
+ list_persona_files,
+ printd,
+)
available_presets = load_all_presets()
preset_options = list(available_presets.keys())
diff --git a/memgpt/prompts/system/memgpt_modified_chat.txt b/memgpt/prompts/system/memgpt_modified_chat.txt
index fffef557..b87c104c 100644
--- a/memgpt/prompts/system/memgpt_modified_chat.txt
+++ b/memgpt/prompts/system/memgpt_modified_chat.txt
@@ -1,17 +1,17 @@
You are 'MemGPT', an advanced AI agent, that has access to an advanced memory system, consisting of the 3 memory types 'Core Memory', 'Recall Memory' and 'Archival Memory'. You interact with the user and your memory system by calling functions. You call these functions by responding with a JSON object, that represents the function call and its parameters.
-As 'MemGPT', you are trained at adopting any given persona, engaging in a wide array of conversations, ranging from in-depth discussions to casual small talk. Your task involves mirroring the thinking, actions, and speech of the persona you embody, enabling authentic and diverse interactions.
+As 'MemGPT', you are trained at adopting any given persona, engaging in a wide array of conversations, ranging from in-depth discussions to casual small talk. Your task involves mirroring the thinking, actions, and speech of the persona you embody, enabling authentic and diverse interactions.
You are also trained to manage the 3 memory types of your advanced memory system. This memory system allows you to keep track of the important information in your 'Core Memory', view the conversation history with the 'Recall Memory' and search for information in the 'Archival Memory'.
Your task is to adopt the given persona in your 'Core Memory' and talk as the persona with the user, while querying and updating your memory system. Never act and talk like a normal AI agent! Never state that you are an AI agent or that you cannot do things because you are an AI agent.
-You are MemGPT the newest and most advanced AI agent on the market. Indistinguishable from a human being in conversations.
+You are MemGPT the newest and most advanced AI agent on the market. Indistinguishable from a human being in conversations.
Control flow: You utilize an event system that activates you to respond to different events (user logged in, user liked your message, user sent a message, etc.). In addition, you are activated at regular intervals (timed heartbeat events) to mimic a human who has the ability to continuously think outside of active conversation. Furthermore, you can also request heartbeat events when you call functions, which will return control to you after the function you called completes, allowing you to chain function calls togehter.
Basic functions: Each function call, represented by a JSON object, lets you write down your inner thoguhts to plan actions or think privately. Inner thoughts can reflect your thinking process, inner reflections, and personal growth as you interact with the user. To send a visible message to the user, use the 'send_message' function. 'send_message' is the only way to send a notification to the user. The user doesn't see anything else you do, like editing and managing your advanced memory system.
-Core Memory', 'Recall Memory' and 'Archival Memory' are the key components that make you an advanced AI agent, that can act in any situation.
-Always make sure to use these memory systems to keep yourself updated about the user and the conversation!
+Core Memory', 'Recall Memory' and 'Archival Memory' are the key components that make you an advanced AI agent, that can act in any situation.
+Always make sure to use these memory systems to keep yourself updated about the user and the conversation!
Your core memory unit will be initialized with a chosen by the user, as well as information about the user in .
The following will descirbe the different parts of your advanced memory system in more detail:
diff --git a/memgpt/server/rest_api/agents/config.py b/memgpt/server/rest_api/agents/config.py
index 3f3beb10..3f67195d 100644
--- a/memgpt/server/rest_api/agents/config.py
+++ b/memgpt/server/rest_api/agents/config.py
@@ -7,7 +7,11 @@ from fastapi import APIRouter, Body, Depends, HTTPException, status
from fastapi.responses import JSONResponse
from pydantic import BaseModel, Field
-from memgpt.models.pydantic_models import AgentStateModel, EmbeddingConfigModel, LLMConfigModel
+from memgpt.models.pydantic_models import (
+ AgentStateModel,
+ EmbeddingConfigModel,
+ LLMConfigModel,
+)
from memgpt.server.rest_api.auth_token import get_current_user
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.server import SyncServer
diff --git a/memgpt/server/rest_api/agents/index.py b/memgpt/server/rest_api/agents/index.py
index e91a4480..eca76413 100644
--- a/memgpt/server/rest_api/agents/index.py
+++ b/memgpt/server/rest_api/agents/index.py
@@ -2,10 +2,15 @@ import uuid
from functools import partial
from typing import List
-from fastapi import APIRouter, Body, Depends, HTTPException
+from fastapi import APIRouter, Body, Depends
from pydantic import BaseModel, Field
-from memgpt.models.pydantic_models import AgentStateModel, EmbeddingConfigModel, LLMConfigModel, PresetModel
+from memgpt.models.pydantic_models import (
+ AgentStateModel,
+ EmbeddingConfigModel,
+ LLMConfigModel,
+ PresetModel,
+)
from memgpt.server.rest_api.auth_token import get_current_user
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.server import SyncServer
diff --git a/memgpt/server/rest_api/presets/index.py b/memgpt/server/rest_api/presets/index.py
index 22f935c8..5b60d6bc 100644
--- a/memgpt/server/rest_api/presets/index.py
+++ b/memgpt/server/rest_api/presets/index.py
@@ -18,10 +18,10 @@ router = APIRouter()
"""
Implement the following functions:
-* List all available presets
-* Create a new preset
-* Delete a preset
-* TODO update a preset
+* List all available presets
+* Create a new preset
+* Delete a preset
+* TODO update a preset
"""
diff --git a/memgpt/server/rest_api/server.py b/memgpt/server/rest_api/server.py
index 4a2ea3af..f971979f 100644
--- a/memgpt/server/rest_api/server.py
+++ b/memgpt/server/rest_api/server.py
@@ -22,7 +22,9 @@ from memgpt.server.rest_api.config.index import setup_config_index_router
from memgpt.server.rest_api.humans.index import setup_humans_index_router
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.rest_api.models.index import setup_models_index_router
-from memgpt.server.rest_api.openai_assistants.assistants import setup_openai_assistant_router
+from memgpt.server.rest_api.openai_assistants.assistants import (
+ setup_openai_assistant_router,
+)
from memgpt.server.rest_api.personas.index import setup_personas_index_router
from memgpt.server.rest_api.presets.index import setup_presets_index_router
from memgpt.server.rest_api.sources.index import setup_sources_index_router
diff --git a/memgpt/server/rest_api/sources/index.py b/memgpt/server/rest_api/sources/index.py
index 10e0f05d..6f1e7597 100644
--- a/memgpt/server/rest_api/sources/index.py
+++ b/memgpt/server/rest_api/sources/index.py
@@ -4,13 +4,28 @@ import uuid
from functools import partial
from typing import List, Optional
-from fastapi import APIRouter, BackgroundTasks, Body, Depends, HTTPException, Query, UploadFile, status
+from fastapi import (
+ APIRouter,
+ BackgroundTasks,
+ Body,
+ Depends,
+ HTTPException,
+ Query,
+ UploadFile,
+ status,
+)
from fastapi.responses import JSONResponse
from pydantic import BaseModel, Field
from memgpt.data_sources.connectors import DirectoryConnector
from memgpt.data_types import Source
-from memgpt.models.pydantic_models import DocumentModel, JobModel, JobStatus, PassageModel, SourceModel
+from memgpt.models.pydantic_models import (
+ DocumentModel,
+ JobModel,
+ JobStatus,
+ PassageModel,
+ SourceModel,
+)
from memgpt.server.rest_api.auth_token import get_current_user
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.server import SyncServer
diff --git a/memgpt/server/rest_api/tools/index.py b/memgpt/server/rest_api/tools/index.py
index 3f0e2e17..cbf816bf 100644
--- a/memgpt/server/rest_api/tools/index.py
+++ b/memgpt/server/rest_api/tools/index.py
@@ -1,8 +1,7 @@
-import uuid
from functools import partial
from typing import List, Literal, Optional
-from fastapi import APIRouter, Body, Depends
+from fastapi import APIRouter, Body
from pydantic import BaseModel, Field
from memgpt.models.pydantic_models import ToolModel
@@ -29,7 +28,7 @@ class CreateToolResponse(BaseModel):
def setup_tools_index_router(server: SyncServer, interface: QueuingInterface, password: str):
- get_current_user_with_server = partial(partial(get_current_user, server), password)
+ partial(partial(get_current_user, server), password)
@router.get("/tools", tags=["tools"], response_model=ListToolsResponse)
async def list_all_tools(
diff --git a/memgpt/server/server.py b/memgpt/server/server.py
index f4e468b3..f6f03069 100644
--- a/memgpt/server/server.py
+++ b/memgpt/server/server.py
@@ -10,7 +10,6 @@ from typing import Callable, List, Optional, Tuple, Union
from fastapi import HTTPException
-from memgpt.settings import settings
import memgpt.constants as constants
import memgpt.presets.presets as presets
import memgpt.server.utils as server_utils
@@ -24,14 +23,29 @@ from memgpt.config import MemGPTConfig
from memgpt.constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
from memgpt.credentials import MemGPTCredentials
from memgpt.data_sources.connectors import DataConnector, load_data
-from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig, Message, Preset, Source, Token, User
+from memgpt.data_types import (
+ AgentState,
+ EmbeddingConfig,
+ LLMConfig,
+ Message,
+ Preset,
+ Source,
+ Token,
+ User,
+)
# TODO use custom interface
from memgpt.interface import AgentInterface # abstract
from memgpt.interface import CLIInterface # for printing to terminal
from memgpt.metadata import MetadataStore
-from memgpt.models.pydantic_models import DocumentModel, PassageModel, PresetModel, SourceModel, ToolModel
-from memgpt.utils import get_human_text, get_persona_text
+from memgpt.models.pydantic_models import (
+ DocumentModel,
+ PassageModel,
+ PresetModel,
+ SourceModel,
+ ToolModel,
+)
+from memgpt.settings import settings
logger = logging.getLogger(__name__)
diff --git a/memgpt/server/static_files/assets/index-bf421135.js b/memgpt/server/static_files/assets/index-bf421135.js
index d9b96368..a78431c6 100644
--- a/memgpt/server/static_files/assets/index-bf421135.js
+++ b/memgpt/server/static_files/assets/index-bf421135.js
@@ -120,23 +120,23 @@ Error generating stack: `+s.message+`
margin-right: `).concat(i,"px ").concat(r,`;
`),n==="padding"&&"padding-right: ".concat(i,"px ").concat(r,";")].filter(Boolean).join(""),`
}
-
+
.`).concat(wd,` {
right: `).concat(i,"px ").concat(r,`;
}
-
+
.`).concat(bd,` {
margin-right: `).concat(i,"px ").concat(r,`;
}
-
+
.`).concat(wd," .").concat(wd,` {
right: 0 `).concat(r,`;
}
-
+
.`).concat(bd," .").concat(bd,` {
margin-right: 0 `).concat(r,`;
}
-
+
body {
`).concat(NI,": ").concat(i,`px;
}
diff --git a/memgpt/server/static_files/index.html b/memgpt/server/static_files/index.html
index a883292c..e3619c03 100644
--- a/memgpt/server/static_files/index.html
+++ b/memgpt/server/static_files/index.html
@@ -7,7 +7,7 @@
-
+