NATION

PASSWORD

Nationstates AI | Use AI to answer your nation's issues

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Nationstates AI | Use AI to answer your nation's issues

Postby Jiangbei » Thu Mar 23, 2023 5:24 pm

A python script to automatically answer issues using an AI

https://github.com/Bohaska/nationstates-ai/

Nationstates AI is an open-source python script that can answer your nations issues with your nation name, password and a Huggingface API key (Huggingface is the free AI hosting platform this script uses)

Features
- Open-source, check the code yourself.
- Directly interacts with the NS API, doesn't use a NS API wrapper
- Sane NS rate-limiting, stopping requests for 30 seconds after 30 requests have been made.

See the above github repository for more instructions on how to set up the python bot.

I also made a region to store nations controlled by AI's at Nationstates AI

Example of the AI in action:

Image
Last edited by Jiangbei on Thu Mar 30, 2023 3:24 am, edited 3 times in total.

User avatar
Cancolastan
Secretary
 
Posts: 37
Founded: Apr 12, 2019
Iron Fist Consumerists

Postby Cancolastan » Thu Mar 23, 2023 5:28 pm

Finally, a way to easily farm my pupp- I mean, answer Issues!
Yours truly,
Honourable Frank Burk
Prime Minister of Cancolastan
SECURITATIS DE HOMINES
Political Compass:
https://ibb.co/pPh7RdK
Economic: -1.75
Social: 6.1

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

No, this cannot farm cards

Postby Jiangbei » Thu Mar 23, 2023 5:29 pm

Cancolastan wrote:Finally, a way to easily farm my pupp- I mean, answer Issues!


Unfortunately, you cannot farm cards with this, as it uses the Nationstates API to answer issues :( . Using the API to answer issues does not give you cards.
Last edited by Jiangbei on Thu Mar 23, 2023 5:29 pm, edited 1 time in total.

User avatar
Cancolastan
Secretary
 
Posts: 37
Founded: Apr 12, 2019
Iron Fist Consumerists

Postby Cancolastan » Thu Mar 23, 2023 5:37 pm

Bugger :(
Yours truly,
Honourable Frank Burk
Prime Minister of Cancolastan
SECURITATIS DE HOMINES
Political Compass:
https://ibb.co/pPh7RdK
Economic: -1.75
Social: 6.1

User avatar
WayNeacTia
Senator
 
Posts: 4330
Founded: Aug 01, 2014
Ex-Nation

Postby WayNeacTia » Thu Mar 23, 2023 8:12 pm

Shame this can't just be spun up a docker container. I may fire it up in an LXC container and check it out though.
Sarcasm dispensed moderately.
RiderSyl wrote:You'd really think that defenders would communicate with each other about this. I know they're not a hivemind, but at least some level of PR skill would keep Quebecshire and Quebecshire from publically contradicting eac

wait

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Postby Jiangbei » Fri Mar 24, 2023 2:18 am

WayNeacTia wrote:Shame this can't just be spun up a docker container. I may fire it up in an LXC container and check it out though.


I don't have any experience with using Docker... I'll see if I can make a docker container for this application.

User avatar
Rocain Founder
Envoy
 
Posts: 278
Founded: Aug 01, 2020
Corrupt Dictatorship

Postby Rocain Founder » Fri Mar 24, 2023 5:49 am

Well, this looks kind of interesting, but I went to the github for it, and couldn't make heads or tails of it. Can this be used to create nations of a certain kind (e.g., a very Capitalist nation with high compassion)? Besides an "answer like Trump" nation, are there other good examples of interesting ways to use this? And are there recommendations for where to go to learn enough that the contents of the github are no longer gibberish? (By the way, I'm familiar with python - AI and not python is the stumbling block for me).

Thanks!

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Postby Jiangbei » Fri Mar 24, 2023 8:46 pm

Rocain Founder wrote:Well, this looks kind of interesting, but I went to the github for it, and couldn't make heads or tails of it. Can this be used to create nations of a certain kind (e.g., a very Capitalist nation with high compassion)? Besides an "answer like Trump" nation, are there other good examples of interesting ways to use this? And are there recommendations for where to go to learn enough that the contents of the github are no longer gibberish? (By the way, I'm familiar with python - AI and not python is the stumbling block for me).

Thanks!


I honestly don't know about the AI's full capacities and limitations. You can try it out yourself I guess.

User avatar
Vylixan
Chargé d'Affaires
 
Posts: 398
Founded: Mar 19, 2006
Psychotic Dictatorship

Postby Vylixan » Sun Mar 26, 2023 10:16 am

- Sane NS rate-limiting capping requests at 30 requests/sec


The NS API rate-limit is 50 requests per 30 seconds. This would go way over that limit.
See https://www.nationstates.net/pages/api.html#ratelimits


Edit: I looked at your source code to see how you implemented it, but it's not exactly as you stated.
The script does 30 quests and then sleeps for 30 seconds, which is not the same as 30 requests/sec.
Last edited by Vylixan on Sun Mar 26, 2023 10:19 am, edited 1 time in total.

User avatar
The Great Nevada Overlord
Diplomat
 
Posts: 520
Founded: Apr 28, 2022
Iron Fist Consumerists

Postby The Great Nevada Overlord » Tue Mar 28, 2023 10:39 am

Wouldn't this take the fun out of NS?

In terms of actual gameplay, NS is bare bones. Issues are really the only consistent gameplay in NS.

N-Day and that zombie thing only happen once or twice a year.
Welcome To The Great Nevada Overlord! Enjoy Your Stay!
I am an American Social Democrat, I like debates and long walks on the beach.
The Great Nevada Overlord is a large nation located on the western side of North America, it borders the United States in the east, Canada in the north, and Mexico in the south. It is a very closed off nation, with no legal immigration or emigration. Freedoms are practically nonexistent. The people are kept in the dark and are told that the rest of the world (especially the United States) are coming for them.

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Postby Jiangbei » Thu Mar 30, 2023 3:23 am

Vylixan wrote:
- Sane NS rate-limiting capping requests at 30 requests/sec

Edit: I looked at your source code to see how you implemented it, but it's not exactly as you stated.
The script does 30 quests and then sleeps for 30 seconds, which is not the same as 30 requests/sec.


whoops, wrote it wrong, thanks for finding the typo :)

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Postby Jiangbei » Thu Mar 30, 2023 3:27 am

The Great Nevada Overlord wrote:Wouldn't this take the fun out of NS?

In terms of actual gameplay, NS is bare bones. Issues are really the only consistent gameplay in NS.

N-Day and that zombie thing only happen once or twice a year.


I created Nationstates AI as a fun experiment to see how different world leaders may respond to issues in NS.

I do agree that if you're using the AI to answer your main account country's issues, that's a bad idea, and that's not why I made this script. Jiangbei's never going to be controlled by a bot.
Last edited by Jiangbei on Thu Mar 30, 2023 3:28 am, edited 1 time in total.

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Replit.com repl now available!

Postby Jiangbei » Thu May 11, 2023 10:57 pm

I uploaded this tool to replit.com for an easy way of running this tool, at https://replit.com/@Bohaska/Nationstates-AI.

Don't know how to set the credentials for running this tool in replit?

Try this small script, input the credentials and get a formatted JSON file of them compatible with the replit.com version https://www.online-python.com/9ihCuy8xsv

Edit: Forgot to normalise nation strings
Last edited by Jiangbei on Fri May 12, 2023 7:36 pm, edited 2 times in total.

User avatar
Refuge Isle
Technical Moderator
 
Posts: 1884
Founded: Dec 14, 2018
Left-wing Utopia

Postby Refuge Isle » Fri May 12, 2023 9:17 am

Jiangbei wrote:replit?

?tag replit

User avatar
Querria
Ambassador
 
Posts: 1328
Founded: Mar 15, 2013
Inoffensive Centrist Democracy

Postby Querria » Sun May 14, 2023 1:53 pm

Out of curiousity, does this use ChatGPT? Can we customize it using a chatroom so the AI answers according to a list of predetermined societal values?
The Civilization Index| RPs & Stories
Join the Midnight Vale.
LFPD Soveriegn wrote:WHY IS EVERYTHING BLOODY BLUE

Forsher wrote:I blame the French.
Collectivism sucks, Embrace Individuality.
Adding nothing of substance to online discourse since Xmas 2023. Just a content creator playing games.

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

Nationstates AI uses Huggingface, not ChatGPT.

Postby Jiangbei » Mon Jun 05, 2023 1:34 am

Querria wrote:Out of curiousity, does this use ChatGPT? Can we customize it using a chatroom so the AI answers according to a list of predetermined societal values?


No, it doesn't. It uses Huggingface, and the AI has no memory of previous actions. By default it uses the model https://huggingface.co/distilbert-base-cased-distilled-squad, but it could be changed to another model in the category of Question Answering. This is because question answering AI responses are much easier to parse than ChatGPT's responses, as they only can quote the text, not generate an entirely new response.

Sorry for the late reply.
Last edited by Jiangbei on Mon Jun 05, 2023 1:38 am, edited 2 times in total.

User avatar
Terminus Station
Ambassador
 
Posts: 1283
Founded: Jun 13, 2022
Ex-Nation

Postby Terminus Station » Mon Jun 05, 2023 1:36 am

Querria wrote:Out of curiousity, does this use ChatGPT? Can we customize it using a chatroom so the AI answers according to a list of predetermined societal values?

Id like to know as well how an AI learns and votes for policies based on what it knows.
"What happens to a Communist when he/she is given the most work "according to their ability" but are given nothing in return "according to their needs?"
Being Trans is ok, gender isn't assigned.

-->BANNED FOR TROLLING NAZIS<--

User avatar
Jiangbei
Civil Servant
 
Posts: 10
Founded: Dec 31, 2022
Ex-Nation

idk

Postby Jiangbei » Mon Jun 05, 2023 1:38 am

Terminus Station wrote:
Querria wrote:Out of curiousity, does this use ChatGPT? Can we customize it using a chatroom so the AI answers according to a list of predetermined societal values?

Id like to know as well how an AI learns and votes for policies based on what it knows.


It does not do any learning. I do not know exactly how this AI model works, I only made code to connect the AI to Nationstates. I don't know how ChatGPT decides its responses either shrug


Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Ankuran, Britain Interbellum RP, Gesaria, Occupied Vineta, Reyo, The Endless Eventide, The Mecix Molls, The Southern Dependencies, Wurttemberger Lande

Advertisement

Remove ads