From the comment of u/baffo32: "This appears to be how it's done in the client: https://github.com/KoboldAI/KoboldAI-Client/blob/661bd5c99e7a03c94bfea436ad5... Here's how the web client does it: submit, poll, and output endpoints: https://github.com/kaihordewebui/kaihordewebui.github.io/blob/04ffbe9d3c45e6...
depressing unfortunately this has journal content it would be good to think about separating out i helped somebody make code for a free AI service and network, but they stopped working after i helped them. I am u/baffo32 . https://www.reddit.com/r/KoboldAI/comments/10penqx/i_am_trying_to_learn_how_... I am trying to learn how to use the KoboldAI Horde REST API with Python. Can you please help me to understand how can I generate text with it? So far I checked out the "REST API Full Documentation" from https://koboldai.net/api/ and managed do some simple things with it, but I fail to understand how can I generate text with it. I can do this to get a list of the available models in the horde: json2html.convert(requests.get("https://koboldai.net/api/v2/status/models").json()) This code gets the list of models in json format then coverts it into a simple html table. Then I can do this to get a list of the available workers in the horde: json2html.convert(requests.get("https://koboldai.net/api/v2/workers").json()) This code gets the detailed list of workers in json format then coverts it into a simple html table. So: I know that the model I want to use is available. (And of course I know the exact name of it.) I also know every ID and name (and all details) of every worker who is currently online in the horde and can generate stuff (text or image?) with that model. I know that the anonymous API key is "0000000000" and I am willing to wait long. The question: Knowing all this, how can I generate text by using the API? Sorry for being clueless, I just can't figure it out from reading the documentation. Please anyone help me. Thank you very much. :) ================================================= Update: Million thanks, for u/baffo32 for the info! I will read it through. payload and submit: https://github.com/kaihordewebui/kaihordewebui.github.io/blob/main/index.htm... poll and output: https://github.com/kaihordewebui/kaihordewebui.github.io/blob/04ffbe9d3c45e6... Here are all the server apis: https://github.com/db0/AI-Horde/tree/main/horde/apis" I will update my post again if I succeed with my creation. Thanks people! :) ================================================= Update: Thanks for the help of u/baffo32 for solving this problem! baffo32: "You are polling the url containing “/check/“ and then looking for generations in the output. An API url is called an endpoint (it can mean other things too). In the horde API, the generations are not available at the “/check/“ url. Instead, once done = True, you can perform a further request (also called a fetch or a get) to the url containing “/status/“ to get the generation result." I updated my code, and indeed the problem was that I was looking for the generated text at the "/check/" url, and I should have used instead the "/status/" url. Now it runs okay, and I even managed to compile it to a native binary for Linux. Later I will clean up the code, and complete/fix the documentation. Million thanks to u/baffo32! ================================================= Update: I left the PygmalionAI community, and cancelled my original project related to PygmalionAI. I will delete my old repo on codeberg, and start a new one, only related to KoboldAI. Source code won't be lost. I will update / edit the links in this post to make them point to my new repo tomorrow, when I will have time to do it. I will continue with building and improving my Kobold programs, but that won't be related to PygmalionAI. ================================================= Last Update: I am too tired to do anything today. I don't enjoy coding anymore. I don't enjoy doing anything anymore. I am back to depression. Doing everything feels like a burden, just an extra task to do after work. I feel like quitting now, and giving up on all of my plans. Maybe it's better this way.