**Full name**: projects.locations.askContexts

Agentic Retrieval Ask API for RAG.

### Endpoint

post `https://{service-endpoint}/v1/{parent}:askContexts`   
Where `{service-endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest#rest_endpoints).

### Path parameters

`parent` `string` Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: `projects/{project}/locations/{location}`.

### Request body

The request body contains data with the following structure:
Fields `query` ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1/RagQuery`)`` Required. Single RAG retrieve query.
`tools[]` ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1/projects.locations.cachedContents#Tool`)`` Optional. The tools to use for locations.askContexts.

### Response body

Response message for `https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1/projects.locations/askContexts#google.cloud.aiplatform.v1.VertexRagService.AskContexts`.

If successful, the response body contains data with the following structure:
Fields `response` `string` The Retrieval Response.
`contexts` ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1/RagContexts`)`` The contexts of the query.

| JSON representation |
|---|
| ``` { "response": string, "contexts": { object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/rest/v1/RagContexts`) } } ``` |

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `aiplatform.ragCorpora.list`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).