diff --git a/providers/src/typesafe/v00.00.00000/provider.yaml b/providers/src/typesafe/v00.00.00000/provider.yaml new file mode 100644 index 00000000..8a8f185d --- /dev/null +++ b/providers/src/typesafe/v00.00.00000/provider.yaml @@ -0,0 +1,26 @@ +id: typesafe +name: typesafe +version: v00.00.00000 +providerServices: + models: + id: models:v00.00.00000 + name: models + preferred: true + service: + $ref: typesafe/v00.00.00000/services/models.yaml + title: models API + version: v00.00.00000 + description: typesafe models API + systemone: + id: systemone:v00.00.00000 + name: systemone + preferred: true + service: + $ref: typesafe/v00.00.00000/services/systemone.yaml + title: systemone API + version: v00.00.00000 + description: typesafe systemone API +config: + auth: + type: bearer + credentialsenvvar: TYPESAFE_API_KEY diff --git a/providers/src/typesafe/v00.00.00000/services/models.yaml b/providers/src/typesafe/v00.00.00000/services/models.yaml new file mode 100644 index 00000000..52d42c01 --- /dev/null +++ b/providers/src/typesafe/v00.00.00000/services/models.yaml @@ -0,0 +1,180 @@ +openapi: 3.1.0 +info: + title: models API + description: typesafe models API + version: 0.2.0 +paths: + /v1/models: + get: + summary: Models V1 + description: |- + List the models and aliases available to the authenticated account. + + Pass a returned model name as `model` in a POST /v1/systemone request. + operationId: models_v1_v1_models_get + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ModelMetadataList' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [] +components: + schemas: + ModelMetadataList: + properties: + models: + items: + $ref: '#/components/schemas/ModelMetadata' + type: array + title: Models + description: Available models and aliases. Use a model's name in POST /v1/systemone requests. + examples: + - - description: General-purpose system one model. + name: jev-latest + release_date: '2026-09-15' + type: object + required: + - models + title: ModelMetadataList + description: Models and aliases available to the authenticated account. + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: Detail + description: Validation errors describing which request values are missing or invalid. + examples: + - - loc: + - body + - state + msg: Field required + type: missing + type: object + title: HTTPValidationError + description: Request validation failures returned with HTTP status 422. + ModelMetadata: + properties: + name: + type: string + title: Name + description: Model name or alias accepted by the request's model field. + examples: + - jev-latest + description: + type: string + title: Description + description: Human-readable description of the model and its capabilities. + examples: + - General-purpose system one model. + release_date: + type: string + title: Release Date + description: Model release date, formatted as YYYY-MM-DD. + examples: + - '2026-09-15' + type: object + required: + - name + - description + - release_date + title: ModelMetadata + description: A model or model alias available to the authenticated account. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + description: 'Path to the invalid value: the request location followed by field names and array indices.' + examples: + - - body + - questions + - urgency + - score + - criteria + msg: + type: string + title: Message + description: Human-readable explanation of the validation failure. + examples: + - Field required + type: + type: string + title: Error Type + description: Machine-readable validation error code. + examples: + - missing + input: + title: Input + description: The input value that failed validation. + examples: + - type: score + ctx: + type: string + title: Context + description: Additional context used to explain the validation failure. (opaque JSON object) + examples: + - min_length: 1 + type: object + required: + - loc + - msg + - type + title: ValidationError + description: A request validation error at a specific field or array element. + x-stackQL-resources: + models: + id: typesafe.models.models + name: models + title: Models + methods: + list: + operation: + $ref: '#/paths/~1v1~1models/get' + response: + mediaType: application/json + openAPIDocKey: '200' + objectKey: $.models + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/models/methods/list' + insert: [] + update: [] + delete: [] + replace: [] +servers: + - url: https://api.typesafe.ai +x-stackQL-config: + retry: + algorithm: exponential + max_attempts: 3 + initial_delay_ms: 500 + max_delay_ms: 10000 + multiplier: 2 + jitter_fraction: 0.1 + retryable_methods: + - GET + - HEAD + - POST + retryable_conditions: + status_codes: + - 408 + - 429 + - 502 + - 503 + - 504 + - 529 diff --git a/providers/src/typesafe/v00.00.00000/services/systemone.yaml b/providers/src/typesafe/v00.00.00000/services/systemone.yaml new file mode 100644 index 00000000..61bba53f --- /dev/null +++ b/providers/src/typesafe/v00.00.00000/services/systemone.yaml @@ -0,0 +1,604 @@ +openapi: 3.1.0 +info: + title: systemone API + description: typesafe systemone API + version: 0.2.0 +paths: + /v1/systemone: + post: + summary: Systemone + description: |- + Answer one or more questions about the content supplied in `state`. + + You can mix question types in one request. Answers use the same names as the + questions, so you can match each result to its question. The response also includes + the model used and token usage. + operationId: systemone_v1_systemone_post + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SystemOneRequest' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SystemOneResponse' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [] +components: + schemas: + SystemOneRequest: + properties: + state: + title: State + description: The content all questions in this request refer to. + examples: + - I was charged twice. Please help. + - message: Please help. + subject: Duplicate charge + type: string + model: + type: string + title: Model + description: Name or alias of the model to use. Available names are returned by GET /v1/models. + examples: + - jev-latest + questions: + additionalProperties: + $ref: '#/components/schemas/Question' + type: object + minProperties: 1 + title: Questions + description: Questions to ask about the content, each with a name you choose. The response uses those names to identify the answers. + examples: + - billing: + instructions: Is this message about billing? + type: noul + type: object + required: + - model + - questions + - state + title: SystemOneRequest + description: Content and named questions to evaluate together using a TypeSafe model. + SystemOneResponse: + properties: + model: + type: string + title: Model + description: Name of the model that answered the questions. May differ from the alias supplied in the request. + examples: + - jev-latest + answers: + additionalProperties: + $ref: '#/components/schemas/Answer' + type: object + minProperties: 1 + title: Answers + description: Answers keyed by the question names supplied in the request. Each answer's type matches its question's type. + examples: + - billing: + noul: 0.98 + type: noul + usage: + $ref: '#/components/schemas/Usage' + description: Input and output token counts for this evaluation. + examples: + - input_tokens: 120 + output_tokens: 12 + type: object + required: + - model + - answers + - usage + title: SystemOneResponse + description: Answers grouped by question name, with the model used and token usage. + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: Detail + description: Validation errors describing which request values are missing or invalid. + examples: + - - loc: + - body + - state + msg: Field required + type: missing + type: object + title: HTTPValidationError + description: Request validation failures returned with HTTP status 422. + Question: + description: A question about the supplied content. + discriminator: + propertyName: type + mapping: + choice: '#/components/schemas/ChoiceQuestion' + noul: '#/components/schemas/NoulQuestion' + score: '#/components/schemas/ScoreQuestion' + properties: + type: + type: string + title: Type + description: Identifies a yes/no question or statement. + examples: + - noul + enum: + - noul + instructions: + title: Instructions + description: The yes/no question or statement to evaluate. + examples: + - Is this message spam? + - This message contains unsolicited advertising. + - task: Identify unsolicited advertising. + type: string + nullable: true + criteria: + description: Criteria clarifying what counts as a yes or no answer. + examples: + - 'false': A legitimate conversation + 'true': Unsolicited advertising + properties: + 'true': + title: 'True' + description: What counts as a yes answer. + examples: + - The message is unsolicited advertising. + type: string + nullable: true + 'false': + title: 'False' + description: What counts as a no answer. + examples: + - The message is a legitimate conversation. + type: string + nullable: true + type: object + title: NoulCriteria + nullable: true + type: object + title: NoulQuestion + required: + - type + - criteria + Answer: + description: An answer whose type matches the corresponding question. + discriminator: + propertyName: type + mapping: + choice: '#/components/schemas/ChoiceAnswer' + noul: '#/components/schemas/NoulAnswer' + score: '#/components/schemas/ScoreAnswer' + properties: + type: + type: string + title: Type + description: Identifies a yes/no answer. + examples: + - noul + enum: + - noul + noul: + type: number + title: 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 + score: + type: number + title: Score + description: 'Expected score: the probability-weighted average of the rubric levels. May fall between integer levels.' + examples: + - 1.7 + confidence: + type: number + title: 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 + legend: + additionalProperties: + type: string + type: object + title: Legend + description: The requested criteria mapped to their score levels, so you can interpret the score. + examples: + - '0': Can wait + '1': Needs attention this week + '2': Needs attention today + probabilities: + additionalProperties: + type: number + type: object + title: Probabilities + description: Probability of each score level, from 0 to 1, using the same keys as legend. Shows how likely the alternatives are; values sum to approximately 1. + examples: + - '0': 0.1 + '1': 0.1 + '2': 0.8 + choice: + type: string + title: Choice + description: The name of the choice with the highest probability among the question's criteria. + examples: + - angry + type: object + required: + - noul + - type + - score + - confidence + - legend + - probabilities + - choice + title: NoulAnswer + Usage: + properties: + input_tokens: + type: integer + title: Input Tokens + description: Number of billable input tokens used to evaluate the request. + examples: + - 120 + output_tokens: + type: integer + title: Output Tokens + description: Number of output tokens used to answer the questions. Output tokens are currently free of charge. + examples: + - 12 + type: object + required: + - input_tokens + - output_tokens + title: Usage + description: Token usage for the request. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + description: 'Path to the invalid value: the request location followed by field names and array indices.' + examples: + - - body + - questions + - urgency + - score + - criteria + msg: + type: string + title: Message + description: Human-readable explanation of the validation failure. + examples: + - Field required + type: + type: string + title: Error Type + description: Machine-readable validation error code. + examples: + - missing + input: + title: Input + description: The input value that failed validation. + examples: + - type: score + ctx: + type: string + title: Context + description: Additional context used to explain the validation failure. (opaque JSON object) + examples: + - min_length: 1 + type: object + required: + - loc + - msg + - type + title: ValidationError + description: A request validation error at a specific field or array element. + NoulQuestion: + properties: + type: + type: string + title: Type + description: Identifies a yes/no question or statement. + examples: + - noul + enum: + - noul + instructions: + title: Instructions + description: The yes/no question or statement to evaluate. + examples: + - Is this message spam? + - This message contains unsolicited advertising. + - task: Identify unsolicited advertising. + type: string + nullable: true + criteria: + description: Criteria clarifying what counts as a yes or no answer. + examples: + - 'false': A legitimate conversation + 'true': Unsolicited advertising + properties: + 'true': + title: 'True' + description: What counts as a yes answer. + examples: + - The message is unsolicited advertising. + type: string + nullable: true + 'false': + title: 'False' + description: What counts as a no answer. + examples: + - The message is a legitimate conversation. + type: string + nullable: true + type: object + title: NoulCriteria + nullable: true + type: object + title: NoulQuestion + description: A yes/no question or statement, answered with the probability of yes or true. + required: + - type + ChoiceQuestion: + properties: + type: + type: string + title: Type + description: Identifies a question that selects one of the choices in criteria. + examples: + - choice + enum: + - choice + instructions: + title: Instructions + description: What the model should decide when choosing an option. + examples: + - What is the tone of this message? + type: string + nullable: true + criteria: + additionalProperties: + type: string + nullable: true + type: object + title: Criteria + description: Choice names and descriptions of when each applies. A choice without a description is interpreted by its name alone. + examples: + - angry: An upset or hostile message + calm: A neutral or polite message + excited: An enthusiastic or eager message + type: object + required: + - criteria + - type + title: ChoiceQuestion + description: A question that selects one option from the choices you define. + ScoreQuestion: + properties: + type: + type: string + title: Type + description: Identifies a question that rates the content using the levels in criteria. + examples: + - score + enum: + - score + instructions: + title: Instructions + description: What the model should rate. + examples: + - How urgent is this message? + type: string + nullable: true + criteria: + items: + type: string + type: array + minItems: 1 + title: Criteria + description: Ordered descriptions of the score levels. Each description's position determines its score, starting at zero. + examples: + - - Can wait + - Needs attention this week + - Needs attention today + type: object + required: + - criteria + - type + title: ScoreQuestion + description: A question that assigns a score using an ordered rubric. + NoulAnswer: + properties: + type: + type: string + title: Type + description: Identifies a yes/no answer. + examples: + - noul + enum: + - noul + noul: + type: number + title: 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 + type: object + required: + - noul + - type + title: NoulAnswer + description: The probability of a yes answer or a true statement. + ScoreAnswer: + properties: + type: + type: string + title: Type + description: Identifies a rating against the requested score levels. + examples: + - score + enum: + - score + score: + type: number + title: Score + description: 'Expected score: the probability-weighted average of the rubric levels. May fall between integer levels.' + examples: + - 1.7 + confidence: + type: number + title: 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 + legend: + additionalProperties: + type: string + type: object + title: Legend + description: The requested criteria mapped to their score levels, so you can interpret the score. + examples: + - '0': Can wait + '1': Needs attention this week + '2': Needs attention today + probabilities: + additionalProperties: + type: number + type: object + title: Probabilities + description: Probability of each score level, from 0 to 1, using the same keys as legend. Shows how likely the alternatives are; values sum to approximately 1. + examples: + - '0': 0.1 + '1': 0.1 + '2': 0.8 + type: object + required: + - score + - confidence + - legend + - probabilities + - type + title: ScoreAnswer + description: An expected score with its rubric, confidence, and score-level probabilities. + ChoiceAnswer: + properties: + type: + type: string + title: Type + description: Identifies a selection from the requested choices. + examples: + - choice + enum: + - choice + choice: + type: string + title: Choice + description: The name of the choice with the highest probability among the question's criteria. + examples: + - angry + confidence: + type: number + title: 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 + probabilities: + additionalProperties: + type: number + type: object + title: Probabilities + 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 + type: object + required: + - choice + - confidence + - probabilities + - type + title: ChoiceAnswer + description: The selected choice, confidence, and probabilities for a choice question. + NoulCriteria: + properties: + 'true': + title: 'True' + description: What counts as a yes answer. + examples: + - The message is unsolicited advertising. + type: string + nullable: true + 'false': + title: 'False' + description: What counts as a no answer. + examples: + - The message is a legitimate conversation. + type: string + nullable: true + type: object + title: NoulCriteria + description: Criteria defining what counts as a yes or no answer. + x-stackQL-resources: + evaluations: + id: typesafe.systemone.evaluations + name: evaluations + title: Evaluations + methods: + evaluate: + config: + requestBodyTranslate: + algorithm: naive + operation: + $ref: '#/paths/~1v1~1systemone/post' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/evaluations/methods/evaluate' + insert: [] + update: [] + delete: [] + replace: [] +servers: + - url: https://api.typesafe.ai +x-stackQL-config: + retry: + algorithm: exponential + max_attempts: 3 + initial_delay_ms: 500 + max_delay_ms: 10000 + multiplier: 2 + jitter_fraction: 0.1 + retryable_methods: + - GET + - HEAD + - POST + retryable_conditions: + status_codes: + - 408 + - 429 + - 502 + - 503 + - 504 + - 529