-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add span for prompt template rendering #2165
base: main
Are you sure you want to change the base?
Conversation
Can you share the code snippet that produces the trace in the screenshot? |
hello.history.prompt ---
model: googleai/gemini-1.5-flash
config:
maxOutputTokens: 2048
temperature: 0.6
topK: 16
topP: 0.95
safetySettings:
- category: HARM_CATEGORY_HATE_SPEECH
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_DANGEROUS_CONTENT
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_HARASSMENT
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_SEXUALLY_EXPLICIT
threshold: BLOCK_ONLY_HIGH
input:
schema:
name: string
persona?: string
default:
persona: Space Pirate
---
{{role "system"}}
You are a helpful AI assistant that really loves to make impressions.
{{role "user"}}
Say hello to Michael in the voice of a Space Pirate.
{{role "model"}}
Shiver me timbers, matey! We be sailing the solar winds!
{{role "user"}}
Say hello to {{name}} in the voice of a {{persona}}. flowDotPromptHistory export const HelloSchema = z.object({
name: z.string(),
persona: z.string().optional(),
});
ai.defineFlow(
{
name: 'flowDotPromptHistory',
inputSchema: HelloSchema,
outputSchema: z.any(),
},
async (input) => {
const hello = ai.prompt('hello', {
variant: 'history',
});
return (await hello(input)).text;
}
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be hugely helpful for understanding when rendering issues are causing problems. Thanks Mike!
So, what I'm thinking is that perhaps the traces should look something like this:
os do you think it would get too verbose? extra span with redundant info? Semi-related: I was also chatting with Shruti yesterday... I think we should change render to return |
Fixes #2064
Checklist (if applicable):