Moldable Chat: Generating code

So, how do we get to generate code? We provide tools. And a bit of guidance in the form of explanations.

Say, you want to build a bubble sorter that you can try quickly. Ask for examples and see what happens:

c := GtLChat new
		tools: GtLTools gt;
		markdownResponse;
		gtPageExplanation: 'Rules for Moldable Development for Glamorous Toolkit';
		gtPageExplanation: 'Examples by example';
		gtPageExplanation: 'Inspector phlow views by example';
		sendMarkdown: 'Create a {{gtClass:BubbleSorter}} class implementing bubblesort. Create at least two examples for it in a separate class. Ensure that the examples are green.'
  

This likely worked as a first shot. Go change something in the algorithm, like changing the sign of the swap comparison in the algorithm, and then ask it to fix the examples:

c sendMarkdown: 'Check the examples about {{gtClass:BubbleSorter}}. If they are red, make them green'
  

Or ask it to transform the algorithm to retain explainable steps:

c sendMarkdown: 'Add an explicit object for each comparison step. The {{gtClass:BubbleSorterStep}} should remember the two items to compare, whether there was a swap and the state of the collection before the comparison. Add a view to exemplify the step. Add a view to exemplify the overall algorithm'
  

The chat above uses the default tools defined in GtLTools>>#gt gt ^ self gtSearch , self leSearch , self gtCodeChange , self leChange , self gtExamplesRun , {GtLMagritteToolForSmalltalkCodeEvaluation new. GtLToolForObjectView new. GtLToolForObjectStorageList new} . In addition it also has a vouple of explantion pages that we rely on for typical development. You can obtain the same setup in GtL>>#gt gt ^ GtLChatRegistry current newGtChat . Try it here with your prompt:

GtL gt sendMarkdown: ''