Ответы и результаты
Читайте ответы, оценки уверенности, расход токенов и доступные модели, которые возвращает API TypeSafe.
Ответ
typesafe_sdk.SystemOneResponse
pydantic-model
Базовые классы: Response
Ответы, сгруппированные по типу вопроса, вместе с метаданными модели и расхода.
Подробности см. в System One .
Показать схему JSON:
Подробности {
"$defs" : {
"ChoiceAnswer" : {
"description" : "A selected label and its probabilities. \n\n See the [choice primitive](../../../../primitives/choice) for details." ,
"properties" : {
"type" : {
"const" : "choice" ,
"default" : "choice" ,
"title" : "Type" ,
"type" : "string"
},
"choice" : {
"description" : "The name of the choice with the highest probability among the question's criteria." ,
"examples" : [
"angry"
],
"title" : "Choice" ,
"type" : "string"
},
"confidence" : {
"description" : "Confidence in the selected choice, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain selections for review." ,
"examples" : [
0.9
],
"title" : "Confidence" ,
"type" : "number"
},
"probabilities" : {
"additionalProperties" : {
"type" : "number"
},
"description" : "Probability of each choice in criteria, keyed by choice name, from 0 to 1. Shows how likely the alternatives are; values sum to approximately 1." ,
"examples" : [
{
"angry" : 0.8 ,
"calm" : 0.1 ,
"excited" : 0.1
}
],
"title" : "Probabilities" ,
"type" : "object"
}
},
"required" : [
"choice" ,
"confidence" ,
"probabilities"
],
"title" : "ChoiceAnswer" ,
"type" : "object"
},
"NoulAnswer" : {
"description" : "A yes/no answer. \n\n See the [noul primitive](../../../../primitives/noul) for details." ,
"properties" : {
"type" : {
"const" : "noul" ,
"default" : "noul" ,
"title" : "Type" ,
"type" : "string"
},
"noul" : {
"description" : "Probability of a yes answer or a true statement, from 0 to 1. Values near 1 favor yes or true, values near 0 favor no or false, and values near 0.5 indicate uncertainty." ,
"examples" : [
0.98
],
"title" : "Noul" ,
"type" : "number"
}
},
"required" : [
"noul"
],
"title" : "NoulAnswer" ,
"type" : "object"
},
"ScoreAnswer" : {
"description" : "An expected score with its rubric and probabilities. \n\n See the [score primitive](../../../../primitives/score) for details." ,
"properties" : {
"type" : {
"const" : "score" ,
"default" : "score" ,
"title" : "Type" ,
"type" : "string"
},
"score" : {
"description" : "Expected score: the probability-weighted average of the rubric levels. May fall between integer levels." ,
"examples" : [
1.7
],
"title" : "Score" ,
"type" : "number"
},
"confidence" : {
"description" : "Confidence in the score, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain ratings for review." ,
"examples" : [
0.9
],
"title" : "Confidence" ,
"type" : "number"
},
"legend" : {
"additionalProperties" : {
"anyOf" : [
{
"type" : "string"
},
{
"additionalProperties" : true ,
"type" : "object"
},
{
"items" : {},
"type" : "array"
}
]
},
"title" : "Legend" ,
"type" : "object"
},
"probabilities" : {
"additionalProperties" : {
"type" : "number"
},
"title" : "Probabilities" ,
"type" : "object"
}
},
"required" : [
"score" ,
"confidence" ,
"legend" ,
"probabilities"
],
"title" : "ScoreAnswer" ,
"type" : "object"
},
"Usage" : {
"description" : "Token counts for a request, when reported by the API." ,
"properties" : {
"input_tokens" : {
"anyOf" : [
{
"type" : "integer"
},
{
"type" : "null"
}
],
"default" : null ,
"title" : "Input Tokens"
},
"output_tokens" : {
"anyOf" : [
{
"type" : "integer"
},
{
"type" : "null"
}
],
"default" : null ,
"title" : "Output Tokens"
}
},
"title" : "Usage" ,
"type" : "object"
}
},
"description" : "Answers grouped by question type with model and usage metadata. \n\n See [System One](../../../../concepts/system-one) for details." ,
"properties" : {
"model" : {
"title" : "Model" ,
"type" : "string"
},
"usage" : {
"$ref" : "#/$defs/Usage"
},
"answers" : {
"additionalProperties" : {
"discriminator" : {
"mapping" : {
"choice" : "#/$defs/ChoiceAnswer" ,
"noul" : "#/$defs/NoulAnswer" ,
"score" : "#/$defs/ScoreAnswer"
},
"propertyName" : "type"
},
"oneOf" : [
{
"$ref" : "#/$defs/NoulAnswer"
},
{
"$ref" : "#/$defs/ChoiceAnswer"
},
{
"$ref" : "#/$defs/ScoreAnswer"
}
]
},
"title" : "Answers" ,
"type" : "object"
}
},
"required" : [
"model" ,
"usage"
],
"title" : "SystemOneResponse" ,
"type" : "object"
}
Конфигурация:
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
Расход токенов на запрос.
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 их сообщает.
Показать схему JSON:
Подробности {
"description" : "Token counts for a request, when reported by the API." ,
"properties" : {
"input_tokens" : {
"anyOf" : [
{
"type" : "integer"
},
{
"type" : "null"
}
],
"default" : null ,
"title" : "Input Tokens"
},
"output_tokens" : {
"anyOf" : [
{
"type" : "integer"
},
{
"type" : "null"
}
],
"default" : null ,
"title" : "Output Tokens"
}
},
"title" : "Usage" ,
"type" : "object"
}
Конфигурация:
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
Число использованных входных токенов или None, когда API их не сообщил.
output_tokens
pydantic-field
output_tokens : int | None = None
Число использованных выходных токенов или None, когда API их не сообщил.
Ответы
typesafe_sdk.NoulAnswer
pydantic-model
Базовые классы: wire.NoulAnswer
Ответ «да/нет».
Подробности см. в примитиве noul .
Показать схему JSON:
Подробности {
"description" : "A yes/no answer. \n\n See the [noul primitive](../../../../primitives/noul) for details." ,
"properties" : {
"type" : {
"const" : "noul" ,
"default" : "noul" ,
"title" : "Type" ,
"type" : "string"
},
"noul" : {
"description" : "Probability of a yes answer or a true statement, from 0 to 1. Values near 1 favor yes or true, values near 0 favor no or false, and values near 0.5 indicate uncertainty." ,
"examples" : [
0.98
],
"title" : "Noul" ,
"type" : "number"
}
},
"required" : [
"noul"
],
"title" : "NoulAnswer" ,
"type" : "object"
}
Конфигурация:
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 .
Показать схему JSON:
Подробности {
"description" : "A selected label and its probabilities. \n\n See the [choice primitive](../../../../primitives/choice) for details." ,
"properties" : {
"type" : {
"const" : "choice" ,
"default" : "choice" ,
"title" : "Type" ,
"type" : "string"
},
"choice" : {
"description" : "The name of the choice with the highest probability among the question's criteria." ,
"examples" : [
"angry"
],
"title" : "Choice" ,
"type" : "string"
},
"confidence" : {
"description" : "Confidence in the selected choice, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain selections for review." ,
"examples" : [
0.9
],
"title" : "Confidence" ,
"type" : "number"
},
"probabilities" : {
"additionalProperties" : {
"type" : "number"
},
"description" : "Probability of each choice in criteria, keyed by choice name, from 0 to 1. Shows how likely the alternatives are; values sum to approximately 1." ,
"examples" : [
{
"angry" : 0.8 ,
"calm" : 0.1 ,
"excited" : 0.1
}
],
"title" : "Probabilities" ,
"type" : "object"
}
},
"required" : [
"choice" ,
"confidence" ,
"probabilities"
],
"title" : "ChoiceAnswer" ,
"type" : "object"
}
Конфигурация:
extra: ignore
frozen: True
strict: True
Поля:
choice
pydantic-field
choice : str
Имя choice с наибольшей вероятностью среди criteria вопроса.
confidence
pydantic-field
confidence : float
Уверенность в выбранном choice, от 0 до 1. Более высокие значения означают бо́льшую определённость; низкие значения помогают пометить неуверенные выборы для проверки.
probabilities
pydantic-field
probabilities : dict [ str , float ]
Вероятность каждого choice в criteria с ключами по имени choice, от 0 до 1. Показывает, насколько вероятны альтернативы; значения в сумме дают примерно 1.
model_config
class-attribute instance-attribute
model_config = ConfigDict(
extra = "ignore" , frozen = True , strict = True
)
typesafe_sdk.ScoreAnswer
pydantic-model
Базовые классы: wire.ScoreAnswer
Ожидаемый score вместе с его рубрикой и вероятностями.
Подробности см. в примитиве score .
Показать схему JSON:
Подробности {
"description" : "An expected score with its rubric and probabilities. \n\n See the [score primitive](../../../../primitives/score) for details." ,
"properties" : {
"type" : {
"const" : "score" ,
"default" : "score" ,
"title" : "Type" ,
"type" : "string"
},
"score" : {
"description" : "Expected score: the probability-weighted average of the rubric levels. May fall between integer levels." ,
"examples" : [
1.7
],
"title" : "Score" ,
"type" : "number"
},
"confidence" : {
"description" : "Confidence in the score, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain ratings for review." ,
"examples" : [
0.9
],
"title" : "Confidence" ,
"type" : "number"
},
"legend" : {
"additionalProperties" : {
"anyOf" : [
{
"type" : "string"
},
{
"additionalProperties" : true ,
"type" : "object"
},
{
"items" : {},
"type" : "array"
}
]
},
"title" : "Legend" ,
"type" : "object"
},
"probabilities" : {
"additionalProperties" : {
"type" : "number"
},
"title" : "Probabilities" ,
"type" : "object"
}
},
"required" : [
"score" ,
"confidence" ,
"legend" ,
"probabilities"
],
"title" : "ScoreAnswer" ,
"type" : "object"
}
Конфигурация:
extra: ignore
frozen: True
strict: True
Поля:
score
pydantic-field
score : float
Ожидаемый score: взвешенное по вероятностям среднее уровней рубрики. Может попадать между целочисленными уровнями.
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
Модели, доступные аккаунту.
Показать схему JSON:
Подробности {
"$defs" : {
"ModelMetadata" : {
"description" : "Metadata describing a single available model." ,
"properties" : {
"name" : {
"title" : "Name" ,
"type" : "string"
},
"description" : {
"title" : "Description" ,
"type" : "string"
},
"release_date" : {
"title" : "Release Date" ,
"type" : "string"
}
},
"required" : [
"name" ,
"description" ,
"release_date"
],
"title" : "ModelMetadata" ,
"type" : "object"
}
},
"description" : "The models available to the account." ,
"properties" : {
"models" : {
"items" : {
"$ref" : "#/$defs/ModelMetadata"
},
"title" : "Models" ,
"type" : "array"
}
},
"required" : [
"models"
],
"title" : "ListModelsResponse" ,
"type" : "object"
}
Поля:
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
Метаданные, описывающие одну доступную модель.
Показать схему JSON:
Подробности {
"description" : "Metadata describing a single available model." ,
"properties" : {
"name" : {
"title" : "Name" ,
"type" : "string"
},
"description" : {
"title" : "Description" ,
"type" : "string"
},
"release_date" : {
"title" : "Release Date" ,
"type" : "string"
}
},
"required" : [
"name" ,
"description" ,
"release_date"
],
"title" : "ModelMetadata" ,
"type" : "object"
}
Поля:
name
pydantic-field
name : str
Имя или псевдоним модели, принимаемые полем model запроса.
description
pydantic-field
description : str
Читаемое человеком описание модели и её возможностей.
release_date
pydantic-field
release_date : str
Дата выпуска модели в формате YYYY-MM-DD.