# LocalAI Embeddings

## Configuración de LocalAI

[**LocalAI** ](https://github.com/go-skynet/LocalAI)es un reemplazo directo de REST API que es compatible con las especificaciones de OpenAI API para inferencia local. Te permite ejecutar LLMs (y no solo eso) localmente o en las instalaciones con hardware de grado consumidor, soportando múltiples familias de modelos que son compatibles con el formato ggml.

Para usar LocalAI Embeddings dentro de Flowise, sigue los pasos a continuación:

1. ```bash
   git clone https://github.com/go-skynet/LocalAI
   ```
2. <pre class="language-bash"><code class="lang-bash"><strong>cd LocalAI
   </strong></code></pre>
3. LocalAI proporciona un [endpoint de API](https://localai.io/api-endpoints/index.html#applying-a-model---modelsapply) para descargar/instalar el modelo. En este ejemplo, vamos a usar el modelo BERT Embeddings:

<figure><img src="/files/1FnNOgKOHNw47CEybTac" alt=""><figcaption></figcaption></figure>

4. En la carpeta `/models`, deberías poder ver el modelo descargado:

<figure><img src="/files/3S5luIrKwSZGKsgLx1wS" alt=""><figcaption></figcaption></figure>

5. Ahora puedes probar los embeddings:

```bash
curl http://localhost:8080/v1/embeddings -H "Content-Type: application/json" -d '{
    "input": "Test",
    "model": "text-embedding-ada-002"
  }'
```

6. La respuesta debería verse así:

<figure><img src="/files/v46OhSyGYfv8KpQQOdxX" alt="" width="375"><figcaption></figcaption></figure>

## Configuración de Flowise

Arrastra y suelta un nuevo componente LocalAIEmbeddings al lienzo:

<figure><img src="/files/UfWhqbKnZZEInCf3hiZv" alt=""><figcaption></figcaption></figure>

Completa los campos:

* **Base Path**: La URL base de LocalAI, por ejemplo <http://localhost:8080/v1>
* **Model Name**: El modelo que quieres usar. Ten en cuenta que debe estar dentro de la carpeta `/models` del directorio de LocalAI. Por ejemplo: `text-embedding-ada-002`

¡Eso es todo! Para más información, consulta la [documentación](https://localai.io/models/index.html#embeddings-bert) de LocalAI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowiseai.com/espanol/documentacion-oficial/integraciones/langchain/embeddings/localai-embeddings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
