Sámi Oracle

Sámi Oracle · GPT アクション

Translation API

An API that provides translations using neural machine translation models. Developed by TartuNLP - the NLP research group of the University of Tartu.

  • GET /v2Get Config

    Get the configuration of available NMT models.

  • POST /v2Translate

    Submit a translation request.

  • POST /v2/correctionCorrection

    Submit a translation correction request.

  • GET /v1Get Config V1

    Get the configuration of available NMT models.

  • POST /v1Translate

    Submit a translation request.

元の API スキーマ
{
  "openapi": "3.0.2",
  "info": {
    "title": "Translation API",
    "description": "An API that provides translations using neural machine translation models. Developed by TartuNLP - the NLP research group of the University of Tartu.",
    "termsOfService": "https://www.tartunlp.ai/andmekaitsetingimused",
    "contact": {
      "name": "TartuNLP",
      "url": "https://tartunlp.ai",
      "email": "ping@tartunlp.ai"
    },
    "license": {
      "name": "MIT license",
      "url": "https://github.com/TartuNLP/translation-api/blob/main/LICENSE"
    },
    "version": "2.2.0-beta"
  },
  "servers": [
    {
      "url": "https://api.tartunlp.ai//translation"
    }
  ],
  "paths": {
    "/v2": {
      "get": {
        "tags": [
          "v2"
        ],
        "summary": "Get Config",
        "description": "Get the configuration of available NMT models.",
        "operationId": "get_config_v2_get",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "X-Api-Key",
              "type": "string"
            },
            "name": "x-api-key",
            "in": "header"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Config"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Translate",
        "description": "Submit a translation request.",
        "operationId": "translate_v2_post",
        "parameters": [
          {
            "required": false,
            "deprecated": true,
            "schema": {
              "title": "Application",
              "type": "string"
            },
            "name": "application",
            "in": "header"
          },
          {
            "required": false,
            "schema": {
              "title": "X-Api-Key",
              "type": "string"
            },
            "name": "x-api-key",
            "in": "header"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/correction": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Correction",
        "description": "Submit a translation correction request.",
        "operationId": "correction_v2_correction_post",
        "parameters": [
          {
            "required": false,
            "deprecated": true,
            "schema": {
              "title": "Application",
              "type": "string"
            },
            "name": "application",
            "in": "header"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Correction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Get Config V1",
        "description": "Get the configuration of available NMT models.",
        "operationId": "get_config_v1_v1_get",
        "parameters": [
          {
            "description": "An optional API key parameter that determines which domains and langauge pairs are available",
            "required": false,
            "schema": {
              "title": "Auth",
              "type": "string",
              "description": "An optional API key parameter that determines which domains and langauge pairs are available"
            },
            "name": "auth",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigV1"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "deprecated": true
      },
      "post": {
        "tags": [
          "v1"
        ],
        "summary": "Translate",
        "description": "Submit a translation request.",
        "operationId": "translate_v1_post",
        "parameters": [
          {
            "description": "Source language ISO 2-letter or 3-letter code.",
            "required": false,
            "schema": {
              "title": "Ilang",
              "type": "string",
              "description": "Source language ISO 2-letter or 3-letter code."
            },
            "name": "ilang",
            "in": "query"
          },
          {
            "description": "Target language ISO 2-letter or 3-letter code.",
            "required": false,
            "schema": {
              "title": "Olang",
              "type": "string",
              "description": "Target language ISO 2-letter or 3-letter code."
            },
            "name": "olang",
            "in": "query"
          },
          {
            "description": "The domain (style) of the text",
            "required": false,
            "schema": {
              "title": "Odomain",
              "type": "string",
              "description": "The domain (style) of the text",
              "default": "general"
            },
            "name": "odomain",
            "in": "query"
          },
          {
            "description": "An optional API key parameter that determines which domains and langauge pairs are available",
            "required": false,
            "schema": {
              "title": "Auth",
              "type": "string",
              "description": "An optional API key parameter that determines which domains and langauge pairs are available"
            },
            "name": "auth",
            "in": "query"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestV1"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseV1"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "deprecated": true
      }
    }
  },
  "components": {
    "schemas": {
      "Config": {
        "title": "Config",
        "required": [
          "domains"
        ],
        "type": "object",
        "properties": {
          "xml_support": {
            "title": "Xml Support",
            "type": "boolean",
            "description": "[Deprecated] A boolean value whether using XML tags in text is supported.",
            "default": true
          },
          "domains": {
            "title": "Domains",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Domain"
            },
            "description": "A list of supported domains and their configurations."
          }
        }
      },
      "ConfigV1": {
        "title": "ConfigV1",
        "required": [
          "domain",
          "options"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "title": "Domain",
            "type": "string",
            "description": "Name of the workspace of the auth key used."
          },
          "options": {
            "title": "Options",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DomainV1"
            },
            "description": "A list of supported domains and their configurations."
          }
        }
      },
      "Correction": {
        "title": "Correction",
        "required": [
          "request",
          "response",
          "correction"
        ],
        "type": "object",
        "properties": {
          "request": {
            "title": "Request",
            "type": "string",
            "description": "An original translation request.",
            "example": "{\"text\":\"Aitäh!\",\"tgt\":\"eng\",\"src\":\"est\"}"
          },
          "response": {
            "title": "Response",
            "type": "string",
            "description": "An original translation.",
            "example": "Thank you!"
          },
          "correction": {
            "title": "Correction",
            "type": "string",
            "description": "A user-corrected text.",
            "example": "Thanks!"
          }
        }
      },
      "Domain": {
        "title": "Domain",
        "required": [
          "name",
          "code",
          "languages"
        ],
        "type": "object",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string",
            "description": "A human-readable name of the domain",
            "example": "General"
          },
          "code": {
            "title": "Code",
            "type": "string",
            "description": "A machine-readable codaname of the domain",
            "example": "general"
          },
          "languages": {
            "title": "Languages",
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A list of supported language pairs. Each pair is given as a hyphen-separated string of the source and target language 3-letter ISO codes. Note that for German 'ger' is used instead of 'deu'.",
            "example": [
              "est-eng",
              "eng-est"
            ]
          }
        }
      },
      "DomainV1": {
        "title": "DomainV1",
        "required": [
          "odomain",
          "name",
          "lang"
        ],
        "type": "object",
        "properties": {
          "odomain": {
            "title": "Odomain",
            "type": "string",
            "description": "A machine-readable codaname of the domain",
            "example": "general"
          },
          "name": {
            "title": "Name",
            "type": "string",
            "description": "A human-readable name of the domain",
            "example": "General"
          },
          "lang": {
            "title": "Lang",
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A list of allowed output languages.",
            "example": [
              "est",
              "eng"
            ]
          }
        }
      },
      "HTTPValidationError": {
        "title": "HTTPValidationError",
        "type": "object",
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        }
      },
      "Request": {
        "title": "Request",
        "required": [
          "text",
          "src",
          "tgt"
        ],
        "type": "object",
        "properties": {
          "text": {
            "title": "Text",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Original text input. May contain multiple sentences.",
            "example": "Aitäh!"
          },
          "src": {
            "title": "Src",
            "type": "string",
            "description": "Input language ISO 2-letter or 3-letter code.",
            "example": "est"
          },
          "tgt": {
            "title": "Tgt",
            "type": "string",
            "description": "Target language ISO 2-letter or 3-letter code.",
            "example": "eng"
          },
          "domain": {
            "title": "Domain",
            "type": "string",
            "description": "The domain (style) of the text. This is mostly relevant for custom-made engines.",
            "default": "general",
            "example": "general"
          },
          "application": {
            "title": "Application",
            "type": "string",
            "description": "Name of the application making the request. Certain application names may activate specific pre- and postprocessing pipelines. Otherwise used for usage statistics. If you integrate our API into your application, please use a consistent application name and let us know.",
            "example": "Documentation UI"
          }
        }
      },
      "RequestV1": {
        "title": "RequestV1",
        "required": [
          "text"
        ],
        "type": "object",
        "properties": {
          "text": {
            "title": "Text",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Original text input. May contain multiple sentences.",
            "example": "Aitäh!"
          }
        }
      },
      "Response": {
        "title": "Response",
        "required": [
          "result"
        ],
        "type": "object",
        "properties": {
          "result": {
            "title": "Result",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Translated text.",
            "example": "Thank you!"
          }
        }
      },
      "ResponseV1": {
        "title": "ResponseV1",
        "required": [
          "input",
          "result"
        ],
        "type": "object",
        "properties": {
          "status": {
            "title": "Status",
            "type": "string",
            "description": "A status code of the request",
            "default": "done",
            "example": "done"
          },
          "input": {
            "title": "Input",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Original text input.",
            "example": "Aitäh!"
          },
          "result": {
            "title": "Result",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "Translated text.",
            "example": "Thank you!"
          }
        }
      },
      "ValidationError": {
        "title": "ValidationError",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "type": "object",
        "properties": {
          "loc": {
            "title": "Location",
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            }
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        }
      }
    }
  }
}