git-subtree-dir: apps/core git-subtree-mainline: a8963e11e7a5a0059acbc849ce768e1eee80df61 git-subtree-split: ea2a7395f4023f5b9fab03e6273db3b64a1181d5
36 lines
938 B
Python
36 lines
938 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(
|
|
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
|