import {z} from 'zod' export type GoogleCloudAiplatformV1AudioTranscriptionWordInfo = {endOffset?: unknown | undefined, startOffset?: unknown | undefined, word?: string | undefined}; export type GoogleCloudAiplatformV1AudioTranscription = {speakerLabel?: string | undefined, text?: string | undefined, words?: Array | undefined}; export type GoogleCloudAiplatformV1CodeExecutionResult = {id?: string | undefined, outcome?: ('OUTCOME_UNSPECIFIED' | 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED') | undefined, output?: string | undefined}; export type GoogleCloudAiplatformV1ExecutableCode = {code?: string | undefined, id?: string | undefined, language?: ('LANGUAGE_UNSPECIFIED' | 'PYTHON') | undefined}; export type GoogleCloudAiplatformV1FileData = {displayName?: string | undefined, fileUri?: string | undefined, mimeType?: string | undefined}; export type GoogleCloudAiplatformV1PartialArg = {boolValue?: boolean | undefined, jsonPath?: string | undefined, nullValue?: 'NULL_VALUE' | undefined, numberValue?: number | undefined, stringValue?: string | undefined, willContinue?: boolean | undefined}; export type GoogleCloudAiplatformV1FunctionCall = {args?: {[key: string]: unknown} | undefined, id?: string | undefined, name?: string | undefined, partialArgs?: Array | undefined, willContinue?: boolean | undefined}; export type GoogleCloudAiplatformV1FunctionResponseFileData = {displayName?: string | undefined, fileUri?: string | undefined, mimeType?: string | undefined}; export type GoogleCloudAiplatformV1FunctionResponseBlob = {data?: string | undefined, displayName?: string | undefined, mimeType?: string | undefined}; export type GoogleCloudAiplatformV1FunctionResponsePart = {fileData?: GoogleCloudAiplatformV1FunctionResponseFileData | undefined, inlineData?: GoogleCloudAiplatformV1FunctionResponseBlob | undefined}; export type GoogleCloudAiplatformV1FunctionResponse = {id?: string | undefined, name?: string | undefined, parts?: Array | undefined, response?: {[key: string]: unknown} | undefined, scheduling?: ('SCHEDULING_UNSPECIFIED' | 'SILENT' | 'WHEN_IDLE' | 'INTERRUPT') | undefined}; export type GoogleCloudAiplatformV1Blob = {data?: string | undefined, displayName?: string | undefined, mimeType?: string | undefined}; export type GoogleCloudAiplatformV1PartMediaResolution = {level?: ('MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' | 'MEDIA_RESOLUTION_ULTRA_HIGH') | undefined}; export type GoogleCloudAiplatformV1SpeechMetadata = {speaker?: string | undefined, style?: string | undefined}; export type GoogleCloudAiplatformV1VideoMetadata = {endOffset?: unknown | undefined, fps?: number | undefined, startOffset?: unknown | undefined}; export type GoogleCloudAiplatformV1Part = {audioTranscription?: GoogleCloudAiplatformV1AudioTranscription | undefined, codeExecutionResult?: GoogleCloudAiplatformV1CodeExecutionResult | undefined, executableCode?: GoogleCloudAiplatformV1ExecutableCode | undefined, fileData?: GoogleCloudAiplatformV1FileData | undefined, functionCall?: GoogleCloudAiplatformV1FunctionCall | undefined, functionResponse?: GoogleCloudAiplatformV1FunctionResponse | undefined, inlineData?: GoogleCloudAiplatformV1Blob | undefined, mediaResolution?: GoogleCloudAiplatformV1PartMediaResolution | undefined, speechMetadata?: GoogleCloudAiplatformV1SpeechMetadata | undefined, text?: string | undefined, thought?: boolean | undefined, thoughtSignature?: string | undefined, videoMetadata?: GoogleCloudAiplatformV1VideoMetadata | undefined}; export type GoogleCloudAiplatformV1Content = {parts?: Array | undefined, role?: string | undefined}; export type GoogleCloudAiplatformV1AudioTranscriptionConfigLanguageAuto = Record; export type GoogleCloudAiplatformV1AudioTranscriptionConfigLanguageHints = {languageCodes?: Array | undefined}; export type GoogleCloudAiplatformV1AudioTranscriptionConfig = {adaptationPhrases?: Array | undefined, customVocabulary?: Array | undefined, diarization?: boolean | undefined, languageAuto?: GoogleCloudAiplatformV1AudioTranscriptionConfigLanguageAuto | undefined, languageCodes?: Array | undefined, languageHints?: GoogleCloudAiplatformV1AudioTranscriptionConfigLanguageHints | undefined, mode?: ('MODE_UNSPECIFIED' | 'VERBATIM' | 'SMART') | undefined, sourceText?: string | undefined, wordTimestamp?: boolean | undefined}; export type GoogleCloudAiplatformV1ImageConfigImageOutputOptions = {compressionQuality?: number | undefined, mimeType?: string | undefined}; export type GoogleCloudAiplatformV1ImageConfig = {aspectRatio?: string | undefined, imageOutputOptions?: GoogleCloudAiplatformV1ImageConfigImageOutputOptions | undefined, imageSize?: string | undefined, personGeneration?: ('PERSON_GENERATION_UNSPECIFIED' | 'ALLOW_ALL' | 'ALLOW_ADULT' | 'ALLOW_NONE') | undefined, prominentPeople?: ('PROMINENT_PEOPLE_UNSPECIFIED' | 'ALLOW_PROMINENT_PEOPLE' | 'BLOCK_PROMINENT_PEOPLE') | undefined}; export type GoogleCloudAiplatformV1AudioResponseFormat = {bitRate?: number | undefined, delivery?: ('DELIVERY_UNSPECIFIED' | 'INLINE' | 'URI') | undefined, mimeType?: ('MIME_TYPE_UNSPECIFIED' | 'AUDIO_MP3' | 'AUDIO_OGG_OPUS' | 'AUDIO_L16' | 'AUDIO_WAV' | 'AUDIO_ALAW' | 'AUDIO_MULAW') | undefined, sampleRate?: number | undefined}; export type GoogleCloudAiplatformV1ImageResponseFormat = {aspectRatio?: ('ASPECT_RATIO_UNSPECIFIED' | 'ASPECT_RATIO_ONE_BY_ONE' | 'ASPECT_RATIO_TWO_BY_THREE' | 'ASPECT_RATIO_THREE_BY_TWO' | 'ASPECT_RATIO_THREE_BY_FOUR' | 'ASPECT_RATIO_FOUR_BY_THREE' | 'ASPECT_RATIO_FOUR_BY_FIVE' | 'ASPECT_RATIO_FIVE_BY_FOUR' | 'ASPECT_RATIO_NINE_BY_SIXTEEN' | 'ASPECT_RATIO_SIXTEEN_BY_NINE' | 'ASPECT_RATIO_TWENTY_ONE_BY_NINE' | 'ASPECT_RATIO_ONE_BY_EIGHT' | 'ASPECT_RATIO_EIGHT_BY_ONE' | 'ASPECT_RATIO_ONE_BY_FOUR' | 'ASPECT_RATIO_FOUR_BY_ONE') | undefined, delivery?: ('DELIVERY_UNSPECIFIED' | 'INLINE' | 'URI') | undefined, imageSize?: ('IMAGE_SIZE_UNSPECIFIED' | 'IMAGE_SIZE_FIVE_TWELVE' | 'IMAGE_SIZE_ONE_K' | 'IMAGE_SIZE_TWO_K' | 'IMAGE_SIZE_FOUR_K') | undefined, mimeType?: ('MIME_TYPE_UNSPECIFIED' | 'IMAGE_JPEG') | undefined}; export type GoogleCloudAiplatformV1TextResponseFormat = {mimeType?: ('MIME_TYPE_UNSPECIFIED' | 'APPLICATION_JSON' | 'TEXT_PLAIN') | undefined, schema: unknown}; export type GoogleCloudAiplatformV1VideoResponseFormat = {aspectRatio?: ('ASPECT_RATIO_UNSPECIFIED' | 'ASPECT_RATIO_SIXTEEN_BY_NINE' | 'ASPECT_RATIO_NINE_BY_SIXTEEN') | undefined, delivery?: ('DELIVERY_UNSPECIFIED' | 'INLINE' | 'URI') | undefined, duration?: unknown | undefined, gcsUri?: string | undefined, resolution?: string | undefined}; export type GoogleCloudAiplatformV1ResponseFormat = {audio?: GoogleCloudAiplatformV1AudioResponseFormat | undefined, image?: GoogleCloudAiplatformV1ImageResponseFormat | undefined, text?: GoogleCloudAiplatformV1TextResponseFormat | undefined, video?: GoogleCloudAiplatformV1VideoResponseFormat | undefined}; export type GoogleCloudAiplatformV1Schema = {additionalProperties: unknown, anyOf?: Array | undefined, default: unknown, defs?: {[key: string]: GoogleCloudAiplatformV1Schema} | undefined, description?: string | undefined, enum?: Array | undefined, example: unknown, format?: string | undefined, items?: GoogleCloudAiplatformV1Schema | undefined, maxItems?: unknown | undefined, maxLength?: unknown | undefined, maxProperties?: unknown | undefined, maximum?: number | undefined, minItems?: unknown | undefined, minLength?: unknown | undefined, minProperties?: unknown | undefined, minimum?: number | undefined, nullable?: boolean | undefined, pattern?: string | undefined, properties?: {[key: string]: GoogleCloudAiplatformV1Schema} | undefined, propertyOrdering?: Array | undefined, ref?: string | undefined, required?: Array | undefined, title?: string | undefined, type?: ('TYPE_UNSPECIFIED' | 'STRING' | 'NUMBER' | 'INTEGER' | 'BOOLEAN' | 'ARRAY' | 'OBJECT' | 'NULL') | undefined}; export type GoogleCloudAiplatformV1GenerationConfigRoutingConfigAutoRoutingMode = {modelRoutingPreference?: ('UNKNOWN' | 'PRIORITIZE_QUALITY' | 'BALANCED' | 'PRIORITIZE_COST') | undefined}; export type GoogleCloudAiplatformV1GenerationConfigRoutingConfigManualRoutingMode = {modelName?: string | undefined}; export type GoogleCloudAiplatformV1GenerationConfigRoutingConfig = {autoMode?: GoogleCloudAiplatformV1GenerationConfigRoutingConfigAutoRoutingMode | undefined, manualMode?: GoogleCloudAiplatformV1GenerationConfigRoutingConfigManualRoutingMode | undefined}; export type GoogleCloudAiplatformV1PrebuiltVoiceConfig = {voiceName?: string | undefined}; export type GoogleCloudAiplatformV1ReplicatedVoiceConfig = {mimeType?: string | undefined, voiceSampleAudio?: string | undefined}; export type GoogleCloudAiplatformV1VoiceConfig = {prebuiltVoiceConfig?: GoogleCloudAiplatformV1PrebuiltVoiceConfig | undefined, replicatedVoiceConfig?: GoogleCloudAiplatformV1ReplicatedVoiceConfig | undefined, voice?: string | undefined}; export type GoogleCloudAiplatformV1SpeakerVoiceConfig = {speaker?: string | undefined, voiceConfig?: GoogleCloudAiplatformV1VoiceConfig | undefined}; export type GoogleCloudAiplatformV1MultiSpeakerVoiceConfig = {speakerVoiceConfigs?: Array | undefined}; export type GoogleCloudAiplatformV1SpeechConfig = {languageCode?: string | undefined, multiSpeakerVoiceConfig?: GoogleCloudAiplatformV1MultiSpeakerVoiceConfig | undefined, voiceConfig?: GoogleCloudAiplatformV1VoiceConfig | undefined}; export type GoogleCloudAiplatformV1GenerationConfigThinkingConfig = {includeThoughts?: boolean | undefined, thinkingBudget?: number | undefined, thinkingLevel?: ('THINKING_LEVEL_UNSPECIFIED' | 'LOW' | 'MEDIUM' | 'HIGH' | 'MINIMAL') | undefined}; export type GoogleCloudAiplatformV1TranslationConfig = {echoTargetLanguage?: boolean | undefined, targetLanguageCode?: string | undefined}; export type GoogleCloudAiplatformV1GenerationConfig = {audioTimestamp?: boolean | undefined, audioTranscriptionConfig?: GoogleCloudAiplatformV1AudioTranscriptionConfig | undefined, candidateCount?: number | undefined, enableAffectiveDialog?: boolean | undefined, frequencyPenalty?: number | undefined, imageConfig?: GoogleCloudAiplatformV1ImageConfig | undefined, logprobs?: number | undefined, maxOutputTokens?: number | undefined, mediaResolution?: ('MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH') | undefined, presencePenalty?: number | undefined, responseFormat?: Array | undefined, responseJsonSchema: unknown, responseLogprobs?: boolean | undefined, responseMimeType?: string | undefined, responseModalities?: (Array<'MODALITY_UNSPECIFIED' | 'TEXT' | 'IMAGE' | 'AUDIO' | 'VIDEO'>) | undefined, responseSchema?: GoogleCloudAiplatformV1Schema | undefined, routingConfig?: GoogleCloudAiplatformV1GenerationConfigRoutingConfig | undefined, seed?: number | undefined, speechConfig?: GoogleCloudAiplatformV1SpeechConfig | undefined, stopSequences?: Array | undefined, temperature?: number | undefined, thinkingConfig?: GoogleCloudAiplatformV1GenerationConfigThinkingConfig | undefined, topK?: number | undefined, topP?: number | undefined, translationConfig?: GoogleCloudAiplatformV1TranslationConfig | undefined}; export type GoogleCloudAiplatformV1ModelArmorConfig = {promptTemplateName?: string | undefined, responseTemplateName?: string | undefined}; export type GoogleCloudAiplatformV1GenerateContentRequestOutputConfig = {outputUriPrefix?: string | undefined}; export type GoogleCloudAiplatformV1SafetySetting = {category?: ('HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_CIVIC_INTEGRITY' | 'HARM_CATEGORY_IMAGE_HATE' | 'HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT' | 'HARM_CATEGORY_IMAGE_HARASSMENT' | 'HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_JAILBREAK') | undefined, method?: ('HARM_BLOCK_METHOD_UNSPECIFIED' | 'SEVERITY' | 'PROBABILITY') | undefined, threshold?: ('HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF') | undefined}; export type GoogleCloudAiplatformV1FunctionCallingConfig = {allowedFunctionNames?: Array | undefined, mode?: ('MODE_UNSPECIFIED' | 'AUTO' | 'ANY' | 'NONE' | 'VALIDATED') | undefined, streamFunctionCallArguments?: boolean | undefined}; export type GoogleTypeLatLng = {latitude?: number | undefined, longitude?: number | undefined}; export type GoogleCloudAiplatformV1RetrievalConfig = {languageCode?: string | undefined, latLng?: GoogleTypeLatLng | undefined}; export type GoogleCloudAiplatformV1ToolConfig = {functionCallingConfig?: GoogleCloudAiplatformV1FunctionCallingConfig | undefined, retrievalConfig?: GoogleCloudAiplatformV1RetrievalConfig | undefined}; export type GoogleCloudAiplatformV1ToolCodeExecution = Record; export type GoogleCloudAiplatformV1ToolComputerUse = {disabledSafetyPolicies?: (Array<'SAFETY_POLICY_UNSPECIFIED' | 'FINANCIAL_TRANSACTIONS' | 'SENSITIVE_DATA_MODIFICATION' | 'COMMUNICATION_TOOL' | 'ACCOUNT_CREATION' | 'DATA_MODIFICATION' | 'USER_CONSENT_MANAGEMENT' | 'LEGAL_TERMS_AND_AGREEMENTS'>) | undefined, enablePromptInjectionDetection?: boolean | undefined, environment?: ('ENVIRONMENT_UNSPECIFIED' | 'ENVIRONMENT_BROWSER' | 'ENVIRONMENT_MOBILE' | 'ENVIRONMENT_DESKTOP') | undefined, excludedPredefinedFunctions?: Array | undefined}; export type GoogleCloudAiplatformV1EnterpriseWebSearch = {blockingConfidence?: ('PHISH_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_HIGH_AND_ABOVE' | 'BLOCK_HIGHER_AND_ABOVE' | 'BLOCK_VERY_HIGH_AND_ABOVE' | 'BLOCK_ONLY_EXTREMELY_HIGH') | undefined, excludeDomains?: Array | undefined}; export type GoogleCloudAiplatformV1ToolExaAiSearch = {apiKey?: string | undefined, customConfigs?: {[key: string]: unknown} | undefined}; export type GoogleCloudAiplatformV1FunctionDeclaration = {behavior?: ('UNSPECIFIED' | 'BLOCKING' | 'NON_BLOCKING') | undefined, description?: string | undefined, name?: string | undefined, parameters?: GoogleCloudAiplatformV1Schema | undefined, parametersJsonSchema: unknown, response?: GoogleCloudAiplatformV1Schema | undefined, responseJsonSchema: unknown}; export type GoogleCloudAiplatformV1GoogleMapsPlaces = Record; export type GoogleCloudAiplatformV1GoogleMapsRouting = Record; export type GoogleCloudAiplatformV1GoogleMapsGroundingTypes = {places?: GoogleCloudAiplatformV1GoogleMapsPlaces | undefined, routing?: GoogleCloudAiplatformV1GoogleMapsRouting | undefined}; export type GoogleCloudAiplatformV1GoogleMaps = {enableWidget?: boolean | undefined, groundingTypes?: GoogleCloudAiplatformV1GoogleMapsGroundingTypes | undefined}; export type GoogleCloudAiplatformV1ToolGoogleSearchImageSearch = Record; export type GoogleCloudAiplatformV1ToolGoogleSearchWebSearch = Record; export type GoogleCloudAiplatformV1ToolGoogleSearchSearchTypes = {imageSearch?: GoogleCloudAiplatformV1ToolGoogleSearchImageSearch | undefined, webSearch?: GoogleCloudAiplatformV1ToolGoogleSearchWebSearch | undefined}; export type GoogleCloudAiplatformV1ToolGoogleSearch = {blockingConfidence?: ('PHISH_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_HIGH_AND_ABOVE' | 'BLOCK_HIGHER_AND_ABOVE' | 'BLOCK_VERY_HIGH_AND_ABOVE' | 'BLOCK_ONLY_EXTREMELY_HIGH') | undefined, excludeDomains?: Array | undefined, searchTypes?: GoogleCloudAiplatformV1ToolGoogleSearchSearchTypes | undefined}; export type GoogleCloudAiplatformV1DynamicRetrievalConfig = {dynamicThreshold?: number | undefined, mode?: ('MODE_UNSPECIFIED' | 'MODE_DYNAMIC') | undefined}; export type GoogleCloudAiplatformV1GoogleSearchRetrieval = {dynamicRetrievalConfig?: GoogleCloudAiplatformV1DynamicRetrievalConfig | undefined}; export type GoogleCloudAiplatformV1ToolParallelAiSearch = {apiKey?: string | undefined, customConfigs?: {[key: string]: unknown} | undefined, enableDataRetention?: boolean | undefined, enableZeroDataRetention?: boolean | undefined}; export type GoogleCloudAiplatformV1ApiAuthApiKeyConfig = {apiKeySecretVersion?: string | undefined, apiKeyString?: string | undefined}; export type GoogleCloudAiplatformV1ApiAuth = {apiKeyConfig?: GoogleCloudAiplatformV1ApiAuthApiKeyConfig | undefined}; export type GoogleCloudAiplatformV1AuthConfigApiKeyConfig = {apiKeySecret?: string | undefined, apiKeyString?: string | undefined, httpElementLocation?: ('HTTP_IN_UNSPECIFIED' | 'HTTP_IN_QUERY' | 'HTTP_IN_HEADER' | 'HTTP_IN_PATH' | 'HTTP_IN_BODY' | 'HTTP_IN_COOKIE') | undefined, name?: string | undefined}; export type GoogleCloudAiplatformV1AuthConfigGoogleServiceAccountConfig = {serviceAccount?: string | undefined}; export type GoogleCloudAiplatformV1AuthConfigHttpBasicAuthConfig = {credentialSecret?: string | undefined}; export type GoogleCloudAiplatformV1AuthConfigOauthConfig = {accessToken?: string | undefined, serviceAccount?: string | undefined}; export type GoogleCloudAiplatformV1AuthConfigOidcConfig = {idToken?: string | undefined, serviceAccount?: string | undefined}; export type GoogleCloudAiplatformV1AuthConfig = {apiKeyConfig?: GoogleCloudAiplatformV1AuthConfigApiKeyConfig | undefined, authType?: ('AUTH_TYPE_UNSPECIFIED' | 'NO_AUTH' | 'API_KEY_AUTH' | 'HTTP_BASIC_AUTH' | 'GOOGLE_SERVICE_ACCOUNT_AUTH' | 'OAUTH' | 'OIDC_AUTH') | undefined, googleServiceAccountConfig?: GoogleCloudAiplatformV1AuthConfigGoogleServiceAccountConfig | undefined, httpBasicAuthConfig?: GoogleCloudAiplatformV1AuthConfigHttpBasicAuthConfig | undefined, oauthConfig?: GoogleCloudAiplatformV1AuthConfigOauthConfig | undefined, oidcConfig?: GoogleCloudAiplatformV1AuthConfigOidcConfig | undefined}; export type GoogleCloudAiplatformV1ExternalApiElasticSearchParams = {index?: string | undefined, numHits?: number | undefined, searchTemplate?: string | undefined}; export type GoogleCloudAiplatformV1ExternalApiSimpleSearchParams = Record; export type GoogleCloudAiplatformV1ExternalApi = {apiAuth?: GoogleCloudAiplatformV1ApiAuth | undefined, apiSpec?: ('API_SPEC_UNSPECIFIED' | 'SIMPLE_SEARCH' | 'ELASTIC_SEARCH') | undefined, authConfig?: GoogleCloudAiplatformV1AuthConfig | undefined, elasticSearchParams?: GoogleCloudAiplatformV1ExternalApiElasticSearchParams | undefined, endpoint?: string | undefined, simpleSearchParams?: GoogleCloudAiplatformV1ExternalApiSimpleSearchParams | undefined}; export type GoogleCloudAiplatformV1VertexAISearchDataStoreSpec = {dataStore?: string | undefined, filter?: string | undefined}; export type GoogleCloudAiplatformV1VertexAISearch = {dataStoreSpecs?: Array | undefined, datastore?: string | undefined, engine?: string | undefined, filter?: string | undefined, maxResults?: number | undefined}; export type GoogleCloudAiplatformV1VertexRagStoreRagResource = {ragCorpus?: string | undefined, ragFileIds?: Array | undefined}; export type GoogleCloudAiplatformV1RagRetrievalConfigFilter = {metadataFilter?: string | undefined, vectorDistanceThreshold?: number | undefined, vectorSimilarityThreshold?: number | undefined}; export type GoogleCloudAiplatformV1RagRetrievalConfigRankingLlmRanker = {modelName?: string | undefined}; export type GoogleCloudAiplatformV1RagRetrievalConfigRankingRankService = {modelName?: string | undefined}; export type GoogleCloudAiplatformV1RagRetrievalConfigRanking = {llmRanker?: GoogleCloudAiplatformV1RagRetrievalConfigRankingLlmRanker | undefined, rankService?: GoogleCloudAiplatformV1RagRetrievalConfigRankingRankService | undefined}; export type GoogleCloudAiplatformV1RagRetrievalConfig = {filter?: GoogleCloudAiplatformV1RagRetrievalConfigFilter | undefined, ranking?: GoogleCloudAiplatformV1RagRetrievalConfigRanking | undefined, topK?: number | undefined}; export type GoogleCloudAiplatformV1VertexRagStore = {ragResources?: Array | undefined, ragRetrievalConfig?: GoogleCloudAiplatformV1RagRetrievalConfig | undefined, similarityTopK?: number | undefined, vectorDistanceThreshold?: number | undefined}; export type GoogleCloudAiplatformV1Retrieval = {disableAttribution?: boolean | undefined, externalApi?: GoogleCloudAiplatformV1ExternalApi | undefined, vertexAiSearch?: GoogleCloudAiplatformV1VertexAISearch | undefined, vertexRagStore?: GoogleCloudAiplatformV1VertexRagStore | undefined}; export type GoogleCloudAiplatformV1UrlContext = Record; export type GoogleCloudAiplatformV1Tool = {codeExecution?: GoogleCloudAiplatformV1ToolCodeExecution | undefined, computerUse?: GoogleCloudAiplatformV1ToolComputerUse | undefined, enterpriseWebSearch?: GoogleCloudAiplatformV1EnterpriseWebSearch | undefined, exaAiSearch?: GoogleCloudAiplatformV1ToolExaAiSearch | undefined, functionDeclarations?: Array | undefined, googleMaps?: GoogleCloudAiplatformV1GoogleMaps | undefined, googleSearch?: GoogleCloudAiplatformV1ToolGoogleSearch | undefined, googleSearchRetrieval?: GoogleCloudAiplatformV1GoogleSearchRetrieval | undefined, parallelAiSearch?: GoogleCloudAiplatformV1ToolParallelAiSearch | undefined, retrieval?: GoogleCloudAiplatformV1Retrieval | undefined, urlContext?: GoogleCloudAiplatformV1UrlContext | undefined}; export type GoogleCloudAiplatformV1GenerateContentRequest = {cachedContent?: string | undefined, contents?: Array | undefined, continuationToken?: string | undefined, generationConfig?: GoogleCloudAiplatformV1GenerationConfig | undefined, labels?: {[key: string]: string} | undefined, modelArmorConfig?: GoogleCloudAiplatformV1ModelArmorConfig | undefined, outputConfig?: GoogleCloudAiplatformV1GenerateContentRequestOutputConfig | undefined, safetySettings?: Array | undefined, systemInstruction?: GoogleCloudAiplatformV1Content | undefined, toolConfig?: GoogleCloudAiplatformV1ToolConfig | undefined, tools?: Array | undefined}; export type CreateApiV1EndpointsEndpointsIdStreamGenerateContentArgs = {endpointsId: string, body: GoogleCloudAiplatformV1GenerateContentRequest}; export type CreateApiV1EndpointsEndpointsIdStreamGenerateContentOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; export const googleTypeDate = z.object({day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional()}); export const googleCloudAiplatformV1Citation = z.object({endIndex: z.number().int().optional(), license: z.string().optional(), publicationDate: googleTypeDate.optional(), startIndex: z.number().int().optional(), title: z.string().optional(), uri: z.string().optional()}); export const googleCloudAiplatformV1CitationMetadata = z.object({citations: z.array(googleCloudAiplatformV1Citation).optional()}); export const googleCloudAiplatformV1AudioTranscriptionWordInfo = z.object({endOffset: z.string().optional(), startOffset: z.string().optional(), word: z.string().optional()}); export const googleCloudAiplatformV1AudioTranscription = z.object({speakerLabel: z.string().optional(), text: z.string().optional(), words: z.array(googleCloudAiplatformV1AudioTranscriptionWordInfo).optional()}); export const googleCloudAiplatformV1CodeExecutionResult = z.object({id: z.string().optional(), outcome: z.enum(["OUTCOME_UNSPECIFIED", "OUTCOME_OK", "OUTCOME_FAILED", "OUTCOME_DEADLINE_EXCEEDED"]).optional(), output: z.string().optional()}); export const googleCloudAiplatformV1ExecutableCode = z.object({code: z.string().optional(), id: z.string().optional(), language: z.enum(["LANGUAGE_UNSPECIFIED", "PYTHON"]).optional()}); export const googleCloudAiplatformV1FileData = z.object({displayName: z.string().optional(), fileUri: z.string().optional(), mimeType: z.string().optional()}); export const googleCloudAiplatformV1PartialArg = z.object({boolValue: z.boolean().optional(), jsonPath: z.string().optional(), nullValue: z.literal("NULL_VALUE").optional(), numberValue: z.number().optional(), stringValue: z.string().optional(), willContinue: z.boolean().optional()}); export const googleCloudAiplatformV1FunctionCall = z.object({args: z.record(z.string(), z.unknown()).optional(), id: z.string().optional(), name: z.string().optional(), partialArgs: z.array(googleCloudAiplatformV1PartialArg).optional(), willContinue: z.boolean().optional()}); export const googleCloudAiplatformV1FunctionResponseFileData = z.object({displayName: z.string().optional(), fileUri: z.string().optional(), mimeType: z.string().optional()}); export const googleCloudAiplatformV1FunctionResponseBlob = z.object({data: z.string().optional(), displayName: z.string().optional(), mimeType: z.string().optional()}); export const googleCloudAiplatformV1FunctionResponsePart = z.object({fileData: googleCloudAiplatformV1FunctionResponseFileData.optional(), inlineData: googleCloudAiplatformV1FunctionResponseBlob.optional()}); export const googleCloudAiplatformV1FunctionResponse = z.object({id: z.string().optional(), name: z.string().optional(), parts: z.array(googleCloudAiplatformV1FunctionResponsePart).optional(), response: z.record(z.string(), z.unknown()).optional(), scheduling: z.enum(["SCHEDULING_UNSPECIFIED", "SILENT", "WHEN_IDLE", "INTERRUPT"]).optional()}); export const googleCloudAiplatformV1Blob = z.object({data: z.string().optional(), displayName: z.string().optional(), mimeType: z.string().optional()}); export const googleCloudAiplatformV1PartMediaResolution = z.object({level: z.enum(["MEDIA_RESOLUTION_UNSPECIFIED", "MEDIA_RESOLUTION_LOW", "MEDIA_RESOLUTION_MEDIUM", "MEDIA_RESOLUTION_HIGH", "MEDIA_RESOLUTION_ULTRA_HIGH"]).optional()}); export const googleCloudAiplatformV1SpeechMetadata = z.object({speaker: z.string().optional(), style: z.string().optional()}); export const googleCloudAiplatformV1VideoMetadata = z.object({endOffset: z.string().optional(), fps: z.number().optional(), startOffset: z.string().optional()}); export const googleCloudAiplatformV1Part = z.object({audioTranscription: googleCloudAiplatformV1AudioTranscription.optional(), codeExecutionResult: googleCloudAiplatformV1CodeExecutionResult.optional(), executableCode: googleCloudAiplatformV1ExecutableCode.optional(), fileData: googleCloudAiplatformV1FileData.optional(), functionCall: googleCloudAiplatformV1FunctionCall.optional(), functionResponse: googleCloudAiplatformV1FunctionResponse.optional(), inlineData: googleCloudAiplatformV1Blob.optional(), mediaResolution: googleCloudAiplatformV1PartMediaResolution.optional(), speechMetadata: googleCloudAiplatformV1SpeechMetadata.optional(), text: z.string().optional(), thought: z.boolean().optional(), thoughtSignature: z.string().optional(), videoMetadata: googleCloudAiplatformV1VideoMetadata.optional()}); export const googleCloudAiplatformV1Content = z.object({parts: z.array(googleCloudAiplatformV1Part).optional(), role: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkImage = z.object({domain: z.string().optional(), imageUri: z.string().optional(), sourceUri: z.string().optional(), title: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkMapsPlaceAnswerSourcesReviewSnippet = z.object({googleMapsUri: z.string().optional(), reviewId: z.string().optional(), title: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkMapsPlaceAnswerSources = z.object({reviewSnippets: z.array(googleCloudAiplatformV1GroundingChunkMapsPlaceAnswerSourcesReviewSnippet).optional()}); export const googleCloudAiplatformV1GroundingChunkMapsRoute = z.object({distanceMeters: z.number().int().optional(), duration: z.string().optional(), encodedPolyline: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkMaps = z.object({placeAnswerSources: googleCloudAiplatformV1GroundingChunkMapsPlaceAnswerSources.optional(), placeId: z.string().optional(), route: googleCloudAiplatformV1GroundingChunkMapsRoute.optional(), text: z.string().optional(), title: z.string().optional(), uri: z.string().optional()}); export const googleCloudAiplatformV1RagChunkPageSpan = z.object({firstPage: z.number().int().optional(), lastPage: z.number().int().optional()}); export const googleCloudAiplatformV1RagChunk = z.object({chunkId: z.string().optional(), fileId: z.string().optional(), pageSpan: googleCloudAiplatformV1RagChunkPageSpan.optional(), text: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkRetrievedContext = z.object({documentName: z.string().optional(), ragChunk: googleCloudAiplatformV1RagChunk.optional(), text: z.string().optional(), title: z.string().optional(), uri: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunkWeb = z.object({domain: z.string().optional(), title: z.string().optional(), uri: z.string().optional()}); export const googleCloudAiplatformV1GroundingChunk = z.object({image: googleCloudAiplatformV1GroundingChunkImage.optional(), maps: googleCloudAiplatformV1GroundingChunkMaps.optional(), retrievedContext: googleCloudAiplatformV1GroundingChunkRetrievedContext.optional(), web: googleCloudAiplatformV1GroundingChunkWeb.optional()}); export const googleCloudAiplatformV1Segment = z.object({endIndex: z.number().int().optional(), partIndex: z.number().int().optional(), startIndex: z.number().int().optional(), text: z.string().optional()}); export const googleCloudAiplatformV1GroundingSupport = z.object({confidenceScores: z.array(z.number()).optional(), groundingChunkIndices: z.array(z.number().int()).optional(), renderedParts: z.array(z.number().int()).optional(), segment: googleCloudAiplatformV1Segment.optional()}); export const googleCloudAiplatformV1RetrievalMetadata = z.object({googleSearchDynamicRetrievalScore: z.number().optional()}); export const googleCloudAiplatformV1SearchEntryPoint = z.object({renderedContent: z.string().optional(), sdkBlob: z.string().optional()}); export const googleCloudAiplatformV1GroundingMetadataSourceFlaggingUri = z.object({flagContentUri: z.string().optional(), sourceId: z.string().optional()}); export const googleCloudAiplatformV1GroundingMetadata = z.object({googleMapsWidgetContextToken: z.string().optional(), groundingChunks: z.array(googleCloudAiplatformV1GroundingChunk).optional(), groundingSupports: z.array(googleCloudAiplatformV1GroundingSupport).optional(), imageSearchQueries: z.array(z.string()).optional(), retrievalMetadata: googleCloudAiplatformV1RetrievalMetadata.optional(), retrievalQueries: z.array(z.string()).optional(), searchEntryPoint: googleCloudAiplatformV1SearchEntryPoint.optional(), sourceFlaggingUris: z.array(googleCloudAiplatformV1GroundingMetadataSourceFlaggingUri).optional(), webSearchQueries: z.array(z.string()).optional()}); export const googleCloudAiplatformV1LogprobsResultCandidate = z.object({logProbability: z.number().optional(), token: z.string().optional(), tokenId: z.number().int().optional()}); export const googleCloudAiplatformV1LogprobsResultTopCandidates = z.object({candidates: z.array(googleCloudAiplatformV1LogprobsResultCandidate).optional()}); export const googleCloudAiplatformV1LogprobsResult = z.object({chosenCandidates: z.array(googleCloudAiplatformV1LogprobsResultCandidate).optional(), topCandidates: z.array(googleCloudAiplatformV1LogprobsResultTopCandidates).optional()}); export const googleCloudAiplatformV1SafetyRating = z.object({blocked: z.boolean().optional(), category: z.enum(["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT", "HARM_CATEGORY_CIVIC_INTEGRITY", "HARM_CATEGORY_IMAGE_HATE", "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT", "HARM_CATEGORY_IMAGE_HARASSMENT", "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT", "HARM_CATEGORY_JAILBREAK"]).optional(), overwrittenThreshold: z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED", "BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE", "OFF"]).optional(), probability: z.enum(["HARM_PROBABILITY_UNSPECIFIED", "NEGLIGIBLE", "LOW", "MEDIUM", "HIGH"]).optional(), probabilityScore: z.number().optional(), severity: z.enum(["HARM_SEVERITY_UNSPECIFIED", "HARM_SEVERITY_NEGLIGIBLE", "HARM_SEVERITY_LOW", "HARM_SEVERITY_MEDIUM", "HARM_SEVERITY_HIGH"]).optional(), severityScore: z.number().optional()}); export const googleCloudAiplatformV1UrlMetadata = z.object({retrievedUrl: z.string().optional(), urlRetrievalStatus: z.enum(["URL_RETRIEVAL_STATUS_UNSPECIFIED", "URL_RETRIEVAL_STATUS_SUCCESS", "URL_RETRIEVAL_STATUS_ERROR"]).optional()}); export const googleCloudAiplatformV1UrlContextMetadata = z.object({urlMetadata: z.array(googleCloudAiplatformV1UrlMetadata).optional()}); export const googleCloudAiplatformV1Candidate = z.object({avgLogprobs: z.number().optional(), citationMetadata: googleCloudAiplatformV1CitationMetadata.optional(), content: googleCloudAiplatformV1Content.optional(), continuationToken: z.string().optional(), finishMessage: z.string().optional(), finishReason: z.enum(["FINISH_REASON_UNSPECIFIED", "STOP", "MAX_TOKENS", "SAFETY", "RECITATION", "OTHER", "BLOCKLIST", "PROHIBITED_CONTENT", "SPII", "MALFORMED_FUNCTION_CALL", "MODEL_ARMOR", "IMAGE_SAFETY", "IMAGE_PROHIBITED_CONTENT", "IMAGE_RECITATION", "IMAGE_OTHER", "UNEXPECTED_TOOL_CALL", "NO_IMAGE", "MALFORMED_RESPONSE", "CONTINUATION", "TOO_MANY_TOOL_CALLS"]).optional(), groundingMetadata: googleCloudAiplatformV1GroundingMetadata.optional(), index: z.number().int().optional(), logprobsResult: googleCloudAiplatformV1LogprobsResult.optional(), safetyRatings: z.array(googleCloudAiplatformV1SafetyRating).optional(), urlContextMetadata: googleCloudAiplatformV1UrlContextMetadata.optional()}); export const googleCloudAiplatformV1GenerateContentResponsePromptFeedback = z.object({blockReason: z.enum(["BLOCKED_REASON_UNSPECIFIED", "SAFETY", "OTHER", "BLOCKLIST", "PROHIBITED_CONTENT", "MODEL_ARMOR", "IMAGE_SAFETY", "JAILBREAK"]).optional(), blockReasonMessage: z.string().optional(), safetyRatings: z.array(googleCloudAiplatformV1SafetyRating).optional()}); export const googleCloudAiplatformV1ModalityTokenCount = z.object({modality: z.enum(["MODALITY_UNSPECIFIED", "TEXT", "IMAGE", "VIDEO", "AUDIO", "DOCUMENT"]).optional(), tokenCount: z.number().int().optional()}); export const googleCloudAiplatformV1GenerateContentResponseUsageMetadata = z.object({cacheTokensDetails: z.array(googleCloudAiplatformV1ModalityTokenCount).optional(), cachedContentTokenCount: z.number().int().optional(), candidatesTokenCount: z.number().int().optional(), candidatesTokensDetails: z.array(googleCloudAiplatformV1ModalityTokenCount).optional(), promptTokenCount: z.number().int().optional(), promptTokensDetails: z.array(googleCloudAiplatformV1ModalityTokenCount).optional(), thoughtsTokenCount: z.number().int().optional(), toolUsePromptTokenCount: z.number().int().optional(), toolUsePromptTokensDetails: z.array(googleCloudAiplatformV1ModalityTokenCount).optional(), totalTokenCount: z.number().int().optional(), trafficType: z.enum(["TRAFFIC_TYPE_UNSPECIFIED", "ON_DEMAND", "ON_DEMAND_PRIORITY", "ON_DEMAND_FLEX", "ON_DEMAND_OFFPEAK", "PROVISIONED_THROUGHPUT"]).optional()}); export const googleCloudAiplatformV1GenerateContentResponse = z.object({candidates: z.array(googleCloudAiplatformV1Candidate).optional(), createTime: z.string().optional(), modelVersion: z.string().optional(), promptFeedback: googleCloudAiplatformV1GenerateContentResponsePromptFeedback.optional(), responseId: z.string().optional(), usageMetadata: googleCloudAiplatformV1GenerateContentResponseUsageMetadata.optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Generate content with multimodal inputs with streaming support. * * POST /v1/endpoints/{endpointsId}:streamGenerateContent * * Also accepts auth: Oauth2 + Oauth2c, Oauth2 + Oauth2c */ export const createApiV1EndpointsEndpointsIdStreamGenerateContent = async (args: CreateApiV1EndpointsEndpointsIdStreamGenerateContentArgs, options?: CreateApiV1EndpointsEndpointsIdStreamGenerateContentOptions) => { const {baseUrl = "https://aiplatform.googleapis.com", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/endpoints/${encodeURIComponent(String(args.endpointsId))}:streamGenerateContent${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(googleCloudAiplatformV1GenerateContentResponse, await res.json()) };