fix: remove usage of anon_clientid and migrate to DEFAULT_USER (#1805)

This commit is contained in:
Sarah Wooders
2024-09-30 17:56:28 -07:00
committed by GitHub
parent e4cfefe993
commit 9f9e967c8b
4 changed files with 3 additions and 78 deletions

View File

@@ -464,7 +464,6 @@ def run(
# read user id from config
ms = MetadataStore(config)
client = create_client()
client.user_id
# determine agent to use, if not provided
if not yes and not agent:

View File

@@ -18,56 +18,6 @@ from letta.data_sources.connectors import DirectoryConnector
app = typer.Typer()
# NOTE: not supported due to llama-index breaking things (please reach out if you still need it)
# @app.command("index")
# def load_index(
# name: Annotated[str, typer.Option(help="Name of dataset to load.")],
# dir: Annotated[Optional[str], typer.Option(help="Path to directory containing index.")] = None,
# user_id: Annotated[Optional[uuid.UUID], typer.Option(help="User ID to associate with dataset.")] = None,
# ):
# """Load a LlamaIndex saved VectorIndex into Letta"""
# if user_id is None:
# config = LettaConfig.load()
# user_id = uuid.UUID(config.anon_clientid)
#
# try:
# # load index data
# storage_context = StorageContext.from_defaults(persist_dir=dir)
# loaded_index = load_index_from_storage(storage_context)
#
# # hacky code to extract out passages/embeddings (thanks a lot, llama index)
# embed_dict = loaded_index._vector_store._data.embedding_dict
# node_dict = loaded_index._docstore.docs
#
# # create storage connector
# config = LettaConfig.load()
# if user_id is None:
# user_id = uuid.UUID(config.anon_clientid)
#
# passages = []
# for node_id, node in node_dict.items():
# vector = embed_dict[node_id]
# node.embedding = vector
# # assume embedding are the same as config
# passages.append(
# Passage(
# text=node.text,
# embedding=np.array(vector),
# embedding_dim=config.default_embedding_config.embedding_dim,
# embedding_model=config.default_embedding_config.embedding_model,
# )
# )
# assert config.default_embedding_config.embedding_dim == len(
# vector
# ), f"Expected embedding dimension {config.default_embedding_config.embedding_dim}, got {len(vector)}"
#
# if len(passages) == 0:
# raise ValueError(f"No passages found in index {dir}")
#
# insert_passages_into_source(passages, name, user_id, config)
# except ValueError as e:
# typer.secho(f"Failed to load index from provided information.\n{e}", fg=typer.colors.RED)
default_extensions = ".txt,.md,.pdf"