Skip to content

ai_function: render returned t-string prompts and docstrings alike - #63

Merged
alexachille merged 1 commit into
strands-labs:mainfrom
alexachille:tstring-prompts
Oct 9, 2026
Merged

alexachille merged 1 commit into
strands-labs:mainfrom
alexachille:tstring-prompts

Conversation

@alexachille

Copy link
Copy Markdown
Contributor

A prompt function may again return a Template (a t-string on Python 3.14+). Returned templates and docstring templates go through one renderer built on tstr.dedent: dedented, conversions and format specs applied, multi-line values indented to their placeholder's column, nested templates rendered recursively, leading and trailing newlines stripped. Any other return type raises AIFunctionError instead of passing through unrendered.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

A prompt function may again return a Template (a t-string on Python 3.14+).
Returned templates and docstring templates go through one renderer built on
tstr.dedent: dedented, conversions and format specs applied, multi-line
values indented to their placeholder's column, nested templates rendered
recursively, leading and trailing newlines stripped. Any other return type
raises AIFunctionError instead of passing through unrendered.
@alexachille
alexachille merged commit 145efc8 into strands-labs:main Oct 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants