Is there a way to access an external API from inside an Inform 7 extension?
Stepping back:
I had the idea of plugging an LLM in to a text adventure, not to replace the parser or generation, but to make one “smarter” NPC.
Is there a way to access an external API from inside an Inform 7 extension?
Stepping back:
I had the idea of plugging an LLM in to a text adventure, not to replace the parser or generation, but to make one “smarter” NPC.
You can use something like Vorple to call arbitrary JavaScript functions.
The next thing needed is an Inform 7 extension that obfuscates your LLM API Key Or maybe have the user provide their own.
A chance for some 4th wall breaking silliness: The woman steps closer, her smile warm. “They say you carry something peculiar, a key, not of iron or bone, but of code. An ‘API key,’ for some machine that spins words like a preacher spins truth.
Well, Inform doesn’t need to know the key though. You can keep it in the backend on your website, and let Inform communicate with the backend. But then you need some way of making sure the user can’t use that same backend endpoint manually…
We just built such a feature – we’ll be releasing it for parsercomp in a couple of weeks – please try the game Mystery Academy from thought auction to see it in action – if it gets a good reception, we’ll release it generally – thanks
Be advised:
We expect ParserComp 2025 entries should not be generated by Artificial Intelligence. You may use generative AI to develop ideas much as you would to augment your imagination. You should not use AI to generate code or any of your narrative text.
From here.
Just be aware that you might have some potential difficulties entering this into parsercomp.
I am not getting into my thoughts on LLMs in this thread. I am simply highlighting relevant information.
I have not done it using Inform 7. But I have had success with this in Python. Character responses are determined by a hidden ‘context prompt’ so you can decide what the character’s behavior is like, including how he/she will respond to specific statements. You also have to create a conversation history and feed it back into the prompt with every player response or otherwise the character won’t remember the previous thing you said.
Characters can also evaluate your input to do a ‘charisma check’ for when you’re trying to persuade them.
I like it. I hope to soon play Fallout without dialogue trees.
Thanks, Joey
I reached out to the organizers weeks ago and disclosed what we were attempting – given the extensive human-written basis that is required to make something like this work – they felt we fit within the scope.
Best
M