LoginSignup
3
3

More than 5 years have passed since last update.

api.aiのEntitiesの概要

Posted at

Entities

  • Entitiesは自然言語の入力からパラメータを抽出するためのパワフルなツール
  • ユーザのリクエストから取得したいあらゆるデータをEnitityに一致させることができる。
  • 特定のAgentで使われるEntitiesはagent functioningの結果として返されるパラメータの値に依存する。
  • 言い換えれば、開発者はAgentの中で言及される可能性がある全ての概念に対してEntityを作る必要はなく、アクショナブルなデータのために必要なもの飲みに対して作れば良い。
  • Entityには3つのタイプがある。system(API.AIがデフォルトで用意しているもの)、developer(開発者が定義するもの)、user(リクエストごとに個々のユーザに対して生成するもの)。これらはそれぞれmapping(参照する値をもつもの)、enum(参照する値がないもの)、composite(エイリアスを伴って他のEntityを含んだり、オブジェクト型の値を返すもの)がある。

Types of Entities

System Entities

System Entitiesはもっとも一般的な概念を簡単にハンドリングするためにAPI.AIによって事前にビルドされている。

Type Example
Mapping These system entities have reference values. For example, @sys.date matches common date references such as "January 1, 2015" or "The first of January of 2015" and returns a reference value in ISO-8601 format: "2015-01-01T12:00:00-03:00"
Enum These entities have no reference value. For example, @sys.color matches most popular colors and returns the matched color as it is without mapping it to any reference value. For example, shades of red, such as "scarlet" or "crimson", won't be mapped to "red" and will return their original values "scarlet" and "crimson".
Composite These entities can contain other entities with aliases and return object type values. For example, @sys.unit-currency is meant for matching amounts of money with indication of currency name, e.g., "50 euros" or "twenty dollars and five cents". It returns an object type value consisting of two attribute-value pairs: {"amount":50,"currency":"EUR"}

Developer Entities

WebフォームまたはJSON, CSVフォーマットをapi経由でアップロードすることで開発者が独自のEntityを作成できる。AgentごとにEntityは一意の名前にする。先頭はアルファベットで、A-Z, a-z, 0-9, _, -を含めることができる。

Type Example
Dev Mapping 同義語と参照する値のマッピングを定義できる。例えば、食べ物の種類Entityは参照する値を"vegetarian"とし、同義語として"veg"や"veggie"を紐付ける
Dev Enum Enum型は参照する値へのマッピングを持たないEntitiesの集合を含めることができる。エントリは単純な単語やフレーズ、他のEntityを含められる。EnumタイプのEntityを作るためには、Define Synonymsのチェクを外してエントリを追加する
Dev Composite enumタイプのEntityは他のEntityやcomposite entityを呼ぶためのエイリアスを含むことができる。Composite Entityは複数の異なる属性を持つオブジェクトやコンセプトを説明するのに最も便利である。

User Entities

User EngityはセッションIDレベルで再定義することができ、例えばユーザのプレイリストのような明確なコンセプトを受け入れる。詳しくはReferenceを参照。

Batch Operations

省略

Export/Upload Entities

省略

Allow Automated Expansion

Developer mapping entityのこの機能は、AgentがEntityに明示的にリストアップされてない値を認識することを許容する。

Entity内にリストアップされていないアイテムを含むユーザのリクエストが来た場合、Automatic Expansionはそれまで定義されていなかったアイテムをパラメータとして追加する。すごすぎ。 Agentがユーザのリクエストを見ることは、リクエストされたアイテムを派生させることができるように例を与えいることと似ている。User Saysセクションでたくさん定義するのも良いが、Automated Expansionの方が良い結果を出すだろう。(?)

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3