From 8f1bae544eca4cc003e25546883c533873b3ab85 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Tue, 27 May 2025 19:36:52 -0500 Subject: [PATCH] ok --- CONCISE_COMMIT_MSG.tmp | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 CONCISE_COMMIT_MSG.tmp diff --git a/CONCISE_COMMIT_MSG.tmp b/CONCISE_COMMIT_MSG.tmp deleted file mode 100644 index a4854c123..000000000 --- a/CONCISE_COMMIT_MSG.tmp +++ /dev/null @@ -1,14 +0,0 @@ -Fix: Prompt arg handling & docs for #541 - -Addresses #541: -- Server now auto-deserializes JSON string args (list, dict, BaseModel) for prompts. This simplifies server-side prompt logic by reducing boilerplate `json.loads()` calls. -- Docs updated to clarify `list_resource_templates` usage for templatized resources. -- Docs updated to require client-side `json.dumps()` for complex `get_prompt` arguments, resolving the original Pydantic error. -- Adds a new example (`examples/dynamic_story_prompt/`) demonstrating the server-side deserialization benefit and correct client-side serialization. - -Closes #541. - ---- -Notes for Reviewers: -- **Server-Side Auto-Deserialization:** This change introduces a "magic" `json.loads()` in `Prompt.render`. This is an intentional DX improvement. It only triggers for `str` inputs targeting `list`, `dict`, or `BaseModel` type hints. If `json.loads()` fails (e.g., malformed JSON), the original string is passed to Pydantic's `validate_call`, ensuring robust error handling. This avoids boilerplate in user prompt functions. -- **Client `get_prompt()` Return Value:** The `examples/dynamic_story_prompt/story_client.py` parses the result of `client.get_prompt()` by iterating and looking for a `('messages', ...)` tuple. This reflects the observed behavior of the current `client.get_prompt()`. This commit does *not* change `client.get_prompt()`'s return behavior; the example merely adapts to it. A separate discussion might be warranted for potentially simplifying `client.get_prompt()`'s return signature in the future. \ No newline at end of file