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

remove customized category #59

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 3 additions & 101 deletions specification/cognitiveservices/ContentSafety/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ model AnalyzeTextOptions {
@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The incidents to detect.")
incidents?: IncidentOptions;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The customized categories will be analyzed. If they are not assigned, the analysis results for all available customized categories will be returned.")
customizedCategories?: CustomizedCategory[];
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Customized category for inference.")
model CustomizedCategory {
@doc("Category name")
categoryName: string;

@doc("Model ID for the category. If not provided, the latest available model will be used.")
modelId: string;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
Expand Down Expand Up @@ -143,29 +129,6 @@ model AnalyzeTextResult {
@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.")
citation?: string[];

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Analysis result for customized categories.")
customizedCategoriesAnalysis: TextCustomizedCategoryAnalysis[];
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Text customized category analysis result.")
model TextCustomizedCategoryAnalysis {
@doc("Customized category name")
categoryName: string;

@doc("customized category analysis")
customizedCategoriesAnalysis: TextCustomizedCategoryClassResult[];
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("customized category analysis result")
model TextCustomizedCategoryClassResult {
id: int32;

@renamedFrom(Versions.v2023_10_30_Preview, "name")
className: string;
}

@doc("The result of blocklist match.")
Expand Down Expand Up @@ -611,13 +574,9 @@ model PreDefinedConcept {

@added(Versions.v2023_10_30_Preview)
@doc("Label definition.")
@renamedFrom(Versions.v2023_10_30_Preview, "SubCategory")
model Class {
model SubCategory {
id: int32;

@renamedFrom(Versions.v2023_10_30_Preview, "name")
className: string;

name: string;
statements: string[];
}

Expand All @@ -632,55 +591,12 @@ model TextCustomizedCategory {
@maxLength(64)
categoryName: string;

@doc("A predefined concept with its definition can be used directly in the subcategories.")
@added(Versions.v2023_10_30_Preview)
@removed(Versions.v2023_10_30_Preview)
preDefinedConcepts?: PreDefinedConcept[];

@doc("Subcategories are detailed classes of the category. It is required there is a class 'safe' with id=0.")
@renamedFrom(Versions.v2023_10_30_Preview, "subCategories")
classes: Class[];

@added(Versions.v2023_10_30_Preview)
@removed(Versions.v2023_10_30_Preview)
subCategories: SubCategory[];
emphases?: string[];

@doc("Blob that stores the examples.")
exampleBlobUrl?: url;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The response for async training triggering.")
model SubmitModelTrainingResponse {
...AcceptedResponse;

@header("operation-location")
@doc("The location of the status API for monitoring the triggered model.")
modelUrl: string;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
model AsyncJobWarning {
code: string;
messgae: string;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@resource("text/generatePromptTasks")
model GeneratePromptTaskDetail {
@doc("The id of image batch analysis task.")
@key("taskId")
@visibility("read")
@maxLength(64)
taskId: string;

@doc("The status of the batch image analysis task.")
status: GeneratePromptStatus;

@doc("Return error detail when the task failed.")
error?: Azure.Core.Foundations.Error;
}

#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("ImageWithText analyze category.")
Expand All @@ -691,20 +607,6 @@ enum ImageWithTextCategory {
Violence,
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@parentResource(TextCustomizedCategory)
@resource("models")
model TextTrainedModel {
@key
modelId: string;

status: ModelStatus;
createdTime: utcDateTime;
lastUpdateTime: utcDateTime;
warnings?: AsyncJobWarning[];
errors?: string[];
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The analysis request of the image with text.")
model AnalyzeImageWithTextOptions {
Expand Down
48 changes: 0 additions & 48 deletions specification/cognitiveservices/ContentSafety/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -338,54 +338,6 @@ interface TextCategoryCustomization {
TextCustomizedCategory,
ListQueryParametersTrait<StandardListQueryParameters>
>;

@added(Versions.v2023_10_30_Preview)
@action("trainModel")
trainModel is CategoryOps.ResourceAction<
TextCustomizedCategory,
{},
SubmitModelTrainingResponse
>;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@route("/text/categories/{categoryName}:generatePrompt")
@post
@summary("Trigger prompt generation")
@doc("An asynchronous API to generate prompt from customized category.")
generateCustomizedCategoryPrompt is ContentSafetyLongRunningRpcOperation<
{
@path
@doc("The customized category name.")
categoryName: string;
},
GeneratePromptTaskDetail
>;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@summary("Get Generate Prompt Task Status")
@doc("Check the status of a generate prompt task.")
getGeneratePromptTaskStatus is Azure.Core.ResourceRead<GeneratePromptTaskDetail>;
}

interface TextCustomizedMdoelOps
extends Azure.Core.ResourceOperations<NoRepeatableRequests &
NoConditionalRequests &
NoClientRequestId> {}

@added(Versions.v2023_10_30_Preview)
interface TextCustomizedModelOperations {
@summary("List all existing models")
@doc("List existing models.")
listTextCustomizedModels is TextCustomizedMdoelOps.ResourceList<
TextTrainedModel,
ListQueryParametersTrait<StandardListQueryParameters>
>;

@doc("Get a model that is not deleted.")
getTextCustomizedModels is TextCustomizedMdoelOps.ResourceRead<TextTrainedModel>;

@doc("If the model is training, the training process will be cancelled and the model will also be deleted.")
deleteCustomizedModel is TextCustomizedMdoelOps.ResourceDelete<TextTrainedModel>;
}

@added(Versions.v2023_10_30_Preview)
Expand Down
Loading