Alli LLM App Market API

このドキュメントでは、Alli LLM App Market で利用できる REST API に関する詳細情報を提供しています。現在提供しているのは、LLM アプリを取得して実行するための API のみですが、将来的にはさらに多くの API が追加される予定です。

全てのアカウントがAlli LLM App Marketを利用できるわけではありません。 当社のAlli LLM App Marketにご興味がございましたら、弊社Customer Success担当までお問い合わせください。

APIキーの取得

RequestヘッダーのAPI-KEY に、割り当てられたREST APIキー を入力してください。REST APIキーはプロジェクト設定メニューからご確認いただけます。

エラーメッセージ

想定されるresponseがない場合は、エラーメッセージを確認してください。例えば、間違ったHTTPメソッドを使用した場合、以下のような形式のエラーメッセージが戻ります。

{“error”: “Method Not Allowed POST: /webapi/apps”}

例えば、LLMアプリを実行する際にインプットを含めないと、以下のようなエラーメッセージが戻ります。

{"errors": "internal error. Expecting value: line 1 column 1 (char 0)"}

GET https://backend-ja.alli.ai/webapi/apps

LLM App List Search APIを使用すると、プロジェクト内のすべての回答型アプリと会話型アプリを表示できます。

Path Parameters

NameTypeDescription

API-KEY*

string

割り当てられたAPIキーです。プロジェクト設定メニュー>一般タブから確認できます。

published

boolean

公開されているアプリのみを表示するかどうかを選択します。 デフォルトではすべてのアプリが表示されます。

Headers

NameTypeDescription

id

string

LLMアプリのIDになります。

name

string

LLMアプリの名称になります。

type

string

LLMアプリのタイプになります。(skill,single_action)

description

string

LLMアプリの説明文になります。

category

string

LLMアプリのカテゴリーになります。(全般、セールス…)

appFrom

string

LLMアプリのソースになります。(first_part, second_part)

appUrl

string

LLMアプリにアクセス可能なURLになります。

inputs

string

SingleActionのLLMアプリのインプットの値になります。(SingleActionのみとなります。)

Request Example

REST_API_KEYをプロジェクトのREST APIキーに変更しなければなりません。APIキーの取得の項目をご参照ください。

curl -vv -X GET \
  'https://backend-ja.alli.ai/webapi/apps' \
  --header 'API-KEY: REST_API_KEY'

Response Example

{
  "result": [
    {
      "id": "TExNQXBwOjY1NzAyNGQ5ZWI4YjUzNGY3MjA0NjdjOA==",
      "name": "New single action (1)",
      "type": "single_action",
      "description": "テスト",
      "category": "全般",
      "appFrom": "second_party",
      "appUrl": "http://localhost:8080/singleAction/YU9DasNkV+MCfzxjk9yg3XXHAs4dW9o9xV7G42K-L+UvlQIxxG-+kDfLpjp0jA6+H0QbNcBd8-2RFylqalUbAcv6lF88X8-1px956jaq3pAS1hgwPkP1MJPliKjXqMfXQY3KMBXguSAdSQbd+WFACQiRNNH7nzBtHws37X7795I=?region=ALLI_US",
      "inputs": [
        {
          "name": "テスト",
          "inputType": "document_basic",
          "value": "test",
          "options": []
        },
        {
          "name": "テスト2",
          "inputType": "text",
          "value": "test2",
          "options": []
        }
      ]
    },
    {
      "id": "TExNQXBwOjY1OTc5ZjliNGM2Y2RiMzNiNmJmNzAzZA==",
      "name": "New single action (3)",
      "type": "single_action",
      "description": null,
      "category": "その他",
      "appFrom": "second_party",
      "appUrl": "http://localhost:8080/singleAction/tfjckyW65--agr7b32-gvaE4+ZXrRnKYRH2QJt4d7mV270WI-NMBzzPssdb+Yz7Ulx1gLiZPOhsH-2yVA55GpBHDj3d0n0zJb4XfaDqC6VoYzTgWGUauY7qbEpe2IP4qT8Msx+6i7RGF2uLE41rRBLscMWYBC6NSZWLMQFYzdi4=?region=ALLI_US",
      "inputs": [
        {
          "name": "single",
          "inputType": "text",
          "value": "single",
          "options": []
        }
      ]
    },
    {
      "id": "TExNQXBwOjY1NmVkMzg5Y2Y4YjZiZTMyOTVlOWFlYQ==",
      "name": "New Skill",
      "type": "skill",
      "description": null,
      "category": "その他",
      "appFrom": "second_party",
      "appUrl": "https://dev-sdk.alli.ai/local/latest/popup.html?campaign_token=OzpxHAuBPAFpL4KOCpn39zngAILCdIeRQjYiYB3nbix5TTVtOfuKzrhPG8z98-VX6O6qZX5xTRVTBM8jjmADz2MR-MZOqg5Xp7kLdFe98kGZjVFMqdhy0KexoTxPlK28ocKdVG9LH2AIeh69Lk2hS6pgmbJp0vS3MBYIe2BBPmc%3D",
      "inputs": []
    },
    {
      "id": "TExNQXBwOjY1OTc5ZjlmNGM2Y2RiMzNiNmJmNzJjNA==",
      "name": "New Skill (1)",
      "type": "skill",
      "description": "test",
      "category": "全般",
      "appFrom": "second_party",
      "appUrl": "https://dev-sdk.alli.ai/local/latest/popup.html?campaign_token=gGnKYYh4M8t4V8mu1trRkGegE-Dc7cslBp6VUH8j1b24dY7wvSKmzGC-y0ZL%2BgVTcY1twVS9Bi9aYujbCnrYkNs6c4YONoWPvakQOjychQwkrCsK42FAn6BH%2BaU0DkNsMoZ61WTQwn1D-9X4QaSQmP%2BWdyoirx%2BTLcMN66CCSzo%3D",
      "inputs": []
    }
  ]
}

Run LLM App

POST https://backend-ja.alli.ai/webapi/apps/:app_id/run

Run LLM App API を使用すると、対象のSingle actionアプリまたはConversationアプリを実行できます。

Headers

NameTypeDescription

API-KEY*

string

割り当てられたAPIキーです。プロジェクト設定メニュー>一般タブから確認できます。

app_id

string

LLMアプリのIDを指定します。(GET https://{host}/webapi/appsで確認できます。)

Request Body

NameTypeDescription

inputs

json

Single actionアプリまたはConversationアプリで使用するためのインプットです。

Single actionアプリ:Single actionアプリで使用される変数のみが使用可能です。

Conversationアプリ:Conversationアプリで使用される変数のみが使用可能です。

{"input1":["item1","item2"], "input2": 965}

mode

string

データをsyncかstreamのどちらで出力するか設定します。(Default = sync)

streamモードの場合、syncと同じ出力形式のjson文字列がstreamとして出力されます。

id

string

LLMアプリのIDになります。

name

string

LLMアプリの名称になります。

type

string

LLMアプリのタイプになります。(skill,single_action)

description

string

LLMアプリの説明文になります。

category

string

LLMアプリのカテゴリになります。

responses(list) id

string

single action または chat id

responses(list) type

string

generator, send_email, llm, …

responses(list) messsage

string

LLMアプリの実行結果の値になります。

error

string

エラーがある場合に返される値です。

Response Example

{
  "result": {
    "id": "TExNQXBwOjY1OTc5ZjliNGM2Y2RiMzNiNmJmNzAzZA==",
    "name": "New single action (3)",
    "type": "single_action",
    "category": "全般",
    "responses": [
      {
        "id": "U2luZ2xlQWN0aW9uOjY1YzFjZjA4MjdmNTY5ZDIxNDI0ODU5Nw==",
        "type": "llm",
        "message": "医療知識とは、人間の健康や病気に関する知識を意味します。医療知識は医学的な知識だけでなく、健康に関する様々な情報を含み、病気の予防、診断、治療、回復などに関する知識を含みます。このような知識は、専門家である医師、看護師、薬剤師だけでなく、個人も持つべき重要な知識であり、健康的な生活を維持するために不可欠です。医療知識を通じて自分の健康を管理し、病気を予防することができ、必要に応じて医療専門家と協力して適切な治療を受けることができます。"
      }
    ]
  }
}

実際の使用例

REST_API_KEYをプロジェクトのREST APIキーに変更しなければなりません。APIキーの取得の項目をご参照ください。

LLMアプリのIDを取得

curl -vv -X GET \
  'https://backend-ja.alli.ai/webapi/apps' \
  --header 'API-KEY: REST_API_KEY'

Response Example(下記のidはrun API呼び出し時に使用します)

{
  "result": [
    {
      "id": "TExNQXBwOjY1NWVlYTU1OTZlOWM1MjI4MDY2YjlhOQ==",
      "name": "LLM App用 Skill",
      "type": "skill",
      "description": "LLM App用のSkillです.",
      "category": "全般",
      "appFrom": "second_party"
    },
    {
      "id": "TExNQXBwOjY1NWVlOTI3NzcyOGQxZTE1ZmI0OGRjNQ==",
      "name": "Sample Skill",
      "type": "skill",
      "description": "desc",
      "category": "その他",
      "appFrom": "second_party"
    },
    {
      "id": "TExNQXBwOjY1NWVlYTMzY2IzMzQ1OTVkZjQwNzdhZg==",
      "name": "test sample",
      "type": "single_action",
      "description": "test sampleです。",
      "category": "全般",
      "appFrom": "second_party"
    }
  ]
}

Single Action Request Example

REST_API_KEYをプロジェクトのREST APIキーに変更しなければなりません。APIキーの取得の項目をご参照ください。

curl -vv -X POST \
  'https://backend-ja.alli.ai/webapi/apps/TExNQXBwOjY1NWVlYTMzY2IzMzQ1OTVkZjQwNzdhZg==/run' \
  --header 'Accept: */*' \
  --header 'API-KEY: REST_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{"inputs":{"input": "The Little Prince has sold approximately 140 million copies worldwide, making it one of the best-selling and most translated books ever published. To date, it has been translated into 301 languages and dialects. It was the first novel to be published in the United States. The story of the novel is interesting: Saint-Exupéry was in New York City, and while having dinner with his American publisher, Eugene Reynal, he doodled a child on a napkin. When Eugene Reynal saw the drawing, he suggested to Saint-Maximilien that it would be a good idea to write a children's book about the child before Christmas. (It is said that Eugène Reynal suggested it to relieve his stress.) The basic sketch of the Little Prince was based on a statue of the baby Jesus in Prague, Czech Republic. The narrator, a pilot, was also inspired by visions Saint-Exupéry himself experienced when he and his co-pilot crash-landed in the Sahara Desert in 1935 and were stranded for five days without a drop of water."}}'

Single Action Response Example

{
  "result": {
    "id": "TExNQXBwOjY1OTc5ZjliNGM2Y2RiMzNiNmJmNzAzZA==",
    "name": "New single action (3)",
    "type": "single_action",
    "category": "全般",
    "responses": [
      {
        "id": "U2luZ2xlQWN0aW9uOjY1YzFjZjA4MjdmNTY5ZDIxNDI0ODU5Nw==",
        "type": "llm",
        "message": "The Little Prince is one of the world's best-selling books, with over 140 million copies sold, and has been translated into 301 languages. The novel was first published in the United States, at the suggestion of publisher Eugene Reynal. The basic sketch of The Little Prince was inspired by the statue of the Baby Jesus in Prague, Czech Republic, and the pilot was inspired by Saint-Exupéry's own experiences in the Sahara Desert."
      }
    ]
  }
}

Conversational/Skill Request Example

現在、アプリの実行中にユーザーの操作を必要とするConversationアプリ (ユーザーに選択を求める、メッセージの入力を求めるなど) は、Run LLM App API ではサポートされていません。 (ただし、以下の例のように、ドキュメントのアップロード後に LLMノードを起動する場合は例外です)。 REST_API_KEYをプロジェクトのREST APIキーに変更しなければなりません。APIキーの取得の項目をご参照ください。

curl -vv -F 'file=@"/Users/jay/Downloads/test.txt"' \
-F 'footerUrl="www.allganize.ai"' \
-F 'footerTitle="Allganize website"' \
-F 'followFolderPermission=false' \
-F 'agentViewer="[\"jyp_test@allganize.ai\"]"' \
-H 'API-KEY: REST_API_KEY' https://backend-ja.alli.ai/webapi/upload_file

Conversational/Skill Response Example

{
  "result": {
    "id": "S25vd2xlZGdlQmFzZTo2NTVlZjAzNmMxYzFmMDFiYmNmYjYxMWM=",
    "fileName": "test.txt",
    "hashtags": [],
    "footer": "{\"blocks\": [{\"key\": \"xx9l\", \"text\": \"— From Allganize website\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [{\"offset\": 7, \"length\": 17, \"key\": 0}], \"data\": {}}], \"entityMap\": {\"0\": {\"type\": \"LINK\", \"mutability\": \"MUTABLE\", \"data\": {\"url\": \"www.allganize.ai\"}}}}",
    "folder": null,
    "agentEditor": [],
    "agentViewer": [
      "jyp_test@allganize.ai"
    ],
    "userViewer": {
      "variables": {}
    },
    "allowOtherAgentsView": true,
    "allowOtherUsersView": true,
    "properties": {}
  }
}

Run LLM Appの実行

REST_API_KEYをプロジェクトのREST APIキーに変更しなければなりません。APIキーの取得の項目をご参照ください。

curl -vv -X POST \
'https://backend-ja.alli.ai/webapi/apps/TExNQXBwOjY1NWVlYTU1OTZlOWM1MjI4MDY2YjlhOQ==/run' \
--header 'Accept: */*' \
--header 'API-KEY: REST_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"inputs":{"usertest": ["S25vd2xlZGdlQmFzZTo2NTVlZjAzNmMxYzFmMDFiYmNmYjYxMWM="]}, "mode":"sync"}'

Response Example

{
  "result": {
    "id": "TExNQXBwOjY1NWVlYTU1OTZlOWM1MjI4MDY2YjlhOQ==",
    "name": "LLM App用Skill",
    "type": "skill",
    "category": "全般",
    "responses": [
      {
        "id": "Q2hhdDo2NTVlZjFhMGJiOWRkZjBhMWVkMzViNTE=",
        "type": "llm",
        "message": "{\"blocks\": [{\"key\": \"jeno\", \"type\": \"unstyled\", \"text\": \"A girl who loses her mother, is called ash and abused by her family, but finds solace in the tree she plants on her mother's grave.\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}], \"entityMap\": {}}"
      }
    ]
  }
}

Error Message

想定したresponseが届かない場合は、以下のエラーメッセージをご確認ください。

Status CodeError CodeNameMessageDescription

500

7000

API Error

Something went wrong

以下のエラーには該当しない、API処理の失敗した場合

403

7001

Invalid API Key

API-KEY is not valid

API-KEYが無効な場合

403

7002

Invalid JSON

Cannot decode tuen requested JSON body

リクエストされたjsonをデコードできない場合

400

7003

Invalid Parameter

Requested parameters are not valid. 'text' is empty.

リクエストされたパラメータが間違っている場合

403

7004

Payment error

billing error.

支払いに関する一般的なエラー(例:利用料の支払いが確認できず、環境が利用できない場合など)

403

-

Wrong HTTP Method

-

無効なHTTPメソッドの場合

Error Response example

{
    "type": "APIError",
    "code": 7000,
    "message": "Something went wrong."
}

最終更新