feat: return structured suggestion objects with display label and full prompt#119
Open
Ridwannurudeen wants to merge 1 commit intoOpenGradient:mainfrom
Open
feat: return structured suggestion objects with display label and full prompt#119Ridwannurudeen wants to merge 1 commit intoOpenGradient:mainfrom
Ridwannurudeen wants to merge 1 commit intoOpenGradient:mainfrom
Conversation
…l prompt
Suggestions endpoint now returns {"display": "...", "prompt": "..."} objects
instead of plain strings. The "display" field is the short 2-5 word button
label shown in the UI; the "prompt" field is a full, detailed message sent
to the agent when the user clicks the suggestion.
- Add Suggestion type to api/api_types.py (display + prompt fields)
- Update templates/suggestions.jinja2 to generate structured objects with
context-rich prompts alongside short display labels
- Update handle_suggestions_request to parse and return List[Suggestion]
- Gracefully falls back to display=prompt for any legacy plain string items
Closes OpenGradient#40
Author
|
Hi team! Just a friendly ping on this PR. It returns structured |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{"display": "...", "prompt": "..."}objects instead of plain stringsdisplayis the short 2-5 word button label shown in the UIpromptis a full, detailed message sent to the agent when the button is clickeddisplay=promptMotivation
The suggestion buttons currently show a short label (e.g. "Analyze ETH trend") and that same short string is what gets sent to the agent. A richer, more detailed prompt improves the quality of agent responses significantly. For example, clicking "Analyze ETH trend" now sends: "Analyze Ethereum's price trend over the past 30 days, including volume, momentum, and key support and resistance levels."
Changes
api/api_types.pySuggestiondataclass withdisplay: strandprompt: strtemplates/suggestions.jinja2displayandpromptfieldsserver/fastapi_server.pySuggestionfromapi_typeshandle_suggestions_requestreturn type fromList[str]toList[Suggestion]Test plan
/api/v2/agent/suggestionsreturns{"suggestions": [{"display": "...", "prompt": "..."}, ...]}displayfor button label andpromptas the message to send on clickCloses #40