Skip to content

Conversation

hendrixmar
Copy link
Contributor

…nstance to registry

Description here... Help the reviewer by:

  • linking to an issue that includes more details
  • if it's a new feature include samples of how to use the new feature
  • (optional if issue link is provided) if you fixed a bug include basic bug details

Checklist (if applicable):

@github-actions github-actions bot added feature New feature or request python Python labels Sep 4, 2025
"""Renders a prompt using dotprompt."""
rendered = await prompt_function(input_)

if 1 < len(rendered.messages):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 1 < len(rendered.messages):
if len(rendered.messages) > 1:

@yesudeep
Copy link
Contributor

yesudeep commented Sep 8, 2025

@hendrixmar can we please address the python checks that are failing?

@@ -408,3 +437,53 @@ def _normalize_prompt_arg(
return prompt
else:
return [prompt]


async def render_system_prompt(registry: Registry, input_: Any, options: PromptConfig) -> Message:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input type can be str | Part | list[Part] | PartsResolver, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the JS implementation I see that it is z.infer and in the Golang it use map[string]any
so not sure which one to use


elif isinstance(options.system, str):

user_prompt = await registry.dotprompt.compile(input_)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to if we could cache the compiled dotprompt template. Otherwise we have to compile it on every invocation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I reviewed that part from the JS implementation, and I was wondering if that object was already defined in the Python implementation. I searched using the same name and I haven't found anything close to that
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request python Python
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants