chore: run autoflake + isort (#1279)
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
import random
|
||||
import os
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import os
|
||||
from typing import List, Tuple
|
||||
from openai import OpenAI
|
||||
|
||||
import serpapi
|
||||
from openai import OpenAI
|
||||
|
||||
from memgpt.data_sources.connectors import WebConnector
|
||||
from memgpt.data_types import Document, Passage
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.data_sources.connectors import WebConnector
|
||||
from memgpt.utils import printd
|
||||
|
||||
|
||||
"""
|
||||
This example show how you can add a google search custom function to your MemGPT agent.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import json
|
||||
from memgpt import create_client, Admin
|
||||
from memgpt.constants import DEFAULT_PRESET, DEFAULT_HUMAN, DEFAULT_PERSONA
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
from memgpt import Admin, create_client
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
"""
|
||||
Make sure you run the MemGPT server before running this example.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "0.3.11"
|
||||
|
||||
from memgpt.client.client import create_client
|
||||
from memgpt.client.admin import Admin
|
||||
from memgpt.client.client import create_client
|
||||
|
||||
@@ -1,48 +1,52 @@
|
||||
import datetime
|
||||
import uuid
|
||||
import inspect
|
||||
import json
|
||||
from pathlib import Path
|
||||
import traceback
|
||||
from typing import List, Tuple, Optional, cast, Union
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Tuple, Union, cast
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.data_types import AgentState, Message, LLMConfig, EmbeddingConfig, Passage, Preset
|
||||
from memgpt.models import chat_completion_response
|
||||
from memgpt.interface import AgentInterface
|
||||
from memgpt.persistence_manager import LocalStateManager
|
||||
from memgpt.system import get_login_event, package_function_response, package_summarize_message, get_initial_boot_messages
|
||||
from memgpt.memory import CoreMemory as InContextMemory, summarize_messages, ArchivalMemory, RecallMemory
|
||||
from memgpt.llm_api.llm_api_tools import create, is_context_overflow_error
|
||||
from memgpt.utils import (
|
||||
get_utc_time,
|
||||
create_random_username,
|
||||
get_tool_call_id,
|
||||
get_local_time,
|
||||
parse_json,
|
||||
united_diff,
|
||||
printd,
|
||||
count_tokens,
|
||||
get_schema_diff,
|
||||
validate_function_response,
|
||||
verify_first_message_correctness,
|
||||
create_uuid_from_string,
|
||||
is_utc_datetime,
|
||||
)
|
||||
from memgpt.agent_store.storage import StorageConnector
|
||||
from memgpt.constants import (
|
||||
FIRST_MESSAGE_ATTEMPTS,
|
||||
JSON_LOADS_STRICT,
|
||||
MESSAGE_SUMMARY_WARNING_FRAC,
|
||||
MESSAGE_SUMMARY_TRUNC_TOKEN_FRAC,
|
||||
MESSAGE_SUMMARY_TRUNC_KEEP_N_LAST,
|
||||
CLI_WARNING_PREFIX,
|
||||
CORE_MEMORY_HUMAN_CHAR_LIMIT,
|
||||
CORE_MEMORY_PERSONA_CHAR_LIMIT,
|
||||
LLM_MAX_TOKENS,
|
||||
CLI_WARNING_PREFIX,
|
||||
FIRST_MESSAGE_ATTEMPTS,
|
||||
JSON_ENSURE_ASCII,
|
||||
JSON_LOADS_STRICT,
|
||||
LLM_MAX_TOKENS,
|
||||
MESSAGE_SUMMARY_TRUNC_KEEP_N_LAST,
|
||||
MESSAGE_SUMMARY_TRUNC_TOKEN_FRAC,
|
||||
MESSAGE_SUMMARY_WARNING_FRAC,
|
||||
)
|
||||
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
|
||||
from memgpt.memory import CoreMemory as InContextMemory
|
||||
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.utils import (
|
||||
count_tokens,
|
||||
create_random_username,
|
||||
create_uuid_from_string,
|
||||
get_local_time,
|
||||
get_schema_diff,
|
||||
get_tool_call_id,
|
||||
get_utc_time,
|
||||
is_utc_datetime,
|
||||
parse_json,
|
||||
printd,
|
||||
united_diff,
|
||||
validate_function_response,
|
||||
verify_first_message_correctness,
|
||||
)
|
||||
|
||||
from .errors import LLMError
|
||||
from .functions.functions import USER_FUNCTIONS_DIR, load_all_function_sets
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import uuid
|
||||
from typing import Optional, List, Iterator, Dict, Tuple, cast
|
||||
from typing import Dict, Iterator, List, Optional, Tuple, cast
|
||||
|
||||
import chromadb
|
||||
from chromadb.api.types import Include, GetResult
|
||||
from chromadb.api.types import Include
|
||||
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.utils import printd, datetime_to_timestamp, timestamp_to_datetime
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.data_types import Record, Message, Passage, RecordType
|
||||
from memgpt.data_types import Passage, Record, RecordType
|
||||
from memgpt.utils import datetime_to_timestamp, printd, timestamp_to_datetime
|
||||
|
||||
|
||||
class ChromaStorageConnector(StorageConnector):
|
||||
|
||||
@@ -1,30 +1,39 @@
|
||||
import os
|
||||
import base64
|
||||
from sqlalchemy import create_engine, Column, String, BIGINT, select, inspect, text, JSON, BLOB, BINARY, ARRAY, DateTime
|
||||
from sqlalchemy import func, or_, and_
|
||||
from sqlalchemy import desc, asc
|
||||
from sqlalchemy.orm import sessionmaker, mapped_column, declarative_base
|
||||
import os
|
||||
import uuid
|
||||
from typing import Dict, Iterator, List, Optional
|
||||
|
||||
import numpy as np
|
||||
from sqlalchemy import (
|
||||
BIGINT,
|
||||
BINARY,
|
||||
CHAR,
|
||||
JSON,
|
||||
Column,
|
||||
DateTime,
|
||||
String,
|
||||
TypeDecorator,
|
||||
and_,
|
||||
asc,
|
||||
create_engine,
|
||||
desc,
|
||||
func,
|
||||
or_,
|
||||
select,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import declarative_base, mapped_column, sessionmaker
|
||||
from sqlalchemy.orm.session import close_all_sessions
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy_json import mutable_json_type, MutableJson
|
||||
from sqlalchemy import TypeDecorator, CHAR
|
||||
import uuid
|
||||
|
||||
from sqlalchemy_json import MutableJson
|
||||
from tqdm import tqdm
|
||||
from typing import Optional, List, Iterator, Dict
|
||||
import numpy as np
|
||||
from tqdm import tqdm
|
||||
import pandas as pd
|
||||
|
||||
from memgpt.settings import settings
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.utils import printd
|
||||
from memgpt.data_types import Record, Message, Passage, ToolCall, RecordType
|
||||
from memgpt.constants import MAX_EMBEDDING_DIM
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.data_types import Message, Passage, Record, RecordType, ToolCall
|
||||
from memgpt.settings import settings
|
||||
|
||||
|
||||
# Custom UUID type
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
# type: ignore
|
||||
|
||||
import lancedb
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from tqdm import tqdm
|
||||
from typing import Optional, List, Iterator, Dict
|
||||
from typing import Dict, Iterator, List, Optional
|
||||
|
||||
from lancedb.pydantic import LanceModel, Vector
|
||||
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.config import AgentConfig, MemGPTConfig
|
||||
from memgpt.constants import MEMGPT_DIR
|
||||
from memgpt.utils import printd
|
||||
from memgpt.data_types import Record, Message, Passage, Source
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from lancedb.pydantic import Vector, LanceModel
|
||||
from memgpt.data_types import Message, Passage, Record
|
||||
|
||||
""" Initial implementation - not complete """
|
||||
|
||||
|
||||
@@ -3,16 +3,12 @@
|
||||
We originally tried to use Llama Index VectorIndex, but their limited API was extremely problematic.
|
||||
"""
|
||||
|
||||
from typing import Optional, List, Iterator, Union, Tuple, Type
|
||||
import uuid
|
||||
from abc import abstractmethod
|
||||
|
||||
from typing import List, Optional, Dict
|
||||
from tqdm import tqdm
|
||||
|
||||
from typing import Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.data_types import Record, Passage, Document, Message, Source, RecordType
|
||||
from memgpt.data_types import Document, Message, Passage, Record, RecordType
|
||||
from memgpt.utils import printd
|
||||
|
||||
|
||||
|
||||
@@ -10,9 +10,11 @@ Begin by doing:
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import autogen
|
||||
|
||||
from memgpt.autogen.memgpt_agent import create_memgpt_autogen_agent_from_config
|
||||
from memgpt.constants import LLM_MAX_TOKENS, DEFAULT_PRESET
|
||||
from memgpt.constants import DEFAULT_PRESET, LLM_MAX_TOKENS
|
||||
|
||||
LLM_BACKEND = "openai"
|
||||
# LLM_BACKEND = "azure"
|
||||
|
||||
@@ -12,9 +12,11 @@ Begin by doing:
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import autogen
|
||||
|
||||
from memgpt.autogen.memgpt_agent import create_memgpt_autogen_agent_from_config
|
||||
from memgpt.constants import LLM_MAX_TOKENS, DEFAULT_PRESET
|
||||
from memgpt.constants import DEFAULT_PRESET, LLM_MAX_TOKENS
|
||||
|
||||
LLM_BACKEND = "openai"
|
||||
# LLM_BACKEND = "azure"
|
||||
|
||||
@@ -10,9 +10,11 @@ Begin by doing:
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import autogen
|
||||
from memgpt.autogen.memgpt_agent import create_memgpt_autogen_agent_from_config, load_autogen_memgpt_agent
|
||||
from memgpt.constants import LLM_MAX_TOKENS, DEFAULT_PRESET
|
||||
|
||||
from memgpt.autogen.memgpt_agent import create_memgpt_autogen_agent_from_config
|
||||
from memgpt.constants import DEFAULT_PRESET, LLM_MAX_TOKENS
|
||||
|
||||
LLM_BACKEND = "openai"
|
||||
# LLM_BACKEND = "azure"
|
||||
|
||||
@@ -4,8 +4,8 @@ from typing import Optional
|
||||
|
||||
from colorama import Fore, Style, init
|
||||
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, JSON_LOADS_STRICT
|
||||
from memgpt.data_types import Message
|
||||
|
||||
init(autoreset=True)
|
||||
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
import uuid
|
||||
import sys
|
||||
from typing import Callable, Optional, List, Dict, Union, Any, Tuple
|
||||
import uuid
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from autogen.agentchat import Agent, ConversableAgent, UserProxyAgent, GroupChat, GroupChatManager
|
||||
from autogen.agentchat import Agent, ConversableAgent, GroupChat, GroupChatManager, UserProxyAgent
|
||||
|
||||
from memgpt.metadata import MetadataStore
|
||||
import memgpt.constants as constants
|
||||
import memgpt.system as system
|
||||
import memgpt.utils as utils
|
||||
from memgpt.agent import Agent as MemGPTAgent
|
||||
from memgpt.agent import save_agent
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.autogen.interface import AutoGenInterface
|
||||
import memgpt.system as system
|
||||
import memgpt.constants as constants
|
||||
import memgpt.utils as utils
|
||||
import memgpt.presets.presets as presets
|
||||
from memgpt.cli.cli_load import load_directory, load_vector_database
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.cli.cli_load import load_directory, load_vector_database
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.data_types import AgentState, User, LLMConfig, EmbeddingConfig
|
||||
from memgpt.data_types import EmbeddingConfig, LLMConfig, User
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
# type: ignore
|
||||
|
||||
import uuid
|
||||
import typer
|
||||
import time
|
||||
import uuid
|
||||
from typing import Annotated
|
||||
|
||||
import typer
|
||||
|
||||
from memgpt import create_client
|
||||
from memgpt.benchmark.constants import HUMAN, PERSONA, PROMPTS, TRIES
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
# from memgpt.agent import Agent
|
||||
from memgpt.errors import LLMJSONParsingError
|
||||
from memgpt.benchmark.constants import TRIES, PERSONA, HUMAN, PROMPTS
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
import uuid
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import uuid
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Annotated, Optional
|
||||
|
||||
import typer
|
||||
import questionary
|
||||
import requests
|
||||
import typer
|
||||
|
||||
import memgpt.utils as utils
|
||||
from memgpt.agent import Agent, save_agent
|
||||
from memgpt.cli.cli_config import configure
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, MEMGPT_DIR
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.data_types import EmbeddingConfig, LLMConfig, User
|
||||
from memgpt.log import logger
|
||||
from memgpt.metadata import MetadataStore
|
||||
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.cli.cli_config import configure
|
||||
import memgpt.presets.presets as presets
|
||||
import memgpt.utils as utils
|
||||
from memgpt.utils import printd, open_folder_in_explorer, suppress_stdout
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.constants import MEMGPT_DIR, CLI_WARNING_PREFIX, JSON_ENSURE_ASCII
|
||||
from memgpt.agent import Agent, save_agent
|
||||
from memgpt.embeddings import embedding_model
|
||||
from memgpt.server.constants import WS_DEFAULT_PORT, REST_DEFAULT_PORT
|
||||
from memgpt.data_types import AgentState, LLMConfig, EmbeddingConfig, User, Passage
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.migrate import migrate_all_agents, migrate_all_sources
|
||||
from memgpt.utils import open_folder_in_explorer, printd
|
||||
|
||||
|
||||
def migrate(
|
||||
@@ -326,8 +324,7 @@ def server(
|
||||
# server_logger.addHandler(stream_handler)
|
||||
|
||||
if type == ServerChoice.rest_api:
|
||||
import uvicorn
|
||||
from memgpt.server.rest_api.server import app
|
||||
pass
|
||||
|
||||
if MemGPTConfig.exists():
|
||||
config = MemGPTConfig.load()
|
||||
@@ -471,7 +468,7 @@ def run(
|
||||
else:
|
||||
logger.setLevel(logging.CRITICAL)
|
||||
|
||||
from memgpt.migrate import config_is_compatible, wipe_config_and_reconfigure, VERSION_CUTOFF
|
||||
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)
|
||||
|
||||
@@ -1,37 +1,32 @@
|
||||
import builtins
|
||||
import os
|
||||
import uuid
|
||||
from typing import Annotated, Optional
|
||||
from enum import Enum
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Optional
|
||||
|
||||
import questionary
|
||||
import typer
|
||||
from prettytable import PrettyTable, SINGLE_BORDER
|
||||
from prettytable.colortable import ColorTable, Themes
|
||||
from tqdm import tqdm
|
||||
|
||||
from memgpt import utils
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.constants import LLM_MAX_TOKENS
|
||||
from memgpt.constants import MEMGPT_DIR
|
||||
from memgpt.credentials import MemGPTCredentials, SUPPORTED_AUTH_TYPES
|
||||
from memgpt.data_types import User, LLMConfig, EmbeddingConfig
|
||||
from memgpt.llm_api.openai import openai_get_model_list
|
||||
from memgpt.llm_api.azure_openai import azure_openai_get_model_list
|
||||
from memgpt.llm_api.google_ai import google_ai_get_model_list, google_ai_get_model_context_window
|
||||
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.cohere import cohere_get_model_list, cohere_get_model_context_window, COHERE_VALID_MODEL_LIST
|
||||
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.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.utils import get_available_wrappers
|
||||
from memgpt.server.utils import shorten_key_middle
|
||||
from memgpt.data_types import User, LLMConfig, EmbeddingConfig, Source
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.server.utils import shorten_key_middle
|
||||
from memgpt.models.pydantic_models import HumanModel, PersonaModel, PresetModel
|
||||
from memgpt.models.pydantic_models import HumanModel, PersonaModel
|
||||
from memgpt.presets.presets import create_preset_from_file
|
||||
from memgpt.server.utils import shorten_key_middle
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@@ -8,21 +8,16 @@ memgpt load <data-connector-type> --name <dataset-name> [ADDITIONAL ARGS]
|
||||
|
||||
"""
|
||||
|
||||
from typing import List, Optional, Annotated
|
||||
from tqdm import tqdm
|
||||
import numpy as np
|
||||
import typer
|
||||
import uuid
|
||||
from typing import Annotated, List, Optional
|
||||
|
||||
import typer
|
||||
|
||||
from memgpt.data_sources.connectors import load_data, DirectoryConnector, VectorDBConnector
|
||||
from memgpt.embeddings import embedding_model, check_and_split_text
|
||||
from memgpt.agent_store.storage import StorageConnector
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.data_types import Source, Passage, Document, User
|
||||
from memgpt.utils import get_utc_time, suppress_stdout
|
||||
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_types import Source
|
||||
from memgpt.metadata import MetadataStore
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
from typing import Optional
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
from requests import HTTPError
|
||||
|
||||
from memgpt.server.rest_api.admin.users import (
|
||||
CreateUserResponse,
|
||||
CreateAPIKeyResponse,
|
||||
GetAPIKeysResponse,
|
||||
CreateUserResponse,
|
||||
DeleteAPIKeyResponse,
|
||||
DeleteUserResponse,
|
||||
GetAllUsersResponse,
|
||||
GetAPIKeysResponse,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
import datetime
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
import uuid
|
||||
from typing import Dict, List, Union, Optional, Tuple
|
||||
import time
|
||||
import uuid
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
import requests
|
||||
|
||||
from memgpt.data_types import AgentState, User, Preset, LLMConfig, EmbeddingConfig, Source
|
||||
from memgpt.models.pydantic_models import HumanModel, PersonaModel, PresetModel, SourceModel, JobModel, JobStatus
|
||||
from memgpt.cli.cli import QuickstartChoice
|
||||
from memgpt.cli.cli import set_config_with_dict, quickstart as quickstart_func, str_to_quickstart_choice
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.data_sources.connectors import DataConnector
|
||||
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
|
||||
|
||||
# import pydantic response objects from memgpt.server.rest_api
|
||||
from memgpt.server.rest_api.agents.command import CommandResponse
|
||||
from memgpt.server.rest_api.agents.config import GetAgentResponse
|
||||
from memgpt.server.rest_api.agents.index import CreateAgentResponse, ListAgentsResponse
|
||||
from memgpt.server.rest_api.agents.memory import (
|
||||
GetAgentMemoryResponse,
|
||||
GetAgentArchivalMemoryResponse,
|
||||
UpdateAgentMemoryResponse,
|
||||
GetAgentMemoryResponse,
|
||||
InsertAgentArchivalMemoryResponse,
|
||||
UpdateAgentMemoryResponse,
|
||||
)
|
||||
from memgpt.server.rest_api.agents.index import ListAgentsResponse, CreateAgentResponse
|
||||
from memgpt.server.rest_api.agents.message import UserMessageResponse, GetAgentMessagesResponse
|
||||
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.personas.index import ListPersonasResponse
|
||||
from memgpt.server.rest_api.tools.index import ListToolsResponse, CreateToolResponse
|
||||
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.sources.index import ListSourcesResponse, UploadFileToSourceResponse
|
||||
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
|
||||
|
||||
|
||||
def create_client(base_url: Optional[str] = None, token: Optional[str] = None):
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
from memgpt.log import logger
|
||||
import configparser
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
import uuid
|
||||
from dataclasses import dataclass, field
|
||||
import configparser
|
||||
from dataclasses import dataclass
|
||||
|
||||
import memgpt
|
||||
import memgpt.utils as utils
|
||||
|
||||
from memgpt.constants import MEMGPT_DIR, DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET
|
||||
from memgpt.data_types import AgentState, LLMConfig, EmbeddingConfig
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET, MEMGPT_DIR
|
||||
from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig
|
||||
from memgpt.log import logger
|
||||
|
||||
|
||||
# helper functions for writing to configs
|
||||
@@ -89,7 +88,7 @@ class MemGPTConfig:
|
||||
@classmethod
|
||||
def load(cls) -> "MemGPTConfig":
|
||||
# avoid circular import
|
||||
from memgpt.migrate import config_is_compatible, VERSION_CUTOFF
|
||||
from memgpt.migrate import VERSION_CUTOFF, config_is_compatible
|
||||
from memgpt.utils import printd
|
||||
|
||||
if not config_is_compatible(allow_empty=True):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from logging import CRITICAL, ERROR, WARN, WARNING, INFO, DEBUG, NOTSET
|
||||
from logging import CRITICAL, DEBUG, ERROR, INFO, NOTSET, WARN, WARNING
|
||||
|
||||
MEMGPT_DIR = os.path.join(os.path.expanduser("~"), ".memgpt")
|
||||
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
from memgpt.log import logger
|
||||
import configparser
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
import configparser
|
||||
import typer
|
||||
import questionary
|
||||
from typing import Optional
|
||||
|
||||
import memgpt
|
||||
import memgpt.utils as utils
|
||||
from memgpt.utils import printd, get_schema_diff
|
||||
from memgpt.functions.functions import load_all_function_sets
|
||||
|
||||
from memgpt.constants import MEMGPT_DIR, LLM_MAX_TOKENS, DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET
|
||||
from memgpt.data_types import AgentState, User, LLMConfig, EmbeddingConfig
|
||||
from memgpt.config import get_field, set_field
|
||||
|
||||
from memgpt.constants import MEMGPT_DIR
|
||||
|
||||
SUPPORTED_AUTH_TYPES = ["bearer_token", "api_key"]
|
||||
|
||||
@@ -102,7 +92,7 @@ class MemGPTCredentials:
|
||||
return config
|
||||
|
||||
def save(self):
|
||||
import memgpt
|
||||
pass
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
# openai config
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from memgpt.data_types import Passage, Document, EmbeddingConfig, Source
|
||||
from memgpt.utils import create_uuid_from_string
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.embeddings import embedding_model
|
||||
from memgpt.data_types import Document, Passage
|
||||
from typing import Dict, Iterator, List, Optional, Tuple
|
||||
|
||||
from typing import List, Iterator, Dict, Tuple, Optional
|
||||
import typer
|
||||
from llama_index.core import Document as LlamaIndexDocument
|
||||
|
||||
from memgpt.agent_store.storage import StorageConnector
|
||||
from memgpt.data_types import Document, EmbeddingConfig, Passage, Source
|
||||
from memgpt.embeddings import embedding_model
|
||||
from memgpt.utils import create_uuid_from_string
|
||||
|
||||
|
||||
class DataConnector:
|
||||
def generate_documents(self) -> Iterator[Tuple[str, Dict]]: # -> Iterator[Document]:
|
||||
@@ -202,8 +202,8 @@ class VectorDBConnector(DataConnector):
|
||||
yield self.table_name, None
|
||||
|
||||
def generate_passages(self, documents: List[Document], chunk_size: int = 1024) -> Iterator[Tuple[str, Dict]]: # -> Iterator[Passage]:
|
||||
from sqlalchemy import select, MetaData, Table, Inspector
|
||||
from pgvector.sqlalchemy import Vector
|
||||
from sqlalchemy import Inspector, MetaData, Table, select
|
||||
|
||||
metadata = MetaData()
|
||||
# Create an inspector to inspect the database
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
""" This module contains the data types used by MemGPT. Each data type must include a function to create a DB model. """
|
||||
|
||||
import uuid
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional, List, Dict, TypeVar
|
||||
import numpy as np
|
||||
from pydantic import BaseModel, Field, Json
|
||||
from typing import Dict, List, Optional, TypeVar
|
||||
|
||||
from memgpt.constants import (
|
||||
DEFAULT_HUMAN,
|
||||
DEFAULT_MEMGPT_MODEL,
|
||||
DEFAULT_PERSONA,
|
||||
DEFAULT_PRESET,
|
||||
LLM_MAX_TOKENS,
|
||||
MAX_EMBEDDING_DIM,
|
||||
TOOL_CALL_ID_MAX_LEN,
|
||||
)
|
||||
from memgpt.utils import get_utc_time, create_uuid_from_string
|
||||
from memgpt.models import chat_completion_response
|
||||
from memgpt.utils import get_human_text, get_persona_text, printd, is_utc_datetime
|
||||
from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
|
||||
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.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
|
||||
|
||||
|
||||
class Record:
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
import typer
|
||||
import uuid
|
||||
from typing import Optional, List, Any
|
||||
import os
|
||||
import uuid
|
||||
from typing import Any, List, Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
from memgpt.utils import is_valid_url, printd
|
||||
from memgpt.data_types import EmbeddingConfig
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.constants import MAX_EMBEDDING_DIM, EMBEDDING_TO_TOKENIZER_MAP, EMBEDDING_TO_TOKENIZER_DEFAULT
|
||||
|
||||
# from llama_index.core.base.embeddings import BaseEmbedding
|
||||
from llama_index.core.node_parser import SentenceSplitter
|
||||
from llama_index.core import Document as LlamaIndexDocument
|
||||
|
||||
# from llama_index.core.base.embeddings import BaseEmbedding
|
||||
# from llama_index.core.embeddings import BaseEmbedding
|
||||
# from llama_index.core.base.embeddings.base import BaseEmbedding
|
||||
@@ -20,6 +11,15 @@ from llama_index.core import Document as LlamaIndexDocument
|
||||
# from llama_index.embeddings.base import BaseEmbedding
|
||||
# from llama_index.embeddings.huggingface_utils import format_text
|
||||
import tiktoken
|
||||
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.credentials import MemGPTCredentials
|
||||
from memgpt.data_types import EmbeddingConfig
|
||||
from memgpt.utils import is_valid_url, printd
|
||||
|
||||
|
||||
def parse_and_chunk_text(text: str, chunk_size: int) -> List[str]:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import Optional
|
||||
import datetime
|
||||
import json
|
||||
import math
|
||||
from typing import Optional
|
||||
|
||||
from memgpt.constants import MAX_PAUSE_HEARTBEATS, RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE, JSON_ENSURE_ASCII
|
||||
from memgpt.agent import Agent
|
||||
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)
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
from typing import Optional
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
from memgpt.constants import (
|
||||
JSON_LOADS_STRICT,
|
||||
MESSAGE_CHATGPT_FUNCTION_MODEL,
|
||||
MESSAGE_CHATGPT_FUNCTION_SYSTEM_MESSAGE,
|
||||
MAX_PAUSE_HEARTBEATS,
|
||||
JSON_ENSURE_ASCII,
|
||||
)
|
||||
from memgpt.llm_api.llm_api_tools import create
|
||||
import requests
|
||||
|
||||
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
|
||||
|
||||
|
||||
def message_chatgpt(self, message: str):
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import importlib
|
||||
import inspect
|
||||
import os
|
||||
import warnings
|
||||
import sys
|
||||
import warnings
|
||||
from types import ModuleType
|
||||
|
||||
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, MEMGPT_DIR
|
||||
from memgpt.functions.schema_generator import generate_schema
|
||||
from memgpt.constants import MEMGPT_DIR, CLI_WARNING_PREFIX
|
||||
|
||||
USER_FUNCTIONS_DIR = os.path.join(MEMGPT_DIR, "functions")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import get_args, get_origin
|
||||
from docstring_parser import parse
|
||||
from pydantic import BaseModel
|
||||
|
||||
from memgpt.constants import FUNCTION_PARAM_NAME_REQ_HEARTBEAT, FUNCTION_PARAM_TYPE_REQ_HEARTBEAT, FUNCTION_PARAM_DESCRIPTION_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"]
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import json
|
||||
import re
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Optional
|
||||
|
||||
from colorama import Fore, Style, init
|
||||
|
||||
from memgpt.utils import printd
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, JSON_LOADS_STRICT
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.utils import printd
|
||||
|
||||
init(autoreset=True)
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
import requests
|
||||
import uuid
|
||||
import json
|
||||
import re
|
||||
from typing import Union, Optional, List
|
||||
import uuid
|
||||
from typing import List, Optional, Union
|
||||
|
||||
import requests
|
||||
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.models.chat_completion_response import (
|
||||
ChatCompletionResponse,
|
||||
UsageStatistics,
|
||||
Choice,
|
||||
Message as ChoiceMessage, # NOTE: avoid conflict with our own MemGPT Message datatype
|
||||
ToolCall,
|
||||
FunctionCall,
|
||||
)
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool
|
||||
from memgpt.utils import smart_urljoin, get_utc_time
|
||||
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
|
||||
|
||||
BASE_URL = "https://api.anthropic.com/v1"
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import requests
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from memgpt.models.chat_completion_response import ChatCompletionResponse
|
||||
from memgpt.models.embedding_response import EmbeddingResponse
|
||||
from memgpt.utils import smart_urljoin
|
||||
|
||||
|
||||
MODEL_TO_AZURE_ENGINE = {
|
||||
"gpt-4-1106-preview": "gpt-4",
|
||||
"gpt-4": "gpt-4",
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
import requests
|
||||
import uuid
|
||||
import json
|
||||
import re
|
||||
from typing import Union, Optional, List
|
||||
import uuid
|
||||
from typing import List, Optional, Union
|
||||
|
||||
import requests
|
||||
|
||||
from memgpt.constants import JSON_ENSURE_ASCII
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.models.chat_completion_response import (
|
||||
ChatCompletionResponse,
|
||||
UsageStatistics,
|
||||
Choice,
|
||||
Message as ChoiceMessage, # NOTE: avoid conflict with our own MemGPT Message datatype
|
||||
ToolCall,
|
||||
FunctionCall,
|
||||
)
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool
|
||||
from memgpt.utils import smart_urljoin, get_utc_time, get_tool_call_id
|
||||
from memgpt.constants import NON_USER_MSG_PREFIX, JSON_ENSURE_ASCII
|
||||
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 ToolCall, UsageStatistics
|
||||
from memgpt.utils import get_tool_call_id, get_utc_time, smart_urljoin
|
||||
|
||||
BASE_URL = "https://api.cohere.ai/v1"
|
||||
|
||||
@@ -168,7 +163,7 @@ def convert_cohere_response_to_chatcompletion(
|
||||
function_name = tool_call_response["name"]
|
||||
function_args = tool_call_response["parameters"]
|
||||
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
|
||||
|
||||
assert INNER_THOUGHTS_KWARG in function_args
|
||||
# NOTE:
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import requests
|
||||
import json
|
||||
import uuid
|
||||
from typing import Union, List, Optional
|
||||
from typing import List, Optional
|
||||
|
||||
from memgpt.models.chat_completion_response import ChatCompletionResponse, Choice, Message, ToolCall, FunctionCall, UsageStatistics
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool
|
||||
from memgpt.models.embedding_response import EmbeddingResponse
|
||||
from memgpt.utils import smart_urljoin, get_tool_call_id, get_utc_time
|
||||
from memgpt.local_llm.utils import count_tokens
|
||||
import requests
|
||||
|
||||
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.constants import NON_USER_MSG_PREFIX, JSON_ENSURE_ASCII
|
||||
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.utils import get_tool_call_id, get_utc_time
|
||||
|
||||
# from memgpt.data_types import ToolCall
|
||||
|
||||
@@ -282,7 +282,7 @@ def convert_google_ai_response_to_chatcompletion(
|
||||
|
||||
# NOTE: this also involves stripping the inner monologue out of the function
|
||||
if pull_inner_thoughts_from_args:
|
||||
from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
|
||||
from memgpt.local_llm.constants import INNER_THOUGHTS_KWARG
|
||||
|
||||
assert INNER_THOUGHTS_KWARG in function_args, f"Couldn't find inner thoughts in function args:\n{function_call}"
|
||||
inner_thoughts = function_args.pop(INNER_THOUGHTS_KWARG)
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
import random
|
||||
import time
|
||||
import requests
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.local_llm.chat_completion_proxy import get_chat_completion
|
||||
import requests
|
||||
|
||||
from memgpt.constants import CLI_WARNING_PREFIX
|
||||
from memgpt.models.chat_completion_response import ChatCompletionResponse
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest, Tool, cast_message_to_subtype
|
||||
from memgpt.streaming_interface import AgentChunkStreamingInterface, AgentRefreshStreamingInterface
|
||||
|
||||
from memgpt.credentials import MemGPTCredentials
|
||||
from memgpt.data_types import AgentState, Message
|
||||
|
||||
from memgpt.llm_api.openai import openai_chat_completions_request, openai_chat_completions_process_stream
|
||||
from memgpt.llm_api.azure_openai import azure_openai_chat_completions_request, MODEL_TO_AZURE_ENGINE
|
||||
from memgpt.llm_api.google_ai import (
|
||||
google_ai_chat_completions_request,
|
||||
convert_tools_to_google_ai_format,
|
||||
)
|
||||
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.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.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_response import ChatCompletionResponse
|
||||
from memgpt.streaming_interface import AgentChunkStreamingInterface, AgentRefreshStreamingInterface
|
||||
|
||||
LLM_API_PROVIDER_OPTIONS = ["openai", "azure", "anthropic", "google_ai", "cohere", "local"]
|
||||
|
||||
@@ -82,7 +76,7 @@ def retry_with_exponential_backoff(
|
||||
"""Retry a function with exponential backoff."""
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
from memgpt.utils import printd
|
||||
pass
|
||||
|
||||
# Initialize variables
|
||||
num_retries = 0
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
import requests
|
||||
import json
|
||||
from typing import Generator, Optional, Union
|
||||
|
||||
import httpx
|
||||
import requests
|
||||
from httpx_sse import connect_sse
|
||||
from httpx_sse._exceptions import SSEError
|
||||
from typing import Union, Optional, Generator
|
||||
|
||||
from memgpt.local_llm.utils import num_tokens_from_functions, num_tokens_from_messages
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest
|
||||
from memgpt.models.chat_completion_response import (
|
||||
ChatCompletionChunkResponse,
|
||||
ChatCompletionResponse,
|
||||
Choice,
|
||||
FunctionCall,
|
||||
Message,
|
||||
ToolCall,
|
||||
FunctionCall,
|
||||
UsageStatistics,
|
||||
ChatCompletionChunkResponse,
|
||||
)
|
||||
from memgpt.models.chat_completion_request import ChatCompletionRequest
|
||||
from memgpt.models.embedding_response import EmbeddingResponse
|
||||
from memgpt.utils import smart_urljoin, get_utc_time
|
||||
from memgpt.local_llm.utils import num_tokens_from_messages, num_tokens_from_functions
|
||||
from memgpt.interface import AgentInterface
|
||||
from memgpt.streaming_interface import AgentChunkStreamingInterface, AgentRefreshStreamingInterface
|
||||
|
||||
from memgpt.utils import get_utc_time, smart_urljoin
|
||||
|
||||
OPENAI_SSE_DONE = "[DONE]"
|
||||
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
"""Key idea: create drop-in replacement for agent's ChatCompletion call that runs on an OpenLLM backend"""
|
||||
|
||||
from datetime import datetime
|
||||
import requests
|
||||
import json
|
||||
import uuid
|
||||
|
||||
import requests
|
||||
|
||||
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.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
|
||||
from memgpt.local_llm.llm_chat_completion_wrappers import simple_summary_wrapper
|
||||
from memgpt.local_llm.lmstudio.api import get_lmstudio_completion
|
||||
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.local_llm.lmstudio.api import get_lmstudio_completion
|
||||
from memgpt.local_llm.llamacpp.api import get_llamacpp_completion
|
||||
from memgpt.local_llm.koboldcpp.api import get_koboldcpp_completion
|
||||
from memgpt.local_llm.ollama.api import get_ollama_completion
|
||||
from memgpt.local_llm.vllm.api import get_vllm_completion
|
||||
from memgpt.local_llm.groq.api import get_groq_completion
|
||||
from memgpt.local_llm.llm_chat_completion_wrappers import simple_summary_wrapper
|
||||
from memgpt.local_llm.constants import DEFAULT_WRAPPER
|
||||
from memgpt.local_llm.utils import get_available_wrappers, count_tokens
|
||||
from memgpt.local_llm.function_parser import patch_function
|
||||
from memgpt.prompts.gpt_summarize import SYSTEM as SUMMARIZE_SYSTEM_MESSAGE
|
||||
from memgpt.errors import LocalLLMConnectionError, LocalLLMError
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, JSON_ENSURE_ASCII
|
||||
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
|
||||
|
||||
has_shown_warning = False
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# import memgpt.local_llm.llm_chat_completion_wrappers.airoboros as airoboros
|
||||
from memgpt.local_llm.llm_chat_completion_wrappers.chatml import ChatMLInnerMonologueWrapper, ChatMLOuterInnerMonologueWrapper
|
||||
from memgpt.local_llm.llm_chat_completion_wrappers.chatml import ChatMLInnerMonologueWrapper
|
||||
|
||||
DEFAULT_ENDPOINTS = {
|
||||
# Local
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import inspect
|
||||
import json
|
||||
import re
|
||||
from copy import copy
|
||||
from inspect import isclass, getdoc
|
||||
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 docstring_parser import parse
|
||||
from pydantic import BaseModel, create_model, Field
|
||||
from typing import Any, Type, List, get_args, get_origin, Tuple, Union, Optional, _GenericAlias
|
||||
from enum import Enum
|
||||
from typing import Callable
|
||||
import re
|
||||
from pydantic import BaseModel, create_model
|
||||
|
||||
|
||||
class PydanticDataType(Enum):
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
from typing import Tuple
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import post_json_auth_request
|
||||
from memgpt.utils import count_tokens
|
||||
|
||||
|
||||
API_CHAT_SUFFIX = "/v1/chat/completions"
|
||||
# LMSTUDIO_API_COMPLETIONS_SUFFIX = "/v1/completions"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
import re
|
||||
from memgpt.constants import JSON_LOADS_STRICT
|
||||
|
||||
from memgpt.constants import JSON_LOADS_STRICT
|
||||
from memgpt.errors import LLMJSONParsingError
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import count_tokens, post_json_auth_request
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
# see https://lite.koboldai.net/koboldcpp_api#/v1/post_v1_generate
|
||||
SIMPLE = {
|
||||
"stop_sequence": [
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import count_tokens, post_json_auth_request
|
||||
|
||||
|
||||
LLAMACPP_API_SUFFIX = "/completion"
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
# see https://github.com/ggerganov/llama.cpp/blob/master/examples/server/README.md#api-endpoints for options
|
||||
SIMPLE = {
|
||||
"stop": [
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
from ..json_parser import clean_json
|
||||
from ...constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
|
||||
from ...errors import LLMJSONParsingError
|
||||
from ..json_parser import clean_json
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
|
||||
class Airoboros21Wrapper(LLMChatCompletionWrapper):
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import json
|
||||
|
||||
from memgpt.local_llm.llm_chat_completion_wrappers.wrapper_base import LLMChatCompletionWrapper
|
||||
from memgpt.local_llm.json_parser import clean_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
|
||||
|
||||
PREFIX_HINT = """# Reminders:
|
||||
# Important information about yourself and the user is stored in (limited) core memory
|
||||
|
||||
@@ -2,11 +2,10 @@ import json
|
||||
|
||||
import yaml
|
||||
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
from ...constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
|
||||
from ..json_parser import clean_json
|
||||
from ...constants import JSON_ENSURE_ASCII
|
||||
from ...errors import LLMJSONParsingError
|
||||
from ..json_parser import clean_json
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
|
||||
# A configurable model agnostic wrapper.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
from ..json_parser import clean_json
|
||||
from ...constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
|
||||
from ...errors import LLMJSONParsingError
|
||||
from ..json_parser import clean_json
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
|
||||
class Dolphin21MistralWrapper(LLMChatCompletionWrapper):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
from ...constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
|
||||
class SimpleSummaryWrapper(LLMChatCompletionWrapper):
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
from ..json_parser import clean_json
|
||||
from ...constants import JSON_ENSURE_ASCII
|
||||
from ...errors import LLMJSONParsingError
|
||||
from ..json_parser import clean_json
|
||||
from .wrapper_base import LLMChatCompletionWrapper
|
||||
|
||||
|
||||
class ZephyrMistralWrapper(LLMChatCompletionWrapper):
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import post_json_auth_request
|
||||
from memgpt.utils import count_tokens
|
||||
|
||||
|
||||
LMSTUDIO_API_CHAT_SUFFIX = "/v1/chat/completions"
|
||||
LMSTUDIO_API_COMPLETIONS_SUFFIX = "/v1/completions"
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
SIMPLE = {
|
||||
"stop": [
|
||||
"\nUSER:",
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
|
||||
from memgpt.errors import LocalLLMError
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import post_json_auth_request
|
||||
from memgpt.utils import count_tokens
|
||||
from memgpt.errors import LocalLLMError
|
||||
|
||||
|
||||
OLLAMA_API_SUFFIX = "/api/generate"
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
# see https://github.com/jmorganca/ollama/blob/main/docs/api.md
|
||||
# and https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values
|
||||
SIMPLE = {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from memgpt.constants import MEMGPT_DIR, JSON_ENSURE_ASCII
|
||||
from memgpt.local_llm.settings.simple import settings as simple_settings
|
||||
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.simple import settings as simple_settings
|
||||
|
||||
DEFAULT = "simple"
|
||||
SETTINGS_FOLDER_NAME = "settings"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import os
|
||||
import requests
|
||||
import tiktoken
|
||||
from typing import List
|
||||
|
||||
import requests
|
||||
import tiktoken
|
||||
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.airoboros as airoboros
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.dolphin as dolphin
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.zephyr as zephyr
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.chatml as chatml
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.configurable_wrapper as configurable_wrapper
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.dolphin as dolphin
|
||||
import memgpt.local_llm.llm_chat_completion_wrappers.zephyr as zephyr
|
||||
|
||||
|
||||
def post_json_auth_request(uri, json_payload, auth_type, auth_key):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import count_tokens, post_json_auth_request
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import count_tokens, post_json_auth_request
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from urllib.parse import urljoin
|
||||
import requests
|
||||
|
||||
from memgpt.local_llm.settings.settings import get_completions_settings
|
||||
from memgpt.local_llm.utils import count_tokens, post_json_auth_request
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
SIMPLE = {
|
||||
"stopping_strings": [
|
||||
"\nUSER:",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from ...constants import LLM_MAX_TOKENS
|
||||
|
||||
SIMPLE = {
|
||||
# "stopping_strings": [
|
||||
"stop": [
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
import logging
|
||||
from logging.handlers import RotatingFileHandler
|
||||
from memgpt.constants import (
|
||||
LOGGER_NAME,
|
||||
LOGGER_DEFAULT_LEVEL,
|
||||
LOGGER_DIR,
|
||||
LOGGER_FILENAME,
|
||||
LOGGER_FILE_BACKUP_COUNT,
|
||||
LOGGER_MAX_FILE_SIZE,
|
||||
)
|
||||
|
||||
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):
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import requests
|
||||
import json
|
||||
|
||||
import questionary
|
||||
import requests
|
||||
import typer
|
||||
|
||||
from rich.console import Console
|
||||
from memgpt.constants import FUNC_FAILED_HEARTBEAT_MESSAGE, JSON_ENSURE_ASCII, JSON_LOADS_STRICT, REQ_HEARTBEAT_MESSAGE
|
||||
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
|
||||
# from memgpt.interface import CLIInterface as interface # for printing to terminal
|
||||
from memgpt.streaming_interface import AgentRefreshStreamingInterface
|
||||
from memgpt.config import MemGPTConfig
|
||||
import memgpt.agent as agent
|
||||
import memgpt.system as system
|
||||
import memgpt.errors as errors
|
||||
from memgpt.cli.cli import run, version, server, open_folder, quickstart, migrate, delete_agent
|
||||
from memgpt.cli.cli_config import configure, list, add, delete
|
||||
from memgpt.cli.cli_load import app as load_app
|
||||
from memgpt.metadata import MetadataStore
|
||||
import memgpt.system as system
|
||||
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_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.metadata import MetadataStore
|
||||
|
||||
# from memgpt.interface import CLIInterface as interface # for printing to terminal
|
||||
from memgpt.streaming_interface import AgentRefreshStreamingInterface
|
||||
|
||||
# interface = interface()
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import datetime
|
||||
import uuid
|
||||
from typing import Optional, List, Tuple, Union
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
from memgpt.constants import MESSAGE_SUMMARY_WARNING_FRAC, MESSAGE_SUMMARY_REQUEST_ACK
|
||||
from memgpt.utils import get_local_time, printd, count_tokens, validate_date_format, extract_date_from_timestamp
|
||||
from memgpt.prompts.gpt_summarize import SYSTEM as SUMMARY_PROMPT_SYSTEM
|
||||
from memgpt.constants import MESSAGE_SUMMARY_REQUEST_ACK, MESSAGE_SUMMARY_WARNING_FRAC
|
||||
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.data_types import Message, Passage, AgentState
|
||||
from memgpt.embeddings import embedding_model, query_embedding, parse_and_chunk_text
|
||||
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 llama_index import Document
|
||||
# from llama_index.node_parser import SimpleNodeParser
|
||||
@@ -370,7 +370,6 @@ class EmbeddingArchivalMemory(ArchivalMemory):
|
||||
:type archival_memory_database: str
|
||||
"""
|
||||
from memgpt.agent_store.storage import StorageConnector
|
||||
from memgpt.config import MemGPTConfig
|
||||
|
||||
self.top_k = top_k
|
||||
self.agent_state = agent_state
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
""" Metadata store for user/agent/data_source information"""
|
||||
|
||||
import os
|
||||
import inspect as python_inspect
|
||||
import uuid
|
||||
import os
|
||||
import secrets
|
||||
from typing import Optional, List
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
from memgpt.settings import settings
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_MEMGPT_MODEL, DEFAULT_PERSONA, DEFAULT_PRESET, LLM_MAX_TOKENS
|
||||
from memgpt.utils import enforce_types, printd, get_utc_time
|
||||
from memgpt.data_types import AgentState, Source, User, LLMConfig, EmbeddingConfig, Token, Preset
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.functions.functions import load_all_function_sets
|
||||
|
||||
from memgpt.models.pydantic_models import PersonaModel, HumanModel, ToolModel, JobModel, JobStatus
|
||||
|
||||
from sqlalchemy import create_engine, Column, String, BIGINT, select, inspect, text, JSON, BLOB, BINARY, ARRAY, Boolean
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import sessionmaker, mapped_column, declarative_base
|
||||
from sqlalchemy.orm.session import close_all_sessions
|
||||
from sqlalchemy import BIGINT, CHAR, JSON, Boolean, Column, DateTime, String, TypeDecorator, create_engine, func, inspect
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import declarative_base, sessionmaker
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy import Column, BIGINT, String, DateTime
|
||||
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||
from sqlalchemy_json import mutable_json_type, MutableJson
|
||||
from sqlalchemy import TypeDecorator, CHAR
|
||||
from sqlalchemy.orm import sessionmaker, mapped_column, declarative_base
|
||||
|
||||
from memgpt.config import MemGPTConfig
|
||||
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.settings import settings
|
||||
from memgpt.utils import enforce_types, get_utc_time, printd
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
import configparser
|
||||
from datetime import datetime
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import pickle
|
||||
import glob
|
||||
import shutil
|
||||
import sys
|
||||
import traceback
|
||||
import uuid
|
||||
import json
|
||||
import shutil
|
||||
from typing import Optional, List
|
||||
import pytz
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
import pytz
|
||||
import questionary
|
||||
import typer
|
||||
from tqdm import tqdm
|
||||
import questionary
|
||||
|
||||
|
||||
from memgpt.agent import Agent, save_agent
|
||||
from memgpt.data_types import AgentState, User, Passage, Source, Message
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.cli.cli_config import configure
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.data_types import AgentState, Message, Passage, Source, User
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.persistence_manager import LocalStateManager
|
||||
from memgpt.utils import (
|
||||
MEMGPT_DIR,
|
||||
get_utc_time,
|
||||
version_less_than,
|
||||
OpenAIBackcompatUnpickler,
|
||||
annotate_message_json_list_with_tool_calls,
|
||||
get_utc_time,
|
||||
parse_formatted_time,
|
||||
version_less_than,
|
||||
)
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.cli.cli_config import configure
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.persistence_manager import PersistenceManager, LocalStateManager
|
||||
|
||||
# This is the version where the breaking change was made
|
||||
VERSION_CUTOFF = "0.2.12"
|
||||
@@ -132,7 +131,6 @@ def migrate_source(source_name: str, data_dir: str = MEMGPT_DIR, ms: Optional[Me
|
||||
assert os.path.exists(source_path), f"Source {source_name} does not exist at {source_path}"
|
||||
|
||||
# load state from old checkpoint file
|
||||
from memgpt.cli.cli_load import load_index
|
||||
|
||||
# 2. Create a new AgentState using the agent config + agent internal state
|
||||
config = MemGPTConfig.load()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from typing import List, Union, Optional, Dict, Literal, Any
|
||||
from pydantic import BaseModel, Field, Json
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SystemMessage(BaseModel):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import List, Optional, Union, Dict, Literal
|
||||
from pydantic import BaseModel, Field
|
||||
import datetime
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
# class ToolCallFunction(BaseModel):
|
||||
# name: str
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import List, Literal
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import List, Union, Optional, Dict
|
||||
from enum import Enum
|
||||
from pydantic import BaseModel, Field, Json
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ImageFile(BaseModel):
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
from typing import List, Optional, Dict, Literal, Type
|
||||
from pydantic import BaseModel, Field, Json, ConfigDict
|
||||
|
||||
from enum import Enum
|
||||
|
||||
import uuid
|
||||
import base64
|
||||
import numpy as np
|
||||
from datetime import datetime
|
||||
from sqlmodel import Field, SQLModel
|
||||
from sqlalchemy_utils import ChoiceType
|
||||
from sqlalchemy import JSON, Column, BINARY, TypeDecorator, String
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_MEMGPT_MODEL, DEFAULT_PERSONA, DEFAULT_PRESET, LLM_MAX_TOKENS, MAX_EMBEDDING_DIM
|
||||
from memgpt.utils import get_human_text, get_persona_text, printd, get_utc_time
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from sqlalchemy import JSON, Column
|
||||
from sqlalchemy_utils import ChoiceType
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
|
||||
from memgpt.utils import get_human_text, get_persona_text, get_utc_time
|
||||
|
||||
|
||||
class LLMConfigModel(BaseModel):
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from enum import Enum
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
from enum import Enum
|
||||
from memgpt.constants import JSON_ENSURE_ASCII
|
||||
|
||||
# import openai
|
||||
|
||||
from memgpt.constants import JSON_ENSURE_ASCII
|
||||
|
||||
# from openai import api_requestor, util
|
||||
# from openai.openai_response import OpenAIResponse
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
from memgpt.memory import (
|
||||
BaseRecallMemory,
|
||||
EmbeddingArchivalMemory,
|
||||
)
|
||||
from memgpt.data_types import AgentState, Message
|
||||
from memgpt.memory import BaseRecallMemory, EmbeddingArchivalMemory
|
||||
from memgpt.utils import printd
|
||||
from memgpt.data_types import Message, ToolCall, AgentState
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def parse_formatted_time(formatted_time: str):
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
from typing import List
|
||||
import os
|
||||
from memgpt.data_types import AgentState, Preset
|
||||
from memgpt.interface import AgentInterface
|
||||
from memgpt.presets.utils import load_all_presets, is_valid_yaml_format, load_yaml_file
|
||||
from memgpt.utils import get_human_text, get_persona_text, printd, list_human_files, list_persona_files
|
||||
from memgpt.prompts import gpt_system
|
||||
from memgpt.functions.functions import load_all_function_sets
|
||||
from memgpt.metadata import MetadataStore
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET
|
||||
from memgpt.models.pydantic_models import HumanModel, PersonaModel
|
||||
|
||||
import uuid
|
||||
from typing import List
|
||||
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
|
||||
from memgpt.data_types import AgentState, Preset
|
||||
from memgpt.functions.functions import load_all_function_sets
|
||||
from memgpt.interface import AgentInterface
|
||||
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
|
||||
|
||||
available_presets = load_all_presets()
|
||||
preset_options = list(available_presets.keys())
|
||||
@@ -142,12 +141,10 @@ def create_agent_from_preset(
|
||||
# available_presets = load_all_presets()
|
||||
# if preset_name not in available_presets:
|
||||
# raise ValueError(f"Preset '{preset_name}.yaml' not found")
|
||||
|
||||
# preset = available_presets[preset_name]
|
||||
# preset_system_prompt = preset["system_prompt"]
|
||||
# preset_function_set_names = preset["functions"]
|
||||
# preset_function_set_schemas = generate_functions_json(preset_function_set_names)
|
||||
|
||||
# Override the following in the AgentState:
|
||||
# persona: str # the current persona text
|
||||
# human: str # the current human text
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import glob
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
from memgpt.constants import MEMGPT_DIR
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from functools import partial
|
||||
|
||||
from fastapi import APIRouter, Body, HTTPException, Depends
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.server.rest_api.auth_token import get_current_user
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import re
|
||||
import uuid
|
||||
from functools import partial
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Query, HTTPException, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import List, Optional
|
||||
|
||||
from memgpt.models.pydantic_models import AgentStateModel, LLMConfigModel, EmbeddingConfigModel
|
||||
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.server.rest_api.auth_token import get_current_user
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.server import SyncServer
|
||||
|
||||
@@ -2,14 +2,13 @@ import uuid
|
||||
from functools import partial
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
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
|
||||
from memgpt.server.rest_api.auth_token import get_current_user
|
||||
from memgpt.data_types import AgentState
|
||||
from memgpt.models.pydantic_models import LLMConfigModel, EmbeddingConfigModel, AgentStateModel, PresetModel
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import uuid
|
||||
from functools import partial
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, HTTPException, status, Query
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Query, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
import asyncio
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from asyncio import AbstractEventLoop
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
from typing import List, Optional, Any
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import APIRouter, Body, HTTPException, Query, Depends
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Query
|
||||
from pydantic import BaseModel, Field
|
||||
from starlette.responses import StreamingResponse
|
||||
|
||||
from memgpt.constants import JSON_ENSURE_ASCII
|
||||
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
|
||||
from memgpt.data_types import Message
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
|
||||
from memgpt.server.server import SyncServer
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import uuid
|
||||
from functools import partial
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends, Body
|
||||
from fastapi import APIRouter, Body, Depends
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.models.pydantic_models import HumanModel
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import asyncio
|
||||
import queue
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
import pytz
|
||||
|
||||
from memgpt.interface import AgentInterface
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.interface import AgentInterface
|
||||
from memgpt.utils import is_utc_datetime
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
from functools import partial
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.models.pydantic_models import 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
|
||||
|
||||
from memgpt.models.pydantic_models import LLMConfigModel, EmbeddingConfigModel
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
|
||||
@@ -1,37 +1,27 @@
|
||||
from fastapi import FastAPI
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, HTTPException, Query, Path
|
||||
from pydantic import BaseModel, Field, constr, validator
|
||||
from starlette.responses import StreamingResponse
|
||||
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.server import SyncServer
|
||||
from fastapi import APIRouter, Body, HTTPException, Path, Query
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.config import MemGPTConfig
|
||||
import uuid
|
||||
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.rest_api.static_files import mount_static_files
|
||||
from memgpt.constants import DEFAULT_PRESET
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.models.openai import (
|
||||
AssistantFile,
|
||||
MessageFile,
|
||||
MessageRoleType,
|
||||
OpenAIAssistant,
|
||||
OpenAIThread,
|
||||
OpenAIMessage,
|
||||
OpenAIRun,
|
||||
OpenAIRunStep,
|
||||
MessageRoleType,
|
||||
OpenAIThread,
|
||||
Text,
|
||||
ImageFile,
|
||||
ToolCall,
|
||||
ToolCallOutput,
|
||||
)
|
||||
from memgpt.data_types import LLMConfig, EmbeddingConfig, Message
|
||||
from memgpt.constants import DEFAULT_PRESET
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.utils import get_utc_time
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -2,7 +2,7 @@ import uuid
|
||||
from functools import partial
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends, Body
|
||||
from fastapi import APIRouter, Body, Depends
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.models.pydantic_models import PersonaModel
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import uuid
|
||||
from functools import partial
|
||||
from typing import List, Optional, Dict, Union
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Query, HTTPException, status
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
|
||||
from memgpt.data_types import Preset # TODO remove
|
||||
from memgpt.models.pydantic_models import 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
|
||||
from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import json
|
||||
import uvicorn
|
||||
from typing import Optional
|
||||
import logging
|
||||
import os
|
||||
import secrets
|
||||
import subprocess
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import FastAPI, HTTPException, Depends
|
||||
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
||||
import uvicorn
|
||||
from fastapi import Depends, FastAPI, HTTPException
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
|
||||
from memgpt.settings import settings
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.server.constants import REST_DEFAULT_PORT
|
||||
from memgpt.server.rest_api.admin.users import setup_admin_router
|
||||
from memgpt.server.rest_api.agents.command import setup_agents_command_router
|
||||
from memgpt.server.rest_api.agents.config import setup_agents_config_router
|
||||
@@ -23,14 +25,12 @@ 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.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
|
||||
from memgpt.server.rest_api.static_files import mount_static_files
|
||||
from memgpt.server.rest_api.tools.index import setup_tools_index_router
|
||||
from memgpt.server.rest_api.sources.index import setup_sources_index_router
|
||||
from memgpt.server.rest_api.presets.index import setup_presets_index_router
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.server.constants import REST_DEFAULT_PORT
|
||||
import subprocess
|
||||
from memgpt.settings import settings
|
||||
|
||||
"""
|
||||
Basic REST API sitting on top of the internal MemGPT python server (SyncServer)
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import uuid
|
||||
import tempfile
|
||||
import os
|
||||
import hashlib
|
||||
import tempfile
|
||||
import uuid
|
||||
from functools import partial
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Query, HTTPException, status, UploadFile, BackgroundTasks
|
||||
from fastapi import APIRouter, BackgroundTasks, Body, Depends, HTTPException, Query, UploadFile, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
from starlette.responses import StreamingResponse
|
||||
|
||||
from memgpt.models.pydantic_models import SourceModel, PassageModel, DocumentModel, JobModel, JobStatus
|
||||
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.server.rest_api.auth_token import get_current_user
|
||||
from memgpt.server.rest_api.interface import QueuingInterface
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.data_types import Source
|
||||
from memgpt.data_sources.connectors import DirectoryConnector
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from fastapi import HTTPException, FastAPI
|
||||
from starlette.staticfiles import StaticFiles
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import uuid
|
||||
from functools import partial
|
||||
from typing import List, Optional, Literal
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, Body
|
||||
from fastapi import APIRouter, Body, Depends
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from memgpt.models.pydantic_models import ToolModel
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import json
|
||||
import subprocess
|
||||
import logging
|
||||
import uuid
|
||||
import warnings
|
||||
from abc import abstractmethod
|
||||
from datetime import datetime
|
||||
from functools import wraps
|
||||
from threading import Lock
|
||||
from typing import Union, Callable, Optional, List, Tuple
|
||||
import warnings
|
||||
from typing import Callable, List, Optional, Tuple, Union
|
||||
|
||||
from fastapi import HTTPException
|
||||
import uvicorn
|
||||
|
||||
import memgpt.constants as constants
|
||||
import memgpt.presets.presets as presets
|
||||
@@ -18,31 +16,21 @@ import memgpt.server.utils as server_utils
|
||||
import memgpt.system as system
|
||||
from memgpt.agent import Agent, save_agent
|
||||
from memgpt.agent_store.storage import StorageConnector, TableType
|
||||
from memgpt.utils import get_human_text, get_persona_text
|
||||
|
||||
# from memgpt.llm_api_tools import openai_get_model_list, azure_openai_get_model_list, smart_urljoin
|
||||
from memgpt.cli.cli_config import get_model_options
|
||||
from memgpt.config import MemGPTConfig
|
||||
from memgpt.constants import JSON_LOADS_STRICT, JSON_ENSURE_ASCII
|
||||
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 (
|
||||
User,
|
||||
Source,
|
||||
AgentState,
|
||||
LLMConfig,
|
||||
EmbeddingConfig,
|
||||
Message,
|
||||
Token,
|
||||
Preset,
|
||||
)
|
||||
|
||||
from memgpt.models.pydantic_models import SourceModel, PassageModel, DocumentModel, PresetModel, ToolModel
|
||||
from memgpt.interface import AgentInterface # abstract
|
||||
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
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1413,8 +1401,6 @@ class SyncServer(LockingServer):
|
||||
|
||||
def create_tool(self, name: str, user_id: uuid.UUID) -> ToolModel: # TODO: add other fields
|
||||
"""Create a new tool"""
|
||||
pass
|
||||
|
||||
def delete_tool(self, tool_id: uuid.UUID, user_id: uuid.UUID):
|
||||
"""Delete a tool"""
|
||||
pass
|
||||
|
||||
@@ -5,10 +5,9 @@ import websockets
|
||||
|
||||
import memgpt.server.ws_api.protocol as protocol
|
||||
from memgpt.constants import JSON_ENSURE_ASCII, JSON_LOADS_STRICT
|
||||
from memgpt.server.constants import WS_DEFAULT_PORT, WS_CLIENT_TIMEOUT
|
||||
from memgpt.server.constants import WS_CLIENT_TIMEOUT, WS_DEFAULT_PORT
|
||||
from memgpt.server.utils import condition_to_stop_receiving, print_server_response
|
||||
|
||||
|
||||
# CLEAN_RESPONSES = False # print the raw server responses (JSON)
|
||||
CLEAN_RESPONSES = True # make the server responses cleaner
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import asyncio
|
||||
import threading
|
||||
|
||||
|
||||
from memgpt.interface import AgentInterface
|
||||
import memgpt.server.ws_api.protocol as protocol
|
||||
from memgpt.interface import AgentInterface
|
||||
|
||||
|
||||
class BaseWebSocketInterface(AgentInterface):
|
||||
|
||||
@@ -2,7 +2,6 @@ import json
|
||||
|
||||
from memgpt.constants import JSON_ENSURE_ASCII
|
||||
|
||||
|
||||
# Server -> client
|
||||
|
||||
|
||||
|
||||
@@ -6,12 +6,10 @@ import traceback
|
||||
|
||||
import websockets
|
||||
|
||||
import memgpt.server.ws_api.protocol as protocol
|
||||
from memgpt.server.constants import WS_DEFAULT_PORT
|
||||
from memgpt.server.server import SyncServer
|
||||
from memgpt.server.ws_api.interface import SyncWebSocketInterface
|
||||
from memgpt.server.constants import WS_DEFAULT_PORT
|
||||
import memgpt.server.ws_api.protocol as protocol
|
||||
import memgpt.system as system
|
||||
import memgpt.constants as memgpt_constants
|
||||
|
||||
|
||||
class WebSocketServer:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Optional
|
||||
|
||||
# from colorama import Fore, Style, init
|
||||
from rich.console import Console
|
||||
from rich.live import Live
|
||||
from rich.markup import escape
|
||||
from rich.style import Style
|
||||
from rich.text import Text
|
||||
|
||||
from memgpt.utils import printd
|
||||
from memgpt.constants import CLI_WARNING_PREFIX, JSON_LOADS_STRICT
|
||||
from memgpt.data_types import Message
|
||||
from memgpt.interface import CLIInterface
|
||||
from memgpt.models.chat_completion_response import ChatCompletionChunkResponse, ChatCompletionResponse
|
||||
from memgpt.interface import AgentInterface, CLIInterface
|
||||
|
||||
# init(autoreset=True)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user