Skip to content
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

[FR] Add prompt name to the trace fields #651

Closed
i2amsam opened this issue Jul 18, 2024 · 8 comments
Closed

[FR] Add prompt name to the trace fields #651

i2amsam opened this issue Jul 18, 2024 · 8 comments
Assignees
Labels
feature New feature or request

Comments

@i2amsam
Copy link
Contributor

i2amsam commented Jul 18, 2024

When using prompt files or defined prompts it would be useful to know which prompt was used for a generation

Describe the solution you'd like
[] Add the name of the prompt to the trace data when the prompt is used for a generate call
[] Show the name of the prompt in the developer UI's traces
[] Allow the name of the prompt to be used in filtering in observability tools like Cloud Logging and Firebase AI Monitoring

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
User request:
image

Discussed briefly with @pavelgj and @tonybaroneee

@i2amsam i2amsam added the feature New feature or request label Jul 18, 2024
@chrisraygill chrisraygill moved this to Todo in Genkit Backlog Jul 18, 2024
@chrisraygill chrisraygill removed the status in Genkit Backlog Jul 18, 2024
@chrisraygill chrisraygill removed the P1 label Jul 18, 2024
@i2amsam
Copy link
Contributor Author

i2amsam commented Aug 5, 2024

Adding to this, it would also be great if the prompt step also showed the input and output for the prompt generate call

@maxl0rd
Copy link
Contributor

maxl0rd commented Aug 12, 2024

I believe the appropriate solution to this is to modify the dotprompt plugin so that it calls its defined prompt action when it renders the prompt. This should create a trace span for the prompt rendering step.

This is useful to indicate which prompt was used and also to locate any potential bugs in the rendering of the template.

@tonybaroneee
Copy link
Collaborator

@maxl0rd I could be confusing things, but will the trace span for the prompt rendering step be different than the one that we currently have when the user is typing into the prompt runner and we're firing off a bunch of generate calls to render the hydrated prompt in the Dev UI? (Those actions of which we're currently filtering out in the list of traces)

@ssbushi ssbushi assigned maxl0rd and unassigned ssbushi Aug 12, 2024
@maxl0rd
Copy link
Contributor

maxl0rd commented Aug 12, 2024

It would be the same action. Are we not writing those traces or not retrieving them? That might be a problem.

@tonybaroneee
Copy link
Collaborator

Oh, I think we aren't writing them. Remember #60? :)

@maxl0rd
Copy link
Contributor

maxl0rd commented Aug 12, 2024

Ok right, the filter only affects LocalFileTraceStore. This is more about production observability, so I think it's still the right approach.

@tonybaroneee
Copy link
Collaborator

Ah good call, forgot about the environment distinction there 👍

@maxl0rd
Copy link
Contributor

maxl0rd commented Aug 14, 2024

Addressed in this PR #785

Using the action proved to be problematic for a number of reasons. I think the most straightforward approach is for dotprompt to create its own trace spans when rendering prompts. This might seem slightly superfluous with the changes in next where generate also opens a new span. But I think it's important for observability of prompt changes which are a big deal for many users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Archived in project
Development

No branches or pull requests

5 participants