Method: projects.locations.exampleStores.searchExamples

Search for similar Examples for given selection criteria.

Endpoint

post https://{service-endpoint}/v1beta1/{exampleStore}:searchExamples

Where {service-endpoint} is one of the supported service endpoints.

Path parameters

exampleStore string

Required. The name of the ExampleStore resource that examples are retrieved from. Format: projects/{project}/locations/{location}/exampleStores/{exampleStore}

Request body

The request body contains data with the following structure:

Fields
topK string (int64 format)

Optional. The number of similar examples to return.

parameters Union type
The parameters to search for similar examples. This includes which value to use for similarity search and the filters that should be applied to the search. Filters limit which examples are considered as candidates for similarity search. parameters can be only one of the following:
storedContentsExampleParameters object (StoredContentsExampleParameters)

The parameters of StoredContentsExamples to be searched.

Response body

Response message for ExampleStoreService.SearchExamples.

If successful, the response body contains data with the following structure:

Fields
results[] object (SimilarExample)

The results of searching for similar examples.

JSON representation
{
  "results": [
    {
      object (SimilarExample)
    }
  ]
}

StoredContentsExampleParameters

The metadata filters that will be used to search StoredContentsExamples. If a field is unspecified, then no filtering for that field will be applied

Fields
functionNames object (ExamplesArrayFilter)

Optional. The function names for filtering.

query Union type
The query to use to retrieve similar StoredContentsExamples. query can be only one of the following:
searchKey string

The exact search key to use for retrieval.

contentSearchKey object (ContentSearchKey)

The chat history to use to generate the search key for retrieval.

JSON representation
{
  "functionNames": {
    object (ExamplesArrayFilter)
  },

  // query
  "searchKey": string,
  "contentSearchKey": {
    object (ContentSearchKey)
  }
  // Union type
}

ContentSearchKey

The chat history to use to generate the search key for retrieval.

Fields
contents[] object (Content)

Required. The conversation for generating a search key.

searchKeyGenerationMethod object (SearchKeyGenerationMethod)

Required. The method of generating a search key.

JSON representation
{
  "contents": [
    {
      object (Content)
    }
  ],
  "searchKeyGenerationMethod": {
    object (SearchKeyGenerationMethod)
  }
}

SimilarExample

The result of the similar example.

Fields
example object (Example)

The example that is similar to the searched query.

similarityScore number

The similarity score of this example.

JSON representation
{
  "example": {
    object (Example)
  },
  "similarityScore": number
}