Skip to content

Commit

Permalink
chore: added same pretty print to embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
cpacker committed Oct 11, 2024
1 parent f885efc commit 92f30ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 1 addition & 11 deletions letta/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOL
from letta.log import get_logger
from letta.metadata import MetadataStore
from letta.schemas.embedding_config import EmbeddingConfig
from letta.schemas.enums import OptionState
from letta.schemas.memory import ChatMemory, Memory
from letta.server.server import logger as server_logger
Expand Down Expand Up @@ -249,17 +248,8 @@ def run(
embedding_configs = client.list_embedding_configs()
embedding_options = [embedding_config.embedding_model for embedding_config in embedding_configs]

# TODO move into EmbeddingConfig as a class method?
def prettify_embed_config(embedding_config: EmbeddingConfig) -> str:
return (
f"{embedding_config.embedding_model}" + f" ({embedding_config.embedding_endpoint})"
if embedding_config.embedding_endpoint
else ""
)

embedding_choices = [
questionary.Choice(title=prettify_embed_config(embedding_config), value=embedding_config)
for embedding_config in embedding_configs
questionary.Choice(title=embedding_config.pretty_print(), value=embedding_config) for embedding_config in embedding_configs
]

# select model
Expand Down
7 changes: 7 additions & 0 deletions letta/schemas/embedding_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,10 @@ def default_config(cls, model_name: Optional[str] = None, provider: Optional[str
)
else:
raise ValueError(f"Model {model_name} not supported.")

def pretty_print(self) -> str:
return (
f"{self.embedding_model}"
+ (f" [type={self.embedding_endpoint_type}]" if self.embedding_endpoint_type else "")
+ (f" [ip={self.embedding_endpoint}]" if self.embedding_endpoint else "")
)

0 comments on commit 92f30ae

Please sign in to comment.