Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix error with block editing in dev-portal #1872

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions letta/schemas/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ def verify_char_limit(self) -> Self:
raise e
return self

@model_validator(mode="after")
def ensure_label(self) -> Self:
if not self.label:
self.label = self.name
return self
# @model_validator
# def ensure_label(self) -> Self:
# if not self.label:
# self.label = self.name
# return self

@model_validator(mode="before")
def set_label_to_name_if_none(cls, values):
"""Sets label to name if label is None"""
if values.get("label") is None and values.get("name") is not None:
values["label"] = values["name"]
return values

def __len__(self):
return len(self.value)
Expand Down
3 changes: 3 additions & 0 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def __init__(
# add global default tools (for admin)
self.add_default_tools(module_name="base")

# create default user / blocks
self.get_default_user()

# collect providers (always has Letta as a default)
self._enabled_providers: List[Provider] = [LettaProvider()]
if model_settings.openai_api_key:
Expand Down
21 changes: 20 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ langchain = {version = "^0.2.16", optional = true}
langchain-community = {version = "^0.2.17", optional = true}
composio-langchain = "^0.5.28"
composio-core = "^0.5.28"
whyhow = "^0.1.7"

[tool.poetry.extras]
#local = ["llama-index-embeddings-huggingface"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def test_sources(client: Union[LocalClient, RESTClient], agent: AgentState):
# list archival memory
archival_memories = client.get_archival_memory(agent_id=agent.id)
# print(archival_memories)
assert len(archival_memories) == created_passages
assert len(archival_memories) == created_passages, f"Mismatch length: {len(archival_memories)} vs. {created_passages}"

# check number of passages
sources = client.list_sources()
Expand Down