xref: /aosp_15_r20/external/googleapis/google/ai/generativelanguage/v1/content.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.ai.generativelanguage.v1;
18
19import "google/api/field_behavior.proto";
20
21option go_package = "cloud.google.com/go/ai/generativelanguage/apiv1/generativelanguagepb;generativelanguagepb";
22option java_multiple_files = true;
23option java_outer_classname = "ContentProto";
24option java_package = "com.google.ai.generativelanguage.v1";
25
26// The base structured datatype containing multi-part content of a message.
27//
28// A `Content` includes a `role` field designating the producer of the `Content`
29// and a `parts` field containing multi-part data that contains the content of
30// the message turn.
31message Content {
32  // Ordered `Parts` that constitute a single message. Parts may have different
33  // MIME types.
34  repeated Part parts = 1;
35
36  // Optional. The producer of the content. Must be either 'user' or 'model'.
37  //
38  // Useful to set for multi-turn conversations, otherwise can be left blank
39  // or unset.
40  string role = 2 [(google.api.field_behavior) = OPTIONAL];
41}
42
43// A datatype containing media that is part of a multi-part `Content` message.
44//
45// A `Part` consists of data which has an associated datatype. A `Part` can only
46// contain one of the accepted types in `Part.data`.
47//
48// A `Part` must have a fixed IANA MIME type identifying the type and subtype
49// of the media if the `inline_data` field is filled with raw bytes.
50message Part {
51  oneof data {
52    // Inline text.
53    string text = 2;
54
55    // Inline media bytes.
56    Blob inline_data = 3;
57  }
58}
59
60// Raw media bytes.
61//
62// Text should not be sent as raw bytes, use the 'text' field.
63message Blob {
64  // The IANA standard MIME type of the source data.
65  // Accepted types include: "image/png", "image/jpeg", "image/heic",
66  // "image/heif", "image/webp".
67  string mime_type = 1;
68
69  // Raw bytes for media formats.
70  bytes data = 2;
71}
72