untoldwind / KontrolSystem2

Autopilot scripting system for KSP2
Other
54 stars 14 forks source link

Generate PDF version of documentation for ChatGPT #147

Closed MoreTore closed 3 weeks ago

MoreTore commented 3 months ago

Would be useful to have a pdf version of the docs so that we can provide the docs to chatgpt to write scripts for us.

untoldwind commented 3 months ago

Actually very easy, just had to be turned on: https://readthedocs.org/projects/kontrolsystem2/downloads/ ... and does not even look half as bad.

MoreTore commented 3 months ago

Actually very easy, just had to be turned on: https://readthedocs.org/projects/kontrolsystem2/downloads/ ... and does not even look half as bad.

Perfect! I knew it was easy if you were the maintainer. I'll make a GPT!

untoldwind commented 3 months ago

Not sure if it is helpful for this purpose, but there is also this: https://github.com/untoldwind/KontrolSystem2/blob/master/Tools/vscode/to2-syntax/server/src/reference/reference.json

Which contains all the information of the "reference" section in a machine readable way.

MoreTore commented 3 months ago

Cool I created this GPT and it seems pretty good. It at least gets the syntax mostly right and can use the functions and search the docs.

https://chat.openai.com/g/g-1XLTpfjxg-kerbal-space-program-kontrolsystems2-writer

Here is an example convo that I thought was pretty good. Unfortunately it's still making some syntax mistakes.

https://chat.openai.com/share/5c8783dc-19ed-4b6a-906a-536bcd7089ec

Or another example:

https://chat.openai.com/share/0c18d21f-c311-40e4-be48-edad9152b070

MoreTore commented 3 months ago

Not sure if it is helpful for this purpose, but there is also this: https://github.com/untoldwind/KontrolSystem2/blob/master/Tools/vscode/to2-syntax/server/src/reference/reference.json

Which contains all the information of the "reference" section in a machine readable way.

I think it would be possible to use the reference with a GPT action to check the syntax. Not sure exactly the best way to provide feedback to gpt tho.

Ideally it would do something like this:

let current_speed = vessel.surface_velocity.magnitude()

The action will parse the reference syntax tree and it will report the the error like "magnitude not a function of Type Vec3::surface_velocity. Possible members and functions are []"

And then gpt could iteratively fix the code.

untoldwind commented 3 months ago

I have not looked into (the OpenAI) GPT actions yet, but if they have support for javascript/typescript, there is this: https://github.com/untoldwind/KontrolSystem2/blob/8437adeb5bad4c845ddc6999af4069c619d47e6c/Tools/vscode/to2-syntax/server/src/to2/parser-module.ts#L225 which creates a parser https://github.com/untoldwind/KontrolSystem2/blob/8437adeb5bad4c845ddc6999af4069c619d47e6c/Tools/vscode/to2-syntax/server/src/parser/index.ts#L109 for a to2 file. (The DocumentUri is somewhat specific to vscode, but could just be left blank if just the syntax should be checked)

I guess with some minor adjustments this could be converted into a validator for reinforced learning.

PhilouDS commented 3 months ago

Cool I created this GPT and it seems pretty good. It at least gets the syntax mostly right and can use the functions and search the docs.

https://chat.openai.com/g/g-1XLTpfjxg-kerbal-space-program-kontrolsystems2-writer

Unfortunately, I can't access this because I use the free version of chat GPT. I'm curious: is it easy to create this GPT from the doc? How does it work?

MoreTore commented 3 months ago

Cool I created this GPT and it seems pretty good. It at least gets the syntax mostly right and can use the functions and search the docs.

https://chat.openai.com/g/g-1XLTpfjxg-kerbal-space-program-kontrolsystems2-writer

Unfortunately, I can't access this because I use the free version of chat GPT. I'm curious: is it easy to create this GPT from the doc? How does it work?

Yea it's easy to make you just gotta fiddle with the instructions for an hour to get the type of responses your looking for. You basically just provide it with the pdf and some code examples in its "Knowledge" and give it instructions like:

If a user asks you to implement some control system in the game, you should provide a high level overview of the plan. Then read the documentation to understand the standard existing functions and syntax that is available with KontrolSystems2 mod. Then you will provide code that will satisfy the users request if possible.

After writing a code implementation, you should check your knowledge again to fill in any placeholder values you may have used that you were unsure of initially.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.