Closed AnanyaJha closed 1 year ago
Starting the prompt with apex\n
seems to fix this. We will be building that into the editor so that it is added automatically.
@AnanyaJha the apex language actually contains methods not functions. Apex Methods - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_defining_methods.htm LWC functions - An Apex method can for example be imported on LWC. That we call it function. https://developer.salesforce.com/docs/platform/lwc/guide/apex.html
@abrantes23 strictly speaking, there is a distinction between methods and functions, but practically speaking it isn't so wrong to describe apex methods as functions. sure, Apex doesn't have pure functions, but its common and correct enough to refer to apex methods as functions, and I think a tool meant to convert the intent of natural human language to executable code should not care about the kind of distinction that doesn't impact how the resulting code should be composed.
By the same distinction, much of the behavior written in LWC are written as class members, which are more "correctly" described as methods
This issue was resolved by further training of the LLM. Please reopen if you encounter a new prompt that generates something other then apex.
teachers-of-tomorrow
Sometimes, when I ask for a method to be created in Apex ie.
Create a function to take two numbers and print the sum
the generated response will be in a language other than Apex, ie. Python. If I'm working within an existing Apex file, I'd like the generated code to also be in Apex.