# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Configuration for the protoveneer tool.

package: genai

protoImportPath: cloud.google.com/go/ai/generativelanguage/apiv1beta/generativelanguagepb

types:
    HarmCategory:
      protoPrefix: HarmCategory_HARM_CATEGORY_
      docVerb: specifies

    SafetySetting_HarmBlockThreshold:
      name: HarmBlockThreshold
      protoPrefix: SafetySetting_BLOCK_
      veneerPrefix: HarmBlock
      docVerb: specifies
      valueNames:
        SafetySetting_HARM_BLOCK_THRESHOLD_UNSPECIFIED: HarmBlockUnspecified

    SafetyRating_HarmProbability:
      name: HarmProbability
      protoPrefix: SafetyRating_
      docVerb: specifies
      valueNames:
        SafetyRating_HARM_PROBABILITY_UNSPECIFIED: HarmProbabilityUnspecified

    Candidate_FinishReason:
      name: FinishReason
      protoPrefix: Candidate_

    GenerateContentResponse:
      doc: 'is the response from a GenerateContent or GenerateContentStream call.'

    GenerateContentResponse_PromptFeedback_BlockReason:
      name: BlockReason
      protoPrefix: GenerateContentResponse_PromptFeedback_

    Content:
      fields:
        Parts:
          type: '[]Part'

    Blob:
      fields:
        MimeType:
          name: MIMEType
      docVerb: contains

    FileData:
      fields:
        MimeType:
          name: MIMEType
          doc: |
            The IANA standard MIME type of the source data.
            If present, this overrides the MIME type specified or inferred
            when the file was uploaded.
            The supported MIME types are documented on [this page].
            
            [this page]: https://ai.google.dev/gemini-api/docs/prompting_with_media?lang=go#supported_file_formats
        FileUri:
          name: URI
          doc: 'The URI returned from UploadFile or GetFile.'

    GenerationConfig:
      fields:
        ResponseMimeType:
          name: ResponseMIMEType

    SafetySetting:

    SafetyRating:
      docVerb: 'is the'

    CitationMetadata:

    CitationSource:
      docVerb: contains
      fields:
        Uri:
          name: URI
        License:
          type: string

    Candidate:
      fields:
        Index:
          type: int32
        GroundingAttributions:
          omit: true

    GenerateContentResponse_PromptFeedback:
      name: PromptFeedback
      docVerb: contains

    CountTokensResponse:

    TaskType:
      protoPrefix: TaskType
      valueNames:
        TaskType_TASK_TYPE_UNSPECIFIED: TaskTypeUnspecified

    EmbedContentResponse:
    BatchEmbedContentsResponse:

    ContentEmbedding:

    Model:
      name: ModelInfo
      doc: 'is information about a language model.'
      fields:
        BaseModelId:
          name: BaseModelID
        Temperature:
          type: float32
        TopP:
          type: float32
        TopK:
          type: int32

    # Types for function calling
    Tool:
      fields:
        FunctionDeclarations:
          doc: |
            Optional. A list of FunctionDeclarations available to the model that
            can be used for function calling. The model or system does not execute
            the function. Instead the defined function may be returned as a [FunctionCall]
            part with arguments to the client side for execution. The next conversation
            turn may contain a [FunctionResponse] with the role "function" generation
            context for the next model turn.
    ToolConfig:
    FunctionDeclaration:
    FunctionCall:
    FunctionResponse:
    Schema:

    Type:
      protoPrefix: Type_
      veneerPrefix: ''

    FunctionCallingConfig:
      doc: 'holds configuration for function calling.'

    FunctionCallingConfig_Mode:
      name: FunctionCallingMode
      protoPrefix: FunctionCallingConfig
      veneerPrefix: FunctionCalling
      valueNames:
        FunctionCallingConfig_MODE_UNSPECIFIED: FunctionCallingUnspecified

    File:
      populateToFrom: populateFileTo, populateFileFrom
      fields:
        Uri:
          name: URI
        MimeType:
          name: MIMEType
        Metadata:
          type: '*FileMetadata'
          noConvert: true
          doc: 'Metadata for the File.'

    VideoMetadata:
      fields:
        VideoDuration:
          name: Duration

    File_State:
      name: FileState
      docVerb: represents
      protoPrefix: File
      veneerPrefix: FileState
      valueNames:
        File_STATE_UNSPECIFIED: FileStateUnspecified
      
    GenerateContentResponse_UsageMetadata:
      name: UsageMetadata
      fields:
        PromptTokenCount:
          type: int32
        CandidatesTokenCount:
          type: int32
        TotalTokenCount:
          type: int32

    CachedContent:
      populateToFrom: populateCachedContentTo, populateCachedContentFrom
      fields:
        Expiration:
          type: ExpireTimeOrTTL
          noConvert: true
        Name:
          type: string
        Model:
          type: string
        DisplayName:
          type: string

    CachedContent_UsageMetadata:
      name: CachedContentUsageMetadata

    CodeExecution:
    ExecutableCode:
    CodeExecutionResult:

    ExecutableCode_Language:
      name: ExecutableCodeLanguage
      protoPrefix: ExecutableCode
      veneerPrefix: ExecutableCode

    CodeExecutionResult_Outcome:
      name: CodeExecutionResultOutcome
      protoPrefix: CodeExecutionResult
      veneerPrefix: CodeExecutionResult
      valueNames:
        CodeExecutionResult_OUTCOME_OK: CodeExecutionResultOutcomeOK

# Omit everything not explicitly configured.
omitTypes:
  - '*'

converters:
  Part: partToProto, partFromProto
