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

feat(prompts!): prompt template management #5724

Draft
wants to merge 62 commits into
base: main
Choose a base branch
from
Draft

feat(prompts!): prompt template management #5724

wants to merge 62 commits into from

Conversation

mikeldking
Copy link
Contributor

resolves #5582

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 12, 2024
@mikeldking mikeldking marked this pull request as draft December 12, 2024 22:10
@mikeldking mikeldking added the feature branch a feature branch that consolidates multiple features into a single commit on main label Dec 12, 2024
Copy link
Contributor

@RogerHYang RogerHYang left a comment

Choose a reason for hiding this comment

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

blocking feature branch

mikeldking and others added 20 commits January 9, 2025 12:55
* wip

* WIP

* WIP

* add the prompt type

* add initial listing

* feat: temporary prompt

* final changes

* add aria role
…rompt specific playground (#5748)

* feat(prompts): Add prompt selection combobox to playground instances

* Implement prompt/:id/playground route and add link from prompt page

* Rename prompt combobox components for clarity
* feat(prompts): Implement SavePromptForm for creating new prompts

* Rename button to 'save'
* Add prompt table migrations

* Fix typo

* Update migration test

* Address migration feedback

* Use default names for constraints

* Add source prompt id
* cleanup

* feat(prompts): rudimentary prompt details page #5741

* Update app/src/pages/prompt/PromptTabContent.tsx

Co-authored-by: Anthony Powell <[email protected]>

---------

Co-authored-by: Anthony Powell <[email protected]>
* Add PromptVersion query

* Update src/phoenix/server/api/types/PromptVersion.py

* reorganize

* cleanup

* Update the schema

---------

Co-authored-by: Mikyo King <[email protected]>
* refactor(prompts): URL based routing and loader sharing for prompts

- /prompts/:prompId has been converted to a layout component
- sub-routes of promptId share loader data with promptLoader
- prompt detail page tabs perform navigations

* feat(prompts): Add query fragment to prompt versions sub-route

* feat(prompts): Implement routing, loaders, and fragments for prompt version list

* Add PromptVersion to node query

* fix imports

* Ensure all unset fields are set

* fix comma

* Distinguish prompt version details from one another

* Move truncate component

* Consolidate prompt tab nav logic

---------

Co-authored-by: Dustin Ngo <[email protected]>
…5780)

* feat(prompts): Render model invocation params in propt details view

* Use fragment in PromptInvocationParameters

* temporarily use component styles for lists until we can migrate

* fix scrolling

---------

Co-authored-by: Mikyo King <[email protected]>
* feat(prompts): Render prompt messages on prompt detail view

* Remove unused import

* Implement copy and paste button on prompt chat messages

* Render chat messages on prompt version details page

* Redirect to latest version when clicking versions tab

Additionally highlight active version in versions list

* Update example data to match template language

* Fix prompt details page width, prompt versions borders / scroll

* Distinguish readOnly TemplateEditor styling from normal TemplateEditor

* Refactor active prompt id into prop

* Replace custom button with styled anchor

* Rename node in promptVersion query
* Flesh out PromptVersionTemplate type

* Return GraphQL objects with the correct type

* Use new types in node query

* Decouple pydantic models and gql types

* Rebuild gql schema

* Rework model names

* Update gql schema

* Propagate name into schema

* Incorporate feedback

* Update schema

* adjust UI to new schema

* cleanup

* Remove `hub` naming and clean up type annotations

---------

Co-authored-by: Mikyo King <[email protected]>
* chore: fix lint errors

* cleanup

* cleanup
* feat(prompts): preview of last 5 versions

* feat(prompts): preview of last 5 versions

* rename
* feat(prompts): graphql types for tools, output_schema

* fix types
* feat(prompts): Implement prompts as code examples beneath prompt

- python prompts as code
- typescript prompts as code

* Implement typescript language formatter for prompts

* Align emitted code with openai documentation sample code

* Minor UX tweaks wrt code blocks and version details page

* Reduce tab size, update prompt mock data

* Make code card collapsible

* Make prompt code snippets conform to new schemas

* Tweak comment

* Refactor templates into lodash templates
mikeldking and others added 24 commits January 9, 2025 13:00
* feat(prompts): Load prompt into playground via url

* Parse prompt version data into playground instance format

* Move prompt to instance conversion deeper into component tree

This allows us to pre-fill the default instance with a prompt from the URL,
while also allowing for the loaded prompt to be dynamically switched (fetched) per-instance

* Perform prompt fetch imperatively instead of declaratively

* Simplify prompt change callback

* Rename loader
* feat(prompts): show version timestamp

* ruff
* feat(prompts): show the tags that can be set on a promt version

* commit the relay build
…5914)

* feat(prompts): Create prompt versions from playground

- Create new prompt + prompt version

* Add new prompt versions on update

* Add aria-label props to TagGroup

without these we spam the console with many warnings

* Revalidate prompt versions after mutations

* Prevent stale prompt combobox list

* Add dialog postfix to upsertPrompt component

* Move template format out of prompt to instance conversion

* Hide combobox description when error is visible

* Clarify selected prompt id props
* Add create and patch Version Tag mutations

* Unify prompt version tag mutations

* Update gql schema

* Update tags field

* Remove docstring

* Update tags field on prompt

* Use insert on conflict helper
* refactor(prompts): Pull prompt page cards into new components

* feat(prompts): Display tool definitions on prompt page

* feat(prompts): Display tool definitions on prompt page as DisclosureGroup

* Rename PromptChatMessages to PromptChatMessagesCard

* Refactor DisclosureHeading into more semantic SectionHeading component
* Implement delete mutations for Prompt and PromptVersionTag

* Update graphql schema
* UI for setting tags

* cleanup
* feat(prompts): update prompt version tags on set

* remove unnecessary
…nd (#5942)

* feat(prompts): Save and load invocation parameters from/into playground

Also includes output schema

* Include response_format and fix invocation param formatting in code snippets

* Fix prompt combobox change handler

* Add OutputSchema display to prompt details

Also add border control props to Disclosure and SectionHeader.
We do some weird sibling-ry and nesting that makes borders hard to auto-apply with css alone

* Remove confusing prop in favor off css

* Consolidate prompt/instance conversion logic and parse tool_choice
* Add `previous_version` resolver on PromptVersion

* Update gql schema

* Ruff 🐶

* Use id for ordering
* feat: prompt version tags config

* cleanup: prettier

* WIP

* WIP

* fix tabs

* cleanup

* Update app/src/pages/prompt/PromptLayout.tsx

Co-authored-by: Anthony Powell <[email protected]>

* cleanup

* right align

---------

Co-authored-by: Anthony Powell <[email protected]>
* feat(prompts): Derive dirty state from playground instance

* Refactor dirty checking into hook

* Clear prompt on compare

* Manually track dirty state via store actions

* Keep prompt selected when cloning instance

* Fix types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature branch a feature branch that consolidates multiple features into a single commit on main size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: 🔍. Needs Review
Development

Successfully merging this pull request may close these issues.

🗺 Prompt Management
5 participants