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

APP-7159: Add markdown_documentation field for inline module docs #602

Merged
merged 9 commits into from
Dec 16, 2024

Conversation

michaellee1019
Copy link
Member

@michaellee1019 michaellee1019 commented Dec 9, 2024

The field addition is straightforward. I'm thinking about reducing the payload of APIs by separating out Model and ModelMarkdown into two different messages that APIs use. For example only GetModule, GetRegistryItem, and UpdateModule have a markdown field. But other APIs don't have it, especially List APIs. Thoughts?

@github-actions github-actions bot added the safe to test committer is a member of this org label Dec 9, 2024
@michaellee1019 michaellee1019 changed the title Add markdown_documentation field for inline module docs APP-7159: Add markdown_documentation field for inline module docs Dec 9, 2024
@michaellee1019
Copy link
Member Author

separating out Model and ModelMarkdown into two different messages that APIs use

Yeah I'm going to do this. Hold off on reviewing for now.

@michaellee1019 michaellee1019 marked this pull request as draft December 9, 2024 22:01
@michaellee1019 michaellee1019 marked this pull request as ready for review December 12, 2024 23:13
@michaellee1019 michaellee1019 added bug Something isn't working and removed bug Something isn't working labels Dec 12, 2024
@michaellee1019
Copy link
Member Author

Ok this is ready for review now. I opted for an optional field on APIs for whether to include markdown or not. Updated the scope doc too. This way we have a public way to retrieve markdown documentation, and by default it is not returned in any APIs to keep response sizes low.

// A list of models that are available in the module
repeated Model models = 1;
// The executable to run to start the module program
string entrypoint = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops thank you!

@@ -1132,6 +1132,7 @@ message RegistryItem {

message GetRegistryItemRequest {
string item_id = 1;
optional bool include_markdown_documentation = 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when do we not want to include markdown documentation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually for fleet we are never going to use this in the current scope. But it will be available if we decide to show markdown on the registry pages at some point. It also makes it available to external API callers if needed.I made it so that by default, markdown is not returned so that API payloads are smaller.

My plan is to return markdown in the internal builtins service (using the same technical approach as Fancy Config Tech Spec

The alternative of the bool is to make separate messages for Request messages and Response messages. I tried that in previous commits in this PR. Its really gross and has backwards compatibility issues.

message Model {
// The colon-delimited-triplet of the api implemented by the model
string api = 1;
// The colon-delimited-triplet of the model
string model = 2;
// The markdown content describing the usage of the model
optional string markdown_documentation = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be annoying to make a further nested object ModelMetadata? i can imagine we might want to include more things here later, and it feels a little jammed in Model

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, what was the decision to have separate documentation for each model rather than the entire module?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to have high level fields for now. There will be an attributes field added in the coming months but still will be 1-to-1 to a model. I think when nesting protos, it makes sense when you need a list, not much rationale otherwise.

documentation for each model rather than the entire module

These are actually two projects that will both be done. Model-level documentation is higher priority because it solves the problem of users configuring machines. Later we will support markdown at the module level so that the module detail page can be more content rich than just the description field we have now which only allows unformatted text.

Inline Model Documentation Epic (this PR): https://viam.atlassian.net/browse/APP-6907
Embed Markdown in registry items Epic (future project): https://viam.atlassian.net/browse/APP-2349

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh i see. i didn't understand which project this was for

oneof metadata {
ModuleUpdateMetadata module_update_metadata = 6;
MLModelUpdateMetadata ml_model_update_metadata = 7;
MLTrainingUpdateMetadata ml_training_update_metadata = 8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these called __UpdateMetadata?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explained in this scope ammendment

I made a mistake in the scope and used the same proto messages for Update and Get APIs. Some fields are not allowed to be updated so I have created different messages to separate get/update

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah makes sense, so these are the editable fields per registry item. [opt, nit] would UpdateModuleMetadata or ModuleMetadataUpdate be clearer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can change to UpdateModuleMetadata. Makes sense

@@ -1280,6 +1308,7 @@ message UploadModuleFileResponse {
message GetModuleRequest {
// The id of the module (formatted as prefix:name where prefix is the module owner's orgid or namespace)
string module_id = 1;
optional bool include_markdown_documentation = 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[just curious] do we have any plans to eventually deprecate GetModule?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No official plan but I do want to migrate the CLI to use the registry item APIs. Depends on effort. I was going to do it in the fancy config project. I'm going to pickup the CLI changes for this project next week and consider doing it then.

One of the blocking things was to add the ModuleUpdateMetadata message which is one reason why I included in this PR so that I have the option to do it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as the CLI is off, the UI would need to migrate. And then probably give it another ~2-3mo for people to naturally upgrade to new versions of the CLI.

Copy link
Member

@ehhong ehhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for all the clarifications! looks good

@@ -1341,6 +1370,7 @@ message Uploads {
message ListModulesRequest {
// The id of the organization to return private modules for.
optional string organization_id = 1;
optional bool include_markdown_documentation = 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think ListModules would ever want to return markdown, but does this have to do with this concern?

The alternative of the bool is to make separate messages for Request messages and Response messages. I tried that in previous commits in this PR. Its really gross and has backwards compatibility issues.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this runs into the same issue that I was trying to fix by making a separate Model message. In order to not have a markdown_documentation field the response would have to be changed to a different message and cause backwards incompatibility. I could just remove this bool and always return a nil markdown. But I like the consistency of having the bool on all APIs.

@michaellee1019 michaellee1019 added the ready-for-protos add this when you want protos to compile on every commit label Dec 16, 2024
@michaellee1019 michaellee1019 added bug Something isn't working and removed ready-for-protos add this when you want protos to compile on every commit labels Dec 16, 2024
@michaellee1019 michaellee1019 merged commit b53c73b into viamrobotics:main Dec 16, 2024
6 checks passed
@michaellee1019 michaellee1019 deleted the ml/inline-docs-api branch December 16, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working safe to test committer is a member of this org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants