# Retriever

## Retrieve

`CompositeRetrievalResult retrievers().retriever().search(RetrieverSearchParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**post** `/api/v1/retrievers/{retriever_id}/retrieve`

Retrieve data using a Retriever.

### Parameters

- `RetrieverSearchParams params`

  - `Optional<String> retrieverId`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

  - `String query`

    The query to retrieve against.

  - `Optional<CompositeRetrievalMode> mode`

    The mode of composite retrieval.

  - `Optional<ReRankConfig> rerankConfig`

    The rerank configuration for composite retrieval.

  - `Optional<Long> rerankTopN`

    (use rerank_config.top_n instead) The number of nodes to retrieve after reranking over retrieved nodes from all retrieval tools.

### Returns

- `class CompositeRetrievalResult:`

  - `Optional<List<PageScreenshotNodeWithScore>> imageNodes`

    The image nodes retrieved by the pipeline for the given query. Deprecated - will soon be replaced with 'page_screenshot_nodes'.

    - `Node node`

      - `String fileId`

        The ID of the file that the page screenshot was taken from

      - `long imageSize`

        The size of the image in bytes

      - `long pageIndex`

        The index of the page for which the screenshot is taken (0-indexed)

      - `Optional<Metadata> metadata`

        Metadata for the screenshot

    - `double score`

      The score of the screenshot node

    - `Optional<String> className`

  - `Optional<List<Node>> nodes`

    The retrieved nodes from the composite retrieval.

    - `InnerNode node`

      - `String id`

        The ID of the retrieved node.

      - `Optional<Long> endCharIdx`

        The end character index of the retrieved node in the document

      - `String pipelineId`

        The ID of the pipeline this node was retrieved from.

      - `String retrieverId`

        The ID of the retriever this node was retrieved from.

      - `String retrieverPipelineName`

        The name of the retrieval pipeline this node was retrieved from.

      - `Optional<Long> startCharIdx`

        The start character index of the retrieved node in the document

      - `String text`

        The text of the retrieved node.

      - `Optional<Metadata> metadata`

        Metadata associated with the retrieved node.

    - `Optional<String> className`

    - `Optional<Double> score`

  - `Optional<List<PageFigureNodeWithScore>> pageFigureNodes`

    The page figure nodes retrieved by the pipeline for the given query.

    - `Node node`

      - `double confidence`

        The confidence of the figure

      - `String figureName`

        The name of the figure

      - `long figureSize`

        The size of the figure in bytes

      - `String fileId`

        The ID of the file that the figure was taken from

      - `long pageIndex`

        The index of the page for which the figure is taken (0-indexed)

      - `Optional<Boolean> isLikelyNoise`

        Whether the figure is likely to be noise

      - `Optional<Metadata> metadata`

        Metadata for the figure

    - `double score`

      The score of the figure node

    - `Optional<String> className`

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.retrievers.CompositeRetrievalResult;
import com.llamacloud_prod.api.models.retrievers.retriever.RetrieverSearchParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv();

        RetrieverSearchParams params = RetrieverSearchParams.builder()
            .retrieverId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .query("x")
            .build();
        CompositeRetrievalResult compositeRetrievalResult = client.retrievers().retriever().search(params);
    }
}
```

#### Response

```json
{
  "image_nodes": [
    {
      "node": {
        "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "image_size": 0,
        "page_index": 0,
        "metadata": {
          "foo": "bar"
        }
      },
      "score": 0,
      "class_name": "class_name"
    }
  ],
  "nodes": [
    {
      "node": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "end_char_idx": 0,
        "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "retriever_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "retriever_pipeline_name": "retriever_pipeline_name",
        "start_char_idx": 0,
        "text": "text",
        "metadata": {
          "foo": "bar"
        }
      },
      "class_name": "class_name",
      "score": 0
    }
  ],
  "page_figure_nodes": [
    {
      "node": {
        "confidence": 0,
        "figure_name": "figure_name",
        "figure_size": 0,
        "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "page_index": 0,
        "is_likely_noise": true,
        "metadata": {
          "foo": "bar"
        }
      },
      "score": 0,
      "class_name": "class_name"
    }
  ]
}
```
