blob: 8ea7cea392145de6256d3fbae6420cd5bd7fb2f9 [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
edition = "2023";
package optimization_guide.proto;
import "components/optimization_guide/proto/on_device_model_execution_config.proto";
import "components/optimization_guide/proto/features/media.proto";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.features.proto";
option java_outer_classname = "PromptApiProto";
// DO NOT EDIT THIS FILE DIRECTLY!
//
// This file is generated in g3 and then synced to Chrome. Instead, please refer to
// http://go/chrome-mqls-onboarding (Google-internal link), and then changes will
// be synced with Chrome automatically.
message PromptApiLoggingData {
PromptApiRequest request = 1 [features = { field_presence: EXPLICIT }];
PromptApiResponse response = 2 [features = { field_presence: EXPLICIT }];
// Metadata is added to force it to be included in the Chrome version.
PromptApiMetadata metadata = 3 [features = { field_presence: EXPLICIT }];
}
// A request from PromptApi for prompt execution call.
message PromptApiRequest {
// The values passed as initialPrompts for the session.
// See https://github.com/explainers-by-googlers/prompt-api#n-shot-prompting
repeated PromptApiPrompt initial_prompts = 1;
// Previously executed prompts, and their responses.
// See
// https://github.com/explainers-by-googlers/prompt-api#session-persistence-and-cloning
// Typically this will be some alternating sequence of 'user' and 'assistant'
// prompts.
repeated PromptApiPrompt prompt_history = 2;
// The new prompts for the current execution request (e.g. what is passed to
// prompt()/promptStreaming()) Typically this will be a single 'user' prompt.
repeated PromptApiPrompt current_prompts = 3;
}
// A single part of a prompt.
// See https://github.com/explainers-by-googlers/prompt-api#n-shot-prompting
message PromptApiPrompt {
// The content for this prompt.
oneof kind {
string text = 2;
Media media = 3;
}
// The role for this prompt.
PromptApiRole role = 1 [features = { field_presence: EXPLICIT }];
}
message PromptApiResponse {
string output = 1 [features = { field_presence: EXPLICIT }];
}
// Type for OnDeviceModelExecutionFeatureConfig::feature_metadata.
message PromptApiMetadata {
// A version for config changes that require implementor updates.
// Version 0->2 Changes from using StringValue -> PromptApiRequest.
uint32 version = 1 [features = { field_presence: EXPLICIT }];
// The maximum value of top k and temperature that this feature can support.
// If the provided value is largest than the max value, they will be clamped.
SamplingParams max_sampling_params = 3 [features = { field_presence: EXPLICIT }];
reserved 2;
}
// A prompt role.
// See https://github.com/explainers-by-googlers/prompt-api#n-shot-prompting
enum PromptApiRole {
PROMPT_API_ROLE_UNSPECIFIED = 0;
PROMPT_API_ROLE_SYSTEM = 1;
PROMPT_API_ROLE_ASSISTANT = 2;
PROMPT_API_ROLE_USER = 3;
}