Add generate_text usage example#767
Conversation
❌ Deploy Preview for splashkit failed.
|
ralphweng2023
left a comment
There was a problem hiding this comment.
Code's clean and easy to follow, four files line up logic-wise and the function is used as advertised. Couple of small things before this can merge:
- The OOP
.csfile is missing thenamespace GenerateTextExamplewrapper that other OOP examples use (see section 5 of the project's usage-example style guide, or similar examples under other categories). AlsoMain(string[] args)→Main(). Granted there's not a lot of "OOP" to show for a single static call, but worth matching the template so it stays consistent with the rest of the repo. - All five text files end without a trailing newline (the diff shows
\ No newline at end of filefor each). Small thing, easy to fix on re-save.
One question — does generate_text(prompt) work straight out of the box, or is there some model-loading / API-key step the user needs to set up first? If there's background setup, might be worth a one-liner comment in the code so a beginner with a blank response doesn't think it's broken.
Otherwise once those are sorted should be good to go.
jankiluitel
left a comment
There was a problem hiding this comment.
Reviewed the generate_text usage example PR. The implementation is clean, concise, and consistent across all supported languages. The example clearly demonstrates how to use the GenerateText functionality with simple beginner-friendly prompts and readable output formatting.
The included screenshot/example asset also supports the documentation well. Everything looks aligned with existing SplashKit usage example standards from my side.
222448082Ashen
left a comment
There was a problem hiding this comment.
Peer Review
I've reviewed the generate_text usage example.
Checks
- All required files present (title, C++, C# top-level, C# OOP, Python, screenshot)
- Code uses the documented SplashKit API (
generate_text(string)) - Example clearly demonstrates
- Cross-language implementations maintain matching structure and comments
Code Tests done
- C++ example validated
- C# top-level validated
- C# OOP validated (suggest minor style tweak)
- Python example validated
Website Tests done
-
npm run build(examples scraped and MDX generated) -
npm run preview(local preview runs; site config may warn)
Hi! I have addressed all the feedback:
Please let me know if anything else needs changing. Thank you! |
ralphweng2023
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. The OOP namespace wrap and Main() signature look good, and the "requires a local AI model" note in each language file is a nice touch — beginners running this with an empty response will know where to look.
One small thing the commit didn't quite catch: only the .txt actually got a trailing newline, the four code files (generate_text-1-example.cpp, .py, -top-level.cs, -oop.cs) still end without one. Not a blocker, just worth a quick re-save before merge.
Hi! I have now added trailing newlines to all 4 code files. |
Description
Adds usage example for the
generate_textfunction from SplashKit Generative AI API.Type of Change
Usage Example Details
Checklist