-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add schema for embed API requests #117
Merged
akolson
merged 15 commits into
learningequality:main
from
bjester:recommendations-request
Jan 17, 2024
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4472c12
Add schema for recommendations API requests
bjester 87b5cd1
flattens schema and updates annotations
akolson 2bc8287
Removes uuid validation from id
akolson f29bcfe
Enable building with generate script, add test
bjester eb0a726
Adds feedback and fixes failing validation test
akolson 30fe07f
Fixes linting noise
akolson aea321e
Fixes more linting noise
akolson d43090d
updates js version of schema
akolson c050428
Renames files for clarity
akolson d08adbe
add __init__.py to validators/
akolson 9ae7732
run regenerate schema file
akolson 0317474
rename test
akolson 0737764
Remove required fields from metadata
akolson 303dafd
Remove required fields from metadata
akolson 54a2e34
Fixes linting errors
akolson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"$id": "/schemas/recommendations_request", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"description": "Schema for recommendations API requests received by RayServe", | ||
"additionalProperties": false, | ||
"definitions": { | ||
"language": { | ||
"type": "string", | ||
"description": "The language code of the topic or channel", | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"pattern": "^[a-z]{3}(?:-[A-Z]{2})?$" | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"topic": { | ||
"type": "object", | ||
"description": "A topic in the tree structure for which to generate recommendations", | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "The ID of the topic content node on Studio" | ||
}, | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"title": { | ||
"type": "string", | ||
"description": "The title of the topic" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "The description of the topic" | ||
}, | ||
"language": { | ||
"$ref": "#/definitions/language" | ||
}, | ||
"ancestors": { | ||
"type": "array", | ||
"description": "The ancestors of the channel", | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"items": { | ||
"$ref": "#/definitions/topic" | ||
} | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}, | ||
"required": ["id", "title", "description", "language"] | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}, | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"properties": { | ||
"target": { | ||
"type": "string", | ||
"description": "The target topic of the channel" | ||
}, | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"ancestors": { | ||
"type": "array", | ||
"description": "The ancestors of the channel's target topic", | ||
"items": { | ||
"$ref": "#/definitions/topic" | ||
} | ||
}, | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"metadata": { | ||
"type": "object", | ||
"description": "The metadata of the channel for which to generate recommendations", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "The ID of the channel" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "The title of the channel" | ||
}, | ||
"language": { | ||
"$ref": "#/definitions/language" | ||
} | ||
akolson marked this conversation as resolved.
Show resolved
Hide resolved
akolson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"required": ["id", "title", "language"] | ||
} | ||
}, | ||
"required": ["target", "metadata"] | ||
} |
Oops, something went wrong.
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.
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.
Just wondering about naming: is this endpoint for recommendations, or embeddings? (I know there was discussion of having endpoints for making actual recommendations, as well -- but then we'd probably want to add a few additional parameters in addition to what's here, e.g. around desired number of recommended items to return, etc. So it may be best to have this named as an embedding endpoint schema?)
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.
If I understand you correctly, I think
"$id": "/schemas/recommendations_request",
here is a URI for the schema to refer to elements of the schema from inside the same document or from external JSON documents. However, your comment on endpoint naming still stands and will be put into consideration for the endpoints we intend to implement.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.
Thus said, this schema is for embedding purposes only. Serve responds with embeddings that we hope to store and make comparisons against later in studio. I will change the URI to
embed_request
for better clarity.