Skip to content

Commit

Permalink
fix: validate after limit assignment in create_block (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
thelonejordan authored Jan 8, 2025
1 parent d1ece2f commit 5a13bba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions letta/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,10 @@ def list_blocks(self, label: Optional[str] = None, templates_only: Optional[bool
def create_block(
self, label: str, value: str, limit: Optional[int] = None, template_name: Optional[str] = None, is_template: bool = False
) -> Block: #
request = CreateBlock(label=label, value=value, template=is_template, template_name=template_name)
request_kwargs = dict(label=label, value=value, template=is_template, template_name=template_name)
if limit:
request.limit = limit
request_kwargs['limit'] = limit
request = CreateBlock(**request_kwargs)
response = requests.post(f"{self.base_url}/{self.api_prefix}/blocks", json=request.model_dump(), headers=self.headers)
if response.status_code != 200:
raise ValueError(f"Failed to create block: {response.text}")
Expand Down

0 comments on commit 5a13bba

Please sign in to comment.