API version: 0.3.0

---

# `cron:calculate-embeddings`

Calculates the vectors of [embeddings](/reference/schemas/types/vector.md#embeddings) for elements whose text changed.

Takes no arguments or options. Writes of elements which change the text of an embedding queue the element internally;
this command drains that queue: it evaluates the texts of the queued elements, sends them to the
[embedding providers](/reference/configuration.md#embedding-providers), several in one request where the provider
supports it, and writes the vectors. Requests to different providers run at the same time, up to `concurrency`
requests per provider. Elements which were changed again in the meantime keep their vector until their next turn,
elements which were deleted are skipped.

Failing sources are logged and change nothing. Failing providers are retried with the next runs, up to three times.
If a provider limits the rate of requests (`429 Too Many Requests`), it gets no further requests in this run, and its
elements wait for the next run; the other providers continue. Requests are not started after the working time of the
run, their elements also wait for the next run.

> **ℹ Info**
>
> Every API instance already schedules this every 5 minutes (see
> [Background tasks](/reference/configuration.md#background-tasks)), so it does not need to be invoked manually.

## Help

```bash
php bin/console cron:calculate-embeddings --help
```

```text
Description:
  Calculates the vectors of embeddings, for elements whose texts changed.

Usage:
  cron:calculate-embeddings

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "prod"]
      --no-debug        Switch off debug mode.
      --profile         Enables profiling (requires debug).
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

## Example

```bash
php bin/console cron:calculate-embeddings
```

```text
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Cron

  Calculating embeddings of changed elements...

▶ Processed 0 queued element(s).
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [cache:clear:etag](/command/cache-clear-etag.md)

Next: [cron:delete-expired-uploads](/command/cron-delete-expired-uploads.md)
