forcedotcom / Einstein-GPT-for-Developers

Einstein GPT For Developers
BSD 3-Clause "New" or "Revised" License
37 stars 9 forks source link

Generated responses are occasionally in languages other than Apex #1

Closed AnanyaJha closed 1 year ago

AnanyaJha commented 1 year ago

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.

wharley-sfdc commented 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.

abrantes23 commented 1 year ago

@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

jkranz-rk commented 1 year ago

@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

gbockus-sf commented 1 year ago

This issue was resolved by further training of the LLM. Please reopen if you encounter a new prompt that generates something other then apex.

alfonsocanor commented 1 month ago

teachers-of-tomorrow