# Voyage AI

> Create text, multimodal and contextual embeddings and rerank search results with Voyage AI's retrieval models.

App · 4 actions. Web page: https://docs.lodol.com/docs/integrations/voyage-ai

## Actions

### Create contextual embeddings

Embed the chunks of one document so that each chunk's vector also reflects the rest of the document. Finds the right chunk more often than embedding the chunks one by one.

**Inputs**

- Document chunks (`chunks`, list, required): The pieces of one document, in reading order, one entry each. Do not repeat text between pieces. With Input type set to Query, give a single entry.
- Input type (`input_type`, text): Optional. Use Document for text you will store and search through, and Query for the text a search starts from. Voyage AI adjusts the vector to match. One of: `document` (Document (text you will store and search through)), `query` (Query (the question you search with)), `none` (Not set). Default: `document`.
- Vector size (`output_dimension`, text): Optional. How many numbers each vector holds. Smaller vectors are cheaper to store, larger ones slightly more exact. Leave empty for the model's own size (1,024) unless your vector database needs another. Only some models can change it. One of: `256`, `512`, `1024`, `2048`.

**Outputs**

- `count` (number): How many vectors came back
- `dimension` (number): How many numbers each vector holds
- `embeddings` (list): One vector per text, in the order you sent them
- `model` (text): The model Voyage AI used
- `total_tokens` (number): Tokens Voyage AI counted for this request, which is what it bills

**Example output**

```json
{
  "count": 2,
  "dimension": 4,
  "embeddings": [
    {
      "embedding": [
        0.0132,
        -0.0267,
        0.0418,
        -0.0071
      ],
      "index": 0
    },
    {
      "embedding": [
        0.0132,
        -0.0267,
        0.0418,
        -0.0071
      ],
      "index": 1
    }
  ],
  "model": "voyage-context-3",
  "total_tokens": 24
}
```

### Create embeddings

Turn each text into a vector with a Voyage AI embedding model, ready to store in a vector database such as Pinecone and search by meaning. Takes up to 1,000 texts per step.

**Inputs**

- Texts (`texts`, list, required): The texts to embed, one entry each, for example the chunks of a document or the rows of a table.
- Model (`model`, text): Optional. Voyage 4 suits most uses; Large is the most accurate, Lite the fastest and cheapest. Code, Finance and Law models do better on those subjects. One of: `voyage-4` (Voyage 4 (default, balanced)), `voyage-4-large` (Voyage 4 Large (best quality)), `voyage-4-lite` (Voyage 4 Lite (fastest and cheapest)), `voyage-code-4` (Voyage Code 4 (source code)), `voyage-finance-2` (Voyage Finance 2 (finance)), `voyage-law-2` (Voyage Law 2 (legal)), `voyage-3.5` (Voyage 3.5), `voyage-3.5-lite` (Voyage 3.5 Lite), `voyage-3-large` (Voyage 3 Large), `voyage-code-3` (Voyage Code 3). Default: `voyage-4`.
- Input type (`input_type`, text): Optional. Use Document for text you will store and search through, and Query for the text a search starts from. Voyage AI adjusts the vector to match. One of: `document` (Document (text you will store and search through)), `query` (Query (the question you search with)), `none` (Not set). Default: `document`.
- Vector size (`output_dimension`, text): Optional. How many numbers each vector holds. Smaller vectors are cheaper to store, larger ones slightly more exact. Leave empty for the model's own size (1,024) unless your vector database needs another. Only some models can change it. One of: `256`, `512`, `1024`, `2048`.
- Shorten texts that are too long (`truncation`, true/false): Optional. When on, a text longer than the model can read is cut to fit. When off, the step fails instead. Default: `true`.

**Outputs**

- `count` (number): How many vectors came back
- `dimension` (number): How many numbers each vector holds
- `embeddings` (list): One vector per text, in the order you sent them
- `model` (text): The model Voyage AI used
- `total_tokens` (number): Tokens Voyage AI counted for this request, which is what it bills

**Example output**

```json
{
  "count": 2,
  "dimension": 4,
  "embeddings": [
    {
      "embedding": [
        0.0132,
        -0.0267,
        0.0418,
        -0.0071
      ],
      "index": 0
    },
    {
      "embedding": [
        0.0132,
        -0.0267,
        0.0418,
        -0.0071
      ],
      "index": 1
    }
  ],
  "model": "voyage-4",
  "total_tokens": 14
}
```

### Create multimodal embedding

Turn a text, an image, or the two together into one vector, so pictures and words can be searched in the same index.

**Inputs**

- Text (`text`, text): Optional. Words to embed. Give this, an image, or both.
- Image URL (`image_url`, text): Optional. The web address of a PNG, JPEG, WebP or GIF image, for example 'https://example.com/photo.jpg'. The address must be public.
- Model (`model`, text): Optional. Voyage Multimodal 3.5 is the newest. One of: `voyage-multimodal-3.5` (Voyage Multimodal 3.5 (default)), `voyage-multimodal-3` (Voyage Multimodal 3). Default: `voyage-multimodal-3.5`.
- Input type (`input_type`, text): Optional. Use Document for text you will store and search through, and Query for the text a search starts from. Voyage AI adjusts the vector to match. One of: `document` (Document (text you will store and search through)), `query` (Query (the question you search with)), `none` (Not set). Default: `document`.

**Outputs**

- `dimension` (number): How many numbers the vector holds
- `embedding` (list): The vector: a list of numbers
- `image_pixels` (number): Pixels counted for the image
- `model` (text): The model Voyage AI used
- `text_tokens` (number): Tokens counted for the text
- `total_tokens` (number): Tokens Voyage AI counted for this request, which is what it bills

**Example output**

```json
{
  "dimension": 4,
  "embedding": [
    0.0132,
    -0.0267,
    0.0418,
    -0.0071
  ],
  "image_pixels": 17920,
  "model": "voyage-multimodal-3.5",
  "text_tokens": 4,
  "total_tokens": 36
}
```

### Rerank documents

Put a list of documents in order of how well each answers a query, with a score for each. Use it to pick the best matches out of search or database results.

**Inputs**

- Query (`query`, text, required): The question or search to rank the documents against.
- Documents (`documents`, list, required): The texts to put in order, one entry each. Up to 1,000.
- Model (`model`, text): Optional. The Lite models are faster and cheaper; the others rank more accurately. One of: `rerank-2.5` (Rerank 2.5 (default)), `rerank-2.5-lite` (Rerank 2.5 Lite (faster)), `rerank-3` (Rerank 3), `rerank-3-lite` (Rerank 3 Lite), `rerank-2` (Rerank 2), `rerank-2-lite` (Rerank 2 Lite). Default: `rerank-2.5`.
- Best matches to return (`top_k`, number): Optional. Return only this many documents, best first. Leave empty to get them all. At least 1.
- Shorten texts that are too long (`truncation`, true/false): Optional. When on, a text longer than the model can read is cut to fit. When off, the step fails instead. Default: `true`.

**Outputs**

- `count` (number): How many documents came back
- `model` (text): The model Voyage AI used
- `results` (list): Documents from most to least relevant
- `top_document` (text): The most relevant document, for convenience
- `total_tokens` (number): Tokens Voyage AI counted for this request, which is what it bills

**Example output**

```json
{
  "count": 2,
  "model": "rerank-2.5",
  "results": [
    {
      "document": "Voyage AI makes embedding models for search.",
      "index": 1,
      "relevance_score": 0.8984375
    },
    {
      "document": "The weather is mild in spring.",
      "index": 0,
      "relevance_score": 0.1171875
    }
  ],
  "top_document": "Voyage AI makes embedding models for search.",
  "total_tokens": 31
}
```
