# LocalAI

> Run chat, text generation and embeddings on a LocalAI server you control.

App · 6 actions. Web page: https://docs.lodol.com/docs/integrations/localai

## Actions

### Chat with a model

Send messages to a model and get a text reply.

**Inputs**

- Model (`model`, text, required): The installed model to use.
- Messages (`messages`, list, required): Messages in conversation order, each with a role and text.
- Temperature (`temperature`, number): How much variation to allow. From 0 to 2.
- Max Tokens (`max_tokens`, number): The maximum response length in tokens. At least 1.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {
    "choices": [
      {
        "index": 1,
        "message": {
          "content": "example",
          "role": "example"
        },
        "text": "example"
      }
    ],
    "id": "example",
    "model": "example",
    "usage": {
      "completion_tokens": 1,
      "prompt_tokens": 1,
      "total_tokens": 1
    }
  }
}
```

### Create embeddings

Turn a list of text strings into vectors using an embedding model.

**Inputs**

- Model (`model`, text, required): The installed model to use.
- Input (`input`, list, required): The text values to encode as vectors.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "embedding": [
          1
        ],
        "index": 1
      }
    ],
    "model": "example"
  }
}
```

### Generate text

Complete a text prompt using an installed model.

**Inputs**

- Model (`model`, text, required): The installed model to use.
- Prompt (`prompt`, text, required): The text to continue.
- Max Tokens (`max_tokens`, number): The maximum response length in tokens. At least 1.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {
    "choices": [
      {
        "index": 1,
        "message": {
          "content": "example",
          "role": "example"
        },
        "text": "example"
      }
    ],
    "id": "example",
    "model": "example",
    "usage": {
      "completion_tokens": 1,
      "prompt_tokens": 1,
      "total_tokens": 1
    }
  }
}
```

### Get model configuration metadata

Read descriptions of supported model configuration fields.

**Inputs**: None.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {}
}
```

### List installed models

Read the model IDs available on your LocalAI server.

**Inputs**: None.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "id": "example",
        "object": "example"
      }
    ],
    "object": "example"
  }
}
```

### List model capabilities

Read which tasks the installed models can handle.

**Inputs**: None.

**Outputs**

- `data` (object): The response from LocalAI.

**Example output**

```json
{
  "data": {}
}
```
