Generative AI Cloud (SaaS) API (1.0)

Download OpenAPI specification:

一般対話API

指定されたチャット会話に対する、LLMからの応答を作成し返却するAPI。また会話の履歴を保持し、過去の会話履歴を考慮した対話が可能。historyIdを指定することで複数の履歴を保持することができる。また、システム連携向けに会話の履歴を使用・保存しない単発の会話の指定も可能(oneshotオプション)。テンプレート対話、検索対話からの履歴を含めた対話にも対応する。

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
userContent
required
string (userContent)

ユーザプロンプトのContent文字列

systemContent
string (systemContent)

システムプロンプトのContent文字列。systemTemplateIdと両方指定されている場合、systemContentの値が優先される。

historyId
required
string (historyId)

参照する履歴ID。指定が「new」場合は新しい会話履歴とする。oneshotがtrueの場合のみ指定不要。履歴IDを指定する場合はuuidかhistory_uuidである必要がある

oneshot
boolean (oneshot)
Default: false

trueを指定することで履歴を使用せず単発での対話が可能(履歴にも保存されません)

model
required
string (model)

LLMのモデル名

stream
boolean (stream)
Default: false

LLMの応答をstreaming形式で返却するかどうか

streamNum
integer (streamNum)
Default: 10

streamingがtrueの場合に何文字単位で返却するかを指定(範囲1-1000)

maxTokens
integer (maxTokens)
Default: 2048

LLMのトークンの最大値(範囲:1~8192)

temperature
number (temperature)
Default: 1

LLMのランダム性パラメータ。0に近いほど最も確率が高い回答が選ばれる。o3、o4-miniを指定した場合は1.0が固定で入力される。

Responses

Request samples

Content type
application/json
{
  • "userContent": "こんにちは",
  • "systemContent": "あなたはAIアシスタントです",
  • "historyId": "new",
  • "oneshot": false,
  • "model": "cotomi-v3.0",
  • "stream": false,
  • "streamNum": 1,
  • "maxTokens": 2048,
  • "temperature": 1
}

Response samples

Content type
application/json
{
  • "answer": "こんにちは、何かお手伝いすることはありますか?",
  • "historyId": "history_12345678-90ab-cdef-ghij-zzz"
}

検索対話API

事前に登録された文書に対するRAGを行うAPI。履歴機能には対応しない(履歴IDは新規採番のみ対応(履歴を使いたい場合は一般対話を利用する)。既定は履歴は採番しない)

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
userContent
required
string (userContent)

ユーザプロンプトのContent文字列(検索したい内容を記載)

templateId
string (templateId)
Default: "search"

検索用テンプレートID。指定しない場合は既定値を使用する

vectorIndex
required
string (vectorIndex)

ベクトルストアのIndex名を指定する。 vectorIndex、vectorIndexesのどちらかを指定する。

vectorIndexes
required
Array of strings (vectorIndexes)

複数のベクトルストアのIndex名を指定する場合は配列で指定する。vectorIndex、vectorIndexesのどちらかを指定する。

object (searchOption)

ベクトル検索のオプションをJson形式で必要に応じて複数記載する。

oneshot
boolean (oneshot)
Default: true

trueを指定することで履歴を使用せず単発での対話が可能(履歴にも保存されません)。falseを指定すると、履歴IDが採番され、一般対話で会話を継続することができます。

model
required
string (model)

LLMのモデル名

stream
boolean (stream)
Default: false

LLMの応答をstreaming形式で返却するかどうか

streamNum
integer (streamNum)
Default: 10

streamingがtrueの場合に何文字単位で返却するかを指定(範囲1-1000)

maxTokens
integer (maxTokens)
Default: 2048

LLMのトークンの最大値

temperature
number (temperature)
Default: 1

LLMのランダム性パラメータ。0に近いほど最も確率が高い回答が選ばれる。o3、o4-miniを指定した場合は1.0が固定で入力される。

Responses

Request samples

Content type
application/json
{
  • "userContent": "こんにちは",
  • "templateId": "search",
  • "vectorIndex": "test-index",
  • "vectorIndexes": [
    ],
  • "searchOption": {
    },
  • "oneshot": true,
  • "model": "cotomi-v3.0",
  • "stream": false,
  • "streamNum": 1,
  • "maxTokens": 2048,
  • "temperature": 1
}

Response samples

Content type
application/json
{
  • "answer": "Generative AI APIサービスは...",
  • "historyId": "history_12345678-90ab-cdef-ghij-zzz",
  • "sourceDocuments": [
    ]
}

テンプレート対話API

テンプレートプロンプトに任意のパラメータを埋め込み、パラメータを置換することでLLMと対話するAPI。

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
userContent
required
string (userContent)

置換する文字列を指定

templateId
required
string (templateId)

テンプレートID。Generative AI API管理ポータルのテンプレート画面から使用したいテンプレートのIDをコピーして指定してください。

oneshot
boolean (oneshot)
Default: true

trueを指定することで履歴を使用せず単発での対話が可能(履歴にも保存されません)。falseを指定すると、履歴IDが採番され、一般対話で会話を継続することができます。

model
required
string (model)

LLMのモデル名

stream
boolean (stream)
Default: false

LLMの応答をstreaming形式で返却するかどうか

streamNum
integer (streamNum)
Default: 10

streamingがtrueの場合に何文字単位で返却するかを指定(範囲1-1000)

maxTokens
integer (maxTokens)
Default: 2048

LLMのトークンの最大値

temperature
number (temperature)
Default: 1

LLMのランダム性パラメータ。0に近いほど最も確率が高い回答が選ばれる。o3、o4-miniを指定した場合は1.0が固定で入力される。

Responses

Request samples

Content type
application/json
{
  • "userContent": "私は学生です",
  • "templateId": "summary",
  • "oneshot": true,
  • "model": "cotomi-v3.0",
  • "stream": true,
  • "streamNum": 3,
  • "maxTokens": 2048,
  • "temperature": 1
}

Response samples

Content type
application/json
{
  • "answer": "こんにちは、何かお手伝いすることはありますか?",
  • "historyId": "history_12345678-90ab-cdef-ghij-zzz"
}

拡張対話API

一般対話APIに添付ファイル・Webコンテンツ(URL)・Web検索の内容に対する対話を実施する機能を追加。(以降、添付ファイルに対する対話を「ファイル添付機能」、Webコンテンツに対する対話を「Webコンテンツ機能」、Web検索に対する対話を「Web検索機能」と記載)

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
userContent
required
string (userContent)

ユーザプロンプトのContent文字列。空文字、空白(半角、全角)のみは許容しない

systemContent
string (systemContent)

システムプロンプトのContent文字列。systemTemplateIdと両方指定されている場合、systemContentの値が優先される。

historyId
string (historyId)

参照する履歴ID。指定が「new」場合は新しい会話履歴とする。oneshotがtrueの場合のみ指定不要。履歴IDを指定する場合はuuidかhistory_uuidである必要がある。

oneshot
boolean (oneshot)
Default: false

trueを指定することで履歴を使用せず単発での対話が可能(履歴にも保存されません)。

model
required
string (model)

LLMのモデル名。空文字、空白(半角、全角)のみは許容しない

stream
boolean (stream)
Default: false

LLMの応答をstreaming形式で返却するかどうか

streamNum
integer (streamNum)
Default: 10

streamingがtrueの場合に何文字単位で返却するかを指定(範囲1-1000)

maxTokens
integer (maxTokens)
Default: 2048

LLMのトークンの最大値

temperature
number (temperature)
Default: 1

LLMのランダム性パラメータ。0に近いほど最も確率が高い回答が選ばれる。o3、o4-miniを指定した場合は1.0が固定で入力される。

addContent
object (addContent)

addContentsに移行するにあたり、非推奨。valueに指定するキーの定義は addContents と同様

Array of objects (addContents)

ファイル添付機能、Webコンテンツ機能、Web検索機能を用いる場合指定する。

ファイル添付機能、Web検索機能を用いる場合は1つの値のみ指定可能。

Webコンテンツ機能を用いる場合は複数の値を指定可能。

addContentとaddContentsの両方がリクエストパラメータに含まれていた場合、addContentsの値が優先される。

Responses

Request samples

Content type
application/json
{
  • "userContent": "要約してください",
  • "systemContent": "あなたはAIアシスタントです",
  • "historyId": "new",
  • "oneshot": false,
  • "model": "cotomi-v3.0",
  • "stream": true,
  • "streamNum": 1,
  • "maxTokens": 2048,
  • "temperature": 1,
  • "addContent": { },
  • "addContents": [
    ]
}

Response samples

Content type
application/json
{
  • "answer": "Generative AI APIサービスは...",
  • "historyId": "history_12345678-90ab-cdef-ghij-zzz",
  • "sourceDocuments": [
    ]
}

ユーザの履歴一覧を取得

ユーザID、ユーザID×機能単位での履歴の一覧を取得する。あくまでも一覧情報のみの取得であり、会話履歴の具体的な内容は履歴取得で行う。

ユーザIDはHTTPヘッダー(x-nec-genai-client-id)が必須。ユーザIDに紐づいた履歴を取得する。

タイトルは初回対話時のuserContentの先頭数文字を設定する

Authorizations:
bearerAuth
path Parameters
maxnum
required
integer

最大取得件数(範囲:1~100)

header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Responses

Response samples

Content type
application/json
{
  • "historyList": [
    ]
}

一連の会話履歴の内容を取得

一連の会話履歴の内容の取得を行う。全ての会話履歴を取得するわけではなく、履歴単位(historyId)での取得に対応する。返却する会話履歴は古いの物から順に返却する。

ユーザIDはHTTPヘッダー(x-nec-genai-client-id)が必須。履歴作成時のユーザ以外は取得できないように制限する。

存在しない履歴を指定した場合はエラー

Authorizations:
bearerAuth
path Parameters
historyId
required
string

履歴ID(uuidかhistory_uuidでなければエラー)

maxnum
required
integer

最大取得件数(範囲:1-100)

header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Responses

Response samples

Content type
application/json
{
  • "contents": [
    ]
}

一連の会話履歴を更新

一連の会話履歴の更新を行う。現在対応しているのはタイトルのみ。

ユーザIDはHTTPヘッダー(x-nec-genai-client-id)が必須。ユーザIDに紐づいた履歴を更新する。

存在しない履歴を指定した場合もエラーにしない

Authorizations:
bearerAuth
path Parameters
historyId
required
string

履歴ID(uuidかhistory_uuidでなければエラー)

header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
title
required
string (title)

会話のタイトル

Responses

Request samples

Content type
application/json
{
  • "title": "更新後のタイトル"
}

Response samples

Content type
application/json
{
  • "historyId": "history_12345678-90ab-cdef-ghij-zzz",
  • "count": 10
}

履歴削除

履歴削除を行う。履歴単位(historyId)での削除に対応する。ユーザIDに紐づいた履歴を削除する。

Authorizations:
bearerAuth
path Parameters
historyId
required
string

履歴ID(uuidかhistory_uuidでなければエラー)

header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-client-id
required
string

APIの使用者を特定するためのID。呼び出し元側でユーザIDなど一意なIDを指定する必要がある(UUID 4推奨)。API側では会話履歴などのリソースへのアクセス制御などに使用される

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Responses

回答根拠確認API

要約、検索対話の回答データをもとに回答根拠の情報を付与するなど、汎用的な用途に使用可能な回答根拠確認API。

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
threshold
number (threshold)
Default: 0.85

返却する回答根拠の閾値(0-1)。既定は0.85。閾値を下回る回答根拠の結果は返却しない。

answer
required
string (answer)

LLMからの回答

required
Array of objects (sources)

回答根拠の元になる情報の配列

Responses

Request samples

Content type
application/json
{
  • "threshold": 0.85,
  • "answer": "string",
  • "sources": [
    ]
}

Response samples

Content type
application/json
{
  • "explainContents": [
    ]
}

推論を用いた回答根拠確認API

回答データをもとにハルシネーションリスクの情報を付与して返却する。

Authorizations:
bearerAuth
header Parameters
Content-Type
required
string

application/json を固定で指定

x-nec-genai-api-version
string

APIのバージョン。現時点では使用していない(将来使用する可能性あり)

Request Body schema: application/json
required
answer
required
string (answer)

LLMからの回答。

required
Array of objects (sources)

回答根拠の元になる情報の配列

Responses

Request samples

Content type
application/json
{
  • "answer": "string",
  • "sources": [
    ]
}

Response samples

Content type
application/json
{
  • "explainContents": [
    ]
}