chore: merge with OSS (#555)

Co-authored-by: Charles Packer <packercharles@gmail.com>
Co-authored-by: dboyliao <qmalliao@gmail.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
Co-authored-by: Shubham Naik <shubham.naik10@gmail.com>
Co-authored-by: Caren Thomas <caren@letta.com>
Co-authored-by: Jyotirmaya Mahanta <jyotirmaya.mahanta@gmail.com>
This commit is contained in:
Sarah Wooders 2025-01-08 15:55:31 -08:00 committed by GitHub
parent 12b15c0b21
commit 6db73894ea

View File

@ -1030,9 +1030,10 @@ class RESTClient(AbstractClient):
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}")