It is possible to call, from TADS 3.1 code, an external API?

Hi. I’m new to TADS 3.1 but I’m an old programmer.
I would like to call ChatGPT 4o mini API in order to make NPC more natural at talking (and for some other stuff) …
… I wonder: can this be done ? And how?

1 Like

Welcome to TADS! My first reaction is that I probably would have heard of that before if it was possible, but I’m not the techiest guy on here.
Only thing that comes to mind is if you modify the interpreter (I believe you can do it with QTads) you can write a set of new intrinsic functions that can call C++ code, but then you’re stuck with a standalone executable that isn’t cross-platform. I’m not sure if that approach would work for ChatGPT or not…

2 Likes

I’m considering all the possibility: there is Inform 7, TADS 3, Evennia (a free tool for python MUDs) and Unity. The only one I know a bit is Unity: there calling an external API should be not difficult. If someone has more info about how to do it on TADS (maybe a link to aprevious discussion?) it will be appreciated.

1 Like

Welcome to TADS! :grin:


This will likely also break the TADS interpreter license which QTADS adopts, and this will create a number of potential difficulties when trying to find a hosting platform for the game.

These two would be your best bet. Inform 7 and TADS are closed systems, for the most part, and extensions are built within their respective internal environments.


Word of warning: You will have a difficult time entering your game into a competition for interactive fiction, if you’re leveraging an LLM, as the community is split pretty hard on the ethics around them. If you’re just creating your game to release it using the standard gamedev workflow then this isn’t gonna be (as much of) an issue.

I’m not starting or engaging in an argument against (or for) it, because that is off-topic and would completely derail this whole thread, but it’s worth knowing ahead of time that your tech stack will have consequences.

If you want to see a previous argument thread about this, you can read this thread. If you would like to start a new argument, I would highly recommend splitting it into it’s own thread.

2 Likes

Another possibility is to use the network API and make HTTP calls to some endpoint that processes your requests and returns LLM responses. I believe this too is only available with QTads, but at least it’s cross-platform without having to recompile for each target.

Also, there are others working on incorporating LLMs into parser-based IF:

2 Likes

Thanks to all. The response of Jim has all the information I wanted. It’s just to do some experiment: actually I do not plan to engage in competitions. Thanks again.

4 Likes

Wait, does this work in all TADS implementations? Or is this just for WebUI…?

I’m honestly not sure. I should have clarified that for the OP: It might take some experimentation to get this to work, and it might not even work within QTads, but require the WebUI extension.

I would do this experimentation myself (I’m curious), but tonight’s not a good night for me to figure this out.

2 Likes

Same, honestly. I’m gonna kick myself if I Am Prey could have been a multiplayer game, though, lmao.

1 Like