LocalAI

App · 6 actions

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

Actions

ActionWhat it does
Chat with a modelSend messages to a model and get a text reply.
Create embeddingsTurn a list of text strings into vectors using an embedding model.
Generate textComplete a text prompt using an installed model.
Get model configuration metadataRead descriptions of supported model configuration fields.
List installed modelsRead the model IDs available on your LocalAI server.
List model capabilitiesRead which tasks the installed models can handle.

Chat with a model

Send messages to a model and get a text reply.

Inputs

ModelmodeltextRequired
The installed model to use.
MessagesmessageslistRequired
Messages in conversation order, each with a role and text.
Temperaturetemperaturenumber
How much variation to allow.From 0 to 2.
Max Tokensmax_tokensnumber
The maximum response length in tokens.At least 1.

Outputs

dataobject
The response from LocalAI.
Example output
{
  "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

ModelmodeltextRequired
The installed model to use.
InputinputlistRequired
The text values to encode as vectors.

Outputs

dataobject
The response from LocalAI.
Example output
{
  "data": {
    "data": [
      {
        "embedding": [
          1
        ],
        "index": 1
      }
    ],
    "model": "example"
  }
}

Generate text

Complete a text prompt using an installed model.

Inputs

ModelmodeltextRequired
The installed model to use.
PromptprompttextRequired
The text to continue.
Max Tokensmax_tokensnumber
The maximum response length in tokens.At least 1.

Outputs

dataobject
The response from LocalAI.
Example output
{
  "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

dataobject
The response from LocalAI.
Example output
{
  "data": {}
}

List installed models

Read the model IDs available on your LocalAI server.

Inputs

None.

Outputs

dataobject
The response from LocalAI.
Example output
{
  "data": {
    "data": [
      {
        "id": "example",
        "object": "example"
      }
    ],
    "object": "example"
  }
}

List model capabilities

Read which tasks the installed models can handle.

Inputs

None.

Outputs

dataobject
The response from LocalAI.
Example output
{
  "data": {}
}

On this page