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

feat(model): Update Text-Generation Task Schema to Align with OpenAI Standards #243

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 21 additions & 0 deletions model/model/v1alpha/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,24 @@ message ConversationObject {
// Content of the conversation
string content = 2;
}

// Prompt Image for text generation model
message PromptImage {
// Image could be either a url or base64 encoded string
oneof type {
// Image URL
string prompt_image_url = 1;
// Base64 encoded Image
string prompt_image_base64 = 2;
}
}

// Content used for chat history in text generation model
message Content {
// Type of Content
string type = 1;
// Content of Text Message
string content = 2;
// Content of Image
PromptImage prompt_image = 3;
}
17 changes: 12 additions & 5 deletions model/model/v1alpha/task_text_generation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@ package model.model.v1alpha;

// Google api
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "model/model/v1alpha/common.proto";

// TextGenerationInput represents the input of text generation task
message TextGenerationInput {
// The prompt text
string prompt = 1 [(google.api.field_behavior) = REQUIRED];
// The prompt images
repeated PromptImage prompt_images = 2 [(google.api.field_behavior) = OPTIONAL];
// The chat history
repeated Content chat_history = 3 [(google.api.field_behavior) = OPTIONAL];
// The system message
optional string system_message = 4 [(google.api.field_behavior) = OPTIONAL];
// The maximum number of tokens for model to generate
optional int32 max_new_tokens = 2 [(google.api.field_behavior) = OPTIONAL];
optional int32 max_new_tokens = 5 [(google.api.field_behavior) = OPTIONAL];
// The temperature for sampling
optional float temperature = 3 [(google.api.field_behavior) = OPTIONAL];
optional float temperature = 6 [(google.api.field_behavior) = OPTIONAL];
// Top k for sampling
optional int32 top_k = 4 [(google.api.field_behavior) = OPTIONAL];
optional int32 top_k = 7 [(google.api.field_behavior) = OPTIONAL];
// The seed
optional int32 seed = 5 [(google.api.field_behavior) = OPTIONAL];
optional int32 seed = 8 [(google.api.field_behavior) = OPTIONAL];
// The extra parameters
repeated ExtraParamObject extra_params = 6 [(google.api.field_behavior) = OPTIONAL];
google.protobuf.Struct extra_params = 9 [(google.api.field_behavior) = OPTIONAL];
tonywang10101 marked this conversation as resolved.
Show resolved Hide resolved
}

// TextGenerationOutput represents the output of text generation task
Expand Down
43 changes: 39 additions & 4 deletions openapiv2/openapiv2.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7134,6 +7134,19 @@ definitions:
title: Classification score
readOnly: true
title: ClassificationOutput represents the output of classification task
v1alphaContent:
type: object
properties:
type:
type: string
title: Type of Content
content:
type: string
title: Content of Text Message
prompt_image:
$ref: '#/definitions/v1alphaPromptImage'
title: Content of Image
title: Content used for chat history in text generation model
v1alphaConversationObject:
type: object
properties:
Expand Down Expand Up @@ -7783,6 +7796,16 @@ definitions:
title: A list of OCR objects
readOnly: true
title: OcrOutput represents the output of ocr task
v1alphaPromptImage:
type: object
properties:
prompt_image_url:
type: string
title: Image URL
prompt_image_base64:
type: string
title: Base64 encoded Image
title: Prompt Image for text generation model
v1alphaPublishUserModelResponse:
type: object
properties:
Expand Down Expand Up @@ -8117,6 +8140,21 @@ definitions:
prompt:
type: string
title: The prompt text
prompt_images:
type: array
items:
type: object
$ref: '#/definitions/v1alphaPromptImage'
title: The prompt images
chat_history:
type: array
items:
type: object
$ref: '#/definitions/v1alphaContent'
title: The chat history
system_message:
type: string
title: The system message
max_new_tokens:
type: integer
format: int32
Expand All @@ -8134,10 +8172,7 @@ definitions:
format: int32
title: The seed
extra_params:
type: array
items:
type: object
$ref: '#/definitions/v1alphaExtraParamObject'
type: object
title: The extra parameters
title: TextGenerationInput represents the input of text generation task
required:
Expand Down
Loading