MemGPT/paper_experiments/utils.py
Sarah Wooders d631cec3d6
feat: require LLMConfig and EmbeddingConfig to be specified for agent creation + allow multiple simultaneous provider configs for server (#1814)
Co-authored-by: Shubham Naik <shubham.naik10@gmail.com>
Co-authored-by: Matthew Zhou <mattzh1314@gmail.com>
Co-authored-by: Matt Zhou <mattzhou@Matts-MacBook-Pro.local>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2024-10-04 19:35:00 -07:00

37 lines
982 B
Python

import gzip
import json
from typing import List
from letta.config import LettaConfig
def load_gzipped_file(file_path):
with gzip.open(file_path, "rt", encoding="utf-8") as f:
for line in f:
yield json.loads(line)
def read_jsonl(filename) -> List[dict]:
lines = []
with open(filename, "r") as file:
for line in file:
lines.append(json.loads(line.strip()))
return lines
def get_experiment_config(postgres_uri, endpoint_type="openai", model="gpt-4"):
config = LettaConfig.load()
config.archival_storage_type = "postgres"
config.archival_storage_uri = postgres_uri
config = LettaConfig(
anon_clientid=config.anon_clientid,
archival_storage_type="postgres",
archival_storage_uri=postgres_uri,
recall_storage_type="postgres",
recall_storage_uri=postgres_uri,
metadata_storage_type="postgres",
metadata_storage_uri=postgres_uri,
)
return config