Custom MT Rest API

8 views
Skip to first unread message

Yasmin Moslem

unread,
Nov 6, 2021, 10:25:37 AM11/6/21
to okapi-users
Hello!

Please, is there an official way to add a custom MT engine, i.e. one internally developed with Flask or FastAPI?

As a workaround, I managed to do this by sort of hijacking the ModernMT's settings as it is the only one that allows a URL.

So it sends a GET request similar to this:
/translate?q=Bonjour+tout+le+monde&source=fr&target=en

and expects a JSON response similar to this:
{ "status": 200, "data": { "translation": "some translation here" } }

In a quick test, this worked. However, as you can imagine, there is no way to customize this for adding credentials or other scenarios.

So I wonder if there is an official feature for achieving this. Thanks for your help!

Kind regards,
Yasmin



Yves Savourel

unread,
Nov 6, 2021, 10:52:24 AM11/6/21
to okapi-users

Hi Yasmin,

 

I’m afraid, currently the only way to add a standard MT connector to the framework is to create a class that implements IQuery or ITMQuery (which extends IQuery).

A workaround would be to use make your custom MT Rest AP match the calls of one of the existing connectors, just like you’ve illustrated below.

 

-ys

--
You received this message because you are subscribed to the Google Groups "okapi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/okapi-users/b55996b8-8d19-4fca-b993-da51473dde27n%40googlegroups.com.

Yasmin Moslem

unread,
Nov 6, 2021, 3:18:01 PM11/6/21
to Yves Savourel, okapi-users
Hi Yves! Many thanks for your reply!--
Sent from my iPad
Reply all
Reply to author
Forward
0 new messages