-
Notifications
You must be signed in to change notification settings - Fork 80
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
[editor][server endpoints][2/n]: Add params arg to run command and check for undefined prompt_name #613
Conversation
LGTM - fwiw I don't know that this will be needed for the editor since the params would be saved into the aiconfig when changed in the UI |
prompt_name : str = request_json.get("prompt_name", None) | ||
if prompt_name is None: | ||
return HttpResponseWithAIConfig( | ||
message="No prompt name provided, cannot execute `run` command", | ||
code=400, | ||
aiconfig=None, | ||
).to_flask_format() | ||
params : str = request_json.get("params", None) | ||
stream : bool = request_json.get("stream", True) |
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.
nits:
prompt_name is a str | None
please use the linter and/or vscode for pyright + black formatting.
autofix just these files, one-liner:
fd --glob '*.py' python/src/aiconfig/editor/server | xargs python -m 'scripts.lint' --mode=fix --files
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.
Awesome thanks for the auto-fix command!
Not being used, let's get rid of it dawg! I also ran the linter based on Jonathan's command from this comment: #613 (comment) ``` fd --glob '*.py' python/src/aiconfig/editor/server | xargs python -m 'scripts.lint' --mode=fix --files ``` ^ (btw you can install fd on Mac using `brew install fd`, looks pretty cool). It actually seems pretty cool https://github.com/sharkdp/fd?tab=readme-ov-file
Remove declaration of generic T from server.py Not being used, let's get rid of it dawg! I also ran the linter based on Jonathan's command from this comment: #613 (comment) ``` fd --glob '*.py' python/src/aiconfig/editor/server | xargs python -m 'scripts.lint' --mode=fix --files ``` ^ (btw you can install fd on Mac using `brew install fd`, looks pretty cool). It actually seems pretty cool https://github.com/sharkdp/fd?tab=readme-ov-file
e0c8f59
to
43827ea
Compare
…eck for undefined prompt_name TSIA, pretty simple otherwise we'd be using empty params field and that would error. For the future, I created issue #671 where we shouldn't even need to pass in params into run and this works implicitly ## Test Plan Follow dev README to setup the local editor: https://github.com/lastmile-ai/aiconfig/tree/main/python/src/aiconfig/editor#dev, then run this command ``` curl http://localhost:8080/api/run -d '{"prompt_name":"get_activities"}' -X POST -H 'Content-Type: application/json' ``` Without params https://github.com/lastmile-ai/aiconfig/assets/151060367/7233a4db-9042-4fa9-affb-0f854ae8a50e With params https://github.com/lastmile-ai/aiconfig/assets/151060367/6c078804-ea66-4358-824d-21d0fe26bafa
Not being used, let's get rid of it dawg! I also ran the linter based on Jonathan's command from this comment: lastmile-ai#613 (comment) ``` fd --glob '*.py' python/src/aiconfig/editor/server | xargs python -m 'scripts.lint' --mode=fix --files ``` ^ (btw you can install fd on Mac using `brew install fd`, looks pretty cool). It actually seems pretty cool https://github.com/sharkdp/fd?tab=readme-ov-file
[editor][server endpoints][2/n]: Add params arg to run command and check for undefined prompt_name
TSIA, pretty simple otherwise we'd be using empty params field and that would error. For the future, I created issue #671 where we shouldn't even need to pass in params into run and this works implicitly
Test Plan
Follow dev README to setup the local editor: https://github.com/lastmile-ai/aiconfig/tree/main/python/src/aiconfig/editor#dev, then run this command
Without params
Screen.Recording.2024-01-02.at.12.55.58.mov
With params
Screen.Recording.2024-01-02.at.12.56.59.mov