ドキュメント

答えと応答

答えと応答

TypeSafe API が返す答え、信頼度、token 使用量、利用可能なモデルを読み取ります。

応答

typesafe_sdk.SystemOneResponse

pydantic-model

基底:Response

質問タイプ別にまとめた答えと、モデルおよび使用量のメタデータ。

詳しくは System One を参照してください。

設定:

  • extra: ignore
  • frozen: True
  • strict: True

フィールド:

request_id

cached property

request_id: str

応答ヘッダー x-typesafe-request-id です。

raw_http_response

property

raw_http_response: httpx2.Response

基盤となる httpx2.Response で、ステータス・ヘッダー・本文を公開します。

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

model

pydantic-field

model: str

リクエストの応答に使われたモデル。

usage

pydantic-field

usage: Usage

リクエストの token 使用量。

answers

pydantic-field

answers: dict[str, Answer]

質問名をキーとするすべての答えオブジェクト。

nouls

cached property

nouls: dict[str, NoulAnswer]

質問名をキーとする真偽の答え。

choices

cached property

choices: dict[str, ChoiceAnswer]

質問名をキーとする choice の答え。

scores

cached property

scores: dict[str, ScoreAnswer]

質問名をキーとする score の答え。

typesafe_sdk.Usage

pydantic-model

基底:wire.Usage

API が報告した場合の、リクエストの token 数。

設定:

  • extra: ignore
  • frozen: True
  • strict: True

フィールド:

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

input_tokens

pydantic-field

input_tokens: int | None = None

使用された入力 token 数。API が報告しなかった場合は None。

output_tokens

pydantic-field

output_tokens: int | None = None

使用された出力 token 数。API が報告しなかった場合は None。

答え

typesafe_sdk.NoulAnswer

pydantic-model

基底:wire.NoulAnswer

真偽の答え。

詳しくは noul プリミティブ を参照してください。

設定:

  • extra: ignore
  • frozen: True
  • strict: True

フィールド:

noul

pydantic-field

noul: float

「はい」または真である確率(0〜1)。1 に近いほど「はい」または真、0 に近いほど「いいえ」または偽、0.5 付近は不確かさを表します。

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

typesafe_sdk.ChoiceAnswer

pydantic-model

基底:wire.ChoiceAnswer

選ばれたラベルとその確率分布。

詳しくは choice プリミティブ を参照してください。

設定:

  • extra: ignore
  • frozen: True
  • strict: True

フィールド:

choice

pydantic-field

choice: str

質問の criteria の中で最も確率の高い choice の名前。

confidence

pydantic-field

confidence: float

選ばれた choice に対する信頼度(0〜1)。値が高いほど確実で、低い値は不確かな選択をレビュー対象として示すのに使います。

probabilities

pydantic-field

probabilities: dict[str, float]

criteria 内の各 choice の確率(0〜1)で、choice 名をキーとします。各選択肢の起こりやすさを表し、値の合計はおよそ 1 になります。

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

typesafe_sdk.ScoreAnswer

pydantic-model

基底:wire.ScoreAnswer

ルーブリックと確率分布を伴う期待スコア。

詳しくは score プリミティブ を参照してください。

設定:

  • extra: ignore
  • frozen: True
  • strict: True

フィールド:

score

pydantic-field

score: float

期待スコア。ルーブリック各段階の確率による重み付き平均です。整数の段階の間になることもあります。

confidence

pydantic-field

confidence: float

score に対する信頼度(0〜1)。値が高いほど確実で、低い値は不確かな評価をレビュー対象として示すのに使います。

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

legend

pydantic-field

legend: dict[
    int, str | dict[str, Any] | list[Any]
]

整数の score をキーとするルーブリックの説明。

probabilities

pydantic-field

probabilities: dict[int, float]

整数の score をキーとする確率分布。

typesafe_sdk.Answer

module-attribute

Answer: TypeAlias = Annotated[
    NoulAnswer | ChoiceAnswer | ScoreAnswer,
    Field(discriminator="type"),
]

type で識別される、単一の質問への答え。

利用可能なモデル

typesafe_sdk.ListModelsResponse

pydantic-model

基底:Response

アカウントで利用可能なモデル。

フィールド:

request_id

cached property

request_id: str

応答ヘッダー x-typesafe-request-id です。

raw_http_response

property

raw_http_response: httpx2.Response

基盤となる httpx2.Response で、ステータス・ヘッダー・本文を公開します。

model_config

class-attribute instance-attribute

model_config = ConfigDict(
    extra="ignore", frozen=True, strict=True
)

models

pydantic-field

models: tuple[ModelMetadata, ...]

利用可能なモデル。

typesafe_sdk.ModelMetadata

pydantic-model

基底:Schema

利用可能な 1 つのモデルを記述するメタデータ。

フィールド:

name

pydantic-field

name: str

リクエストの model フィールドが受け付けるモデル名または別名。

description

pydantic-field

description: str

モデルとその機能についての、人が読める説明。

release_date

pydantic-field

release_date: str

モデルのリリース日。YYYY-MM-DD 形式。