---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}:augmentPrompt"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}:augmentPrompt"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}:augmentPrompt

`POST /v1/projects/{projectsId}/locations/{locationsId}:augmentPrompt`

## Request

- Base URL: `https://aiplatform.googleapis.com`
- URL: `https://aiplatform.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}:augmentPrompt`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/aiplatform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/aiplatform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
- TypeScript: <https://skmtc.dev/google/apis/aiplatform/docs/v1/projects/:projectsId/locations/:locationsId:augmentPrompt/post.ts> (a function with typed inputs; its response is checked against the schema)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required

## Request body

- GoogleCloudAiplatformV1AugmentPromptRequest: Request message for AugmentPrompt.
  - `contents` GoogleCloudAiplatformV1Content[]: Optional. Input content to augment, only text format is supported for now.
    - `parts` GoogleCloudAiplatformV1Part[]: Required. A list of Part objects that make up a single message. Parts of a message can have different MIME types. A Content message must have at least one Part.
      - `audioTranscription` GoogleCloudAiplatformV1AudioTranscription: The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`.
        - `speakerLabel` string: Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.
        - `text` string: Required. The transcription text of this audio segment.
        - `words` GoogleCloudAiplatformV1AudioTranscriptionWordInfo[]: Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.
          - `endOffset` string, google-duration: Optional. End offset in time of the word relative to the start of the audio.
          - `startOffset` string, google-duration: Optional. Start offset in time of the word relative to the start of the audio.
          - `word` string: Required. Transcript of the word.
      - `codeExecutionResult` GoogleCloudAiplatformV1CodeExecutionResult: Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used.
        - `id` string: Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.
        - `outcome` 'OUTCOME_UNSPECIFIED' | 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED': Required. Outcome of the code execution.
        - `output` string: Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
      - `executableCode` GoogleCloudAiplatformV1ExecutableCode: Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.
        - `code` string: Required. The code to be executed.
        - `id` string: Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.
        - `language` 'LANGUAGE_UNSPECIFIED' | 'PYTHON': Required. Programming language of the `code`.
      - `fileData` GoogleCloudAiplatformV1FileData: URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.
        - `displayName` string: Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
        - `fileUri` string: Required. The URI of the file in Google Cloud Storage.
        - `mimeType` string: Required. The IANA standard MIME type of the source data.
      - `functionCall` GoogleCloudAiplatformV1FunctionCall: A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.
        - `args` object: Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.
        - `id` string: Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.
        - `name` string: Optional. The name of the function to call. Matches FunctionDeclaration.name.
        - `partialArgs` GoogleCloudAiplatformV1PartialArg[]: Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally.
          - `boolValue` boolean: Optional. Represents a boolean value.
          - `jsonPath` string: Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data".
          - `nullValue` 'NULL_VALUE': Optional. Represents a null value.
          - `numberValue` number, double: Optional. Represents a double value.
          - `stringValue` string: Optional. Represents a string value.
          - `willContinue` boolean: Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.
        - `willContinue` boolean: Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow.
      - `functionResponse` GoogleCloudAiplatformV1FunctionResponse: The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction.
        - `id` string: Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.
        - `name` string: Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.
        - `parts` GoogleCloudAiplatformV1FunctionResponsePart[]: Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.
          - `fileData` GoogleCloudAiplatformV1FunctionResponseFileData: URI based data for function response.
            - `displayName` string: Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
            - `fileUri` string: Required. URI.
            - `mimeType` string: Required. The IANA standard MIME type of the source data.
          - `inlineData` GoogleCloudAiplatformV1FunctionResponseBlob: Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field.
            - `data` string, byte: Required. Raw bytes.
            - `displayName` string: Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
            - `mimeType` string: Required. The IANA standard MIME type of the source data.
        - `response` object: Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.
        - `scheduling` 'SCHEDULING_UNSPECIFIED' | 'SILENT' | 'WHEN_IDLE' | 'INTERRUPT': Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
      - `inlineData` GoogleCloudAiplatformV1Blob: A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video.
        - `data` string, byte: Required. The raw bytes of the data.
        - `displayName` string: Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
        - `mimeType` string: Required. The IANA standard MIME type of the source data.
      - `mediaResolution` GoogleCloudAiplatformV1PartMediaResolution: per part media resolution. Media resolution for the input media.
        - `level` 'MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' | 'MEDIA_RESOLUTION_ULTRA_HIGH': The tokenization quality used for given media.
      - `speechMetadata` GoogleCloudAiplatformV1SpeechMetadata: Structured Metadata Sub-Message for Part
        - `speaker` string: Optional. Identifies which speaker is speaking this turn.
        - `style` string: Optional. Natural language description of the vocal style (e.g., "cheerful").
      - `text` string: Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.
      - `thought` boolean: Optional. Indicates whether the `part` represents the model's thought process or reasoning.
      - `thoughtSignature` string, byte: Optional. An opaque signature for the thought so it can be reused in subsequent requests.
      - `videoMetadata` GoogleCloudAiplatformV1VideoMetadata: Provides metadata for a video, including the start and end offsets for clipping and the frame rate.
        - `endOffset` string, google-duration: Optional. The end offset of the video.
        - `fps` number, double: Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].
        - `startOffset` string, google-duration: Optional. The start offset of the video.
    - `role` string: Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
  - `model` GoogleCloudAiplatformV1AugmentPromptRequestModel: Metadata of the backend deployed model.
    - `model` string: Optional. The model that the user will send the augmented prompt for content generation.
    - `modelVersion` string: Optional. The model version of the backend deployed model.
  - `vertexRagStore` GoogleCloudAiplatformV1VertexRagStore: Retrieve from Vertex RAG Store for grounding.
    - `ragResources` GoogleCloudAiplatformV1VertexRagStoreRagResource[]: Optional. The representation of the rag source. It can be used to specify corpus only or ragfiles. Currently only support one corpus or multiple files from one corpus. In the future we may open up multiple corpora support.
      - `ragCorpus` string: Optional. RagCorpora resource name. Format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}`
      - `ragFileIds` string[]: Optional. rag_file_id. The files should be in the same rag_corpus set in rag_corpus field.
    - `ragRetrievalConfig` GoogleCloudAiplatformV1RagRetrievalConfig: Specifies the context retrieval config.
      - `filter` GoogleCloudAiplatformV1RagRetrievalConfigFilter: Config for filters.
        - `metadataFilter` string: Optional. String for metadata filtering.
        - `vectorDistanceThreshold` number, double: Optional. Only returns contexts with vector distance smaller than the threshold.
        - `vectorSimilarityThreshold` number, double: Optional. Only returns contexts with vector similarity larger than the threshold.
      - `ranking` GoogleCloudAiplatformV1RagRetrievalConfigRanking: Config for ranking and reranking.
        - `llmRanker` GoogleCloudAiplatformV1RagRetrievalConfigRankingLlmRanker: Config for LlmRanker.
          - `modelName` string: Optional. The model name used for ranking. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models).
        - `rankService` GoogleCloudAiplatformV1RagRetrievalConfigRankingRankService: Config for Rank Service.
          - `modelName` string: Optional. The model name of the rank service. Format: `semantic-ranker-512@latest`
      - `topK` integer: Optional. The number of contexts to retrieve.
    - `similarityTopK` integer: Optional. Number of top k results to return from the selected corpora.
    - `vectorDistanceThreshold` number, double: Optional. Only return results with vector distance smaller than the threshold.

## Response `200`

Successful response

- GoogleCloudAiplatformV1AugmentPromptResponse: Response message for AugmentPrompt.
  - `augmentedPrompt` GoogleCloudAiplatformV1Content[]: Augmented prompt, only text format is supported for now.
    - `parts` GoogleCloudAiplatformV1Part[]: Required. A list of Part objects that make up a single message. Parts of a message can have different MIME types. A Content message must have at least one Part.
      - `audioTranscription` GoogleCloudAiplatformV1AudioTranscription: The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`.
        - `speakerLabel` string: Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.
        - `text` string: Required. The transcription text of this audio segment.
        - `words` GoogleCloudAiplatformV1AudioTranscriptionWordInfo[]: Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.
          - `endOffset` string, google-duration: Optional. End offset in time of the word relative to the start of the audio.
          - `startOffset` string, google-duration: Optional. Start offset in time of the word relative to the start of the audio.
          - `word` string: Required. Transcript of the word.
      - `codeExecutionResult` GoogleCloudAiplatformV1CodeExecutionResult: Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used.
        - `id` string: Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.
        - `outcome` 'OUTCOME_UNSPECIFIED' | 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED': Required. Outcome of the code execution.
        - `output` string: Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
      - `executableCode` GoogleCloudAiplatformV1ExecutableCode: Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.
        - `code` string: Required. The code to be executed.
        - `id` string: Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.
        - `language` 'LANGUAGE_UNSPECIFIED' | 'PYTHON': Required. Programming language of the `code`.
      - `fileData` GoogleCloudAiplatformV1FileData: URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.
        - `displayName` string: Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
        - `fileUri` string: Required. The URI of the file in Google Cloud Storage.
        - `mimeType` string: Required. The IANA standard MIME type of the source data.
      - `functionCall` GoogleCloudAiplatformV1FunctionCall: A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.
        - `args` object: Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.
        - `id` string: Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.
        - `name` string: Optional. The name of the function to call. Matches FunctionDeclaration.name.
        - `partialArgs` GoogleCloudAiplatformV1PartialArg[]: Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally.
          - `boolValue` boolean: Optional. Represents a boolean value.
          - `jsonPath` string: Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data".
          - `nullValue` 'NULL_VALUE': Optional. Represents a null value.
          - `numberValue` number, double: Optional. Represents a double value.
          - `stringValue` string: Optional. Represents a string value.
          - `willContinue` boolean: Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.
        - `willContinue` boolean: Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow.
      - `functionResponse` GoogleCloudAiplatformV1FunctionResponse: The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction.
        - `id` string: Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.
        - `name` string: Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.
        - `parts` GoogleCloudAiplatformV1FunctionResponsePart[]: Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.
          - `fileData` GoogleCloudAiplatformV1FunctionResponseFileData: URI based data for function response.
            - `displayName` string: Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
            - `fileUri` string: Required. URI.
            - `mimeType` string: Required. The IANA standard MIME type of the source data.
          - `inlineData` GoogleCloudAiplatformV1FunctionResponseBlob: Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field.
            - `data` string, byte: Required. Raw bytes.
            - `displayName` string: Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
            - `mimeType` string: Required. The IANA standard MIME type of the source data.
        - `response` object: Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.
        - `scheduling` 'SCHEDULING_UNSPECIFIED' | 'SILENT' | 'WHEN_IDLE' | 'INTERRUPT': Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
      - `inlineData` GoogleCloudAiplatformV1Blob: A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video.
        - `data` string, byte: Required. The raw bytes of the data.
        - `displayName` string: Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
        - `mimeType` string: Required. The IANA standard MIME type of the source data.
      - `mediaResolution` GoogleCloudAiplatformV1PartMediaResolution: per part media resolution. Media resolution for the input media.
        - `level` 'MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' | 'MEDIA_RESOLUTION_ULTRA_HIGH': The tokenization quality used for given media.
      - `speechMetadata` GoogleCloudAiplatformV1SpeechMetadata: Structured Metadata Sub-Message for Part
        - `speaker` string: Optional. Identifies which speaker is speaking this turn.
        - `style` string: Optional. Natural language description of the vocal style (e.g., "cheerful").
      - `text` string: Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.
      - `thought` boolean: Optional. Indicates whether the `part` represents the model's thought process or reasoning.
      - `thoughtSignature` string, byte: Optional. An opaque signature for the thought so it can be reused in subsequent requests.
      - `videoMetadata` GoogleCloudAiplatformV1VideoMetadata: Provides metadata for a video, including the start and end offsets for clipping and the frame rate.
        - `endOffset` string, google-duration: Optional. The end offset of the video.
        - `fps` number, double: Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].
        - `startOffset` string, google-duration: Optional. The start offset of the video.
    - `role` string: Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
  - `facts` GoogleCloudAiplatformV1Fact[]: Retrieved facts from RAG data sources.
    - `chunk` GoogleCloudAiplatformV1RagChunk: A RagChunk includes the content of a chunk of a RagFile, and associated metadata.
      - `chunkId` string: The ID of the chunk.
      - `fileId` string: The ID of the file that the chunk belongs to.
      - `pageSpan` GoogleCloudAiplatformV1RagChunkPageSpan: Represents where the chunk starts and ends in the document.
        - `firstPage` integer: Page where chunk starts in the document. Inclusive. 1-indexed.
        - `lastPage` integer: Page where chunk ends in the document. Inclusive. 1-indexed.
      - `text` string: The content of the chunk.
    - `query` string: Query that is used to retrieve this fact.
    - `score` number, double: If present, according to the underlying Vector DB and the selected metric type, the score can be either the distance or the similarity between the query and the fact and its range depends on the metric type. For example, if the metric type is COSINE_DISTANCE, it represents the distance between the query and the fact. The larger the distance, the less relevant the fact is to the query. The range is [0, 2], while 0 means the most relevant and 2 means the least relevant.
    - `summary` string: If present, the summary/snippet of the fact.
    - `title` string: If present, it refers to the title of this fact.
    - `uri` string: If present, this uri links to the source of the fact.
    - `vectorDistance` number, double: If present, the distance between the query vector and this fact vector.

## Changes

- **2026-11-06** `3aca3b348f0c`: 4 info
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`
- **2026-10-30** `34fcc627b062`: 4 info
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/aiplatform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/aiplatform/changes/v1/projects/:projectsId/locations/:locationsId:augmentPrompt/post.md)

---

[API](https://skmtc.dev/google/apis/aiplatform.md) - [All operations](https://skmtc.dev/google/apis/aiplatform/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/aiplatform/revisions/3aca3b348f0c?raw)
