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

Add schema for embed API requests #117

Merged
merged 15 commits into from
Jan 17, 2024
77 changes: 77 additions & 0 deletions spec/recommendations-v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$id": "/schemas/recommendations_request",
Copy link
Member

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?)

Copy link
Member

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.

Copy link
Member

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.

"$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"]
}
Loading