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

Validate JSON for request schema #261

Merged
merged 9 commits into from
Jul 17, 2023

Conversation

JasonWeill
Copy link
Collaborator

@JasonWeill JasonWeill commented Jul 11, 2023

Fixes #202 (request schema only).

Validates JSON for the SageMaker endpoint's request schema. (The response path is JsonPath, for which I haven't found a good parser/validator yet.) This change affects both the magic commands and the chat UI.

In the following example, a correct schema (blue arrow) is accepted, while an incorrect schema (red arrow) is rejected with an exception.

image

@JasonWeill JasonWeill marked this pull request as ready for review July 11, 2023 23:56
@3coins
Copy link
Collaborator

3coins commented Jul 12, 2023

@JasonWeill
Although this is useful in magics, the original issue was intended for validation in the chat settings panel, where the users don't see an error until after they have submitted a query in the chat UI; they have to then go back to the settings panel to try a different format and retry with another query.

@JasonWeill
Copy link
Collaborator Author

@3coins This change also affects the settings panel, although I didn't include a screen shot of it

@JasonWeill
Copy link
Collaborator Author

Effect on the chat panel settings:

image
image

dlqqq
dlqqq previously requested changes Jul 13, 2023
packages/jupyter-ai-magics/jupyter_ai_magics/magics.py Outdated Show resolved Hide resolved
@JasonWeill JasonWeill dismissed dlqqq’s stale review July 13, 2023 21:59

Changes made per requester

@JasonWeill JasonWeill merged commit 39fe023 into jupyterlab:main Jul 17, 2023
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Corrects capitalization for SageMaker endpoint

* WIP: Pass expected format in model for field

* Validates JSON using JSON.parse

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* WIP: Validate JSON in magics

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix reference to error

* Update packages/jupyter-ai-magics/jupyter_ai_magics/magics.py

Co-authored-by: david qiu <[email protected]>

* Avoids redundant parameter

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: david qiu <[email protected]>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Corrects capitalization for SageMaker endpoint

* WIP: Pass expected format in model for field

* Validates JSON using JSON.parse

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* WIP: Validate JSON in magics

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix reference to error

* Update packages/jupyter-ai-magics/jupyter_ai_magics/magics.py

Co-authored-by: david qiu <[email protected]>

* Avoids redundant parameter

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: david qiu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add validation for request schemas
3 participants