From 02cf73b99491222980126626b41b1d31564af9bf Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 21 Mar 2024 14:35:30 -0700 Subject: [PATCH] feat: add function_calling_config to ToolConfig feat: add tool_config to GenerateContentRequest PiperOrigin-RevId: 617966568 --- .../v1beta1/prediction_service.proto | 3 ++ google/cloud/aiplatform/v1beta1/tool.proto | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/google/cloud/aiplatform/v1beta1/prediction_service.proto b/google/cloud/aiplatform/v1beta1/prediction_service.proto index 5eafeabf3bbe8..8e2e1cd1fc5b5 100644 --- a/google/cloud/aiplatform/v1beta1/prediction_service.proto +++ b/google/cloud/aiplatform/v1beta1/prediction_service.proto @@ -669,6 +669,9 @@ message GenerateContentRequest { // knowledge and scope of the model. repeated Tool tools = 6 [(google.api.field_behavior) = OPTIONAL]; + // Tool config. This config is shared for all tools provided in the request. + ToolConfig tool_config = 7 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Per request settings for blocking unsafe content. // Enforced on GenerateContentResponse.candidates. repeated SafetySetting safety_settings = 3 diff --git a/google/cloud/aiplatform/v1beta1/tool.proto b/google/cloud/aiplatform/v1beta1/tool.proto index a88b2f132268d..641d066c2a088 100644 --- a/google/cloud/aiplatform/v1beta1/tool.proto +++ b/google/cloud/aiplatform/v1beta1/tool.proto @@ -145,3 +145,38 @@ message GoogleSearchRetrieval { // generation. bool disable_attribution = 1 [(google.api.field_behavior) = OPTIONAL]; } + +// Tool config. This config is shared for all tools provided in the request. +message ToolConfig { + // Function calling config. + FunctionCallingConfig function_calling_config = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Function calling config. +message FunctionCallingConfig { + // Function calling mode. + enum Mode { + // Unspecified function calling mode. This value should not be used. + MODE_UNSPECIFIED = 0; + // Default model behavior, model decides to predict either a function call + // or a natural language repspose. + AUTO = 1; + // Model is constrained to always predicting a function call only. + // If "allowed_function_names" are set, the predicted function call will be + // limited to any one of "allowed_function_names", else the predicted + // function call will be any one of the provided "function_declarations". + ANY = 2; + // Model will not predict any function call. Model behavior is same as when + // not passing any function declarations. + NONE = 3; + } + // Function calling mode. + Mode mode = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Function names to call. Only set when the Mode is ANY. Function names + // should match [FunctionDeclaration.name]. With mode set to ANY, model will + // predict a function call from the set of function names provided. + repeated string allowed_function_names = 2 + [(google.api.field_behavior) = OPTIONAL]; +}