Skip to content

Commit

Permalink
Merge branch 'develop' into cristi/logout-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
CristiCanizales committed Sep 12, 2023
2 parents 1449e6b + e2782dd commit a0f3707
Show file tree
Hide file tree
Showing 57 changed files with 1,057 additions and 143 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ jobs:
with:
path: ./salesforcedx-vscode
ref: ${{ github.event.ref }}
- uses: actions/setup-node@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodeVersion }}
cache: npm
cache-dependency-path: |
salesforcedx-vscode/package-lock.json
salesforcedx-vscode-automation-tests/package-lock.json
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Clone automation tests
uses: actions/checkout@v3
with:
Expand Down
22 changes: 11 additions & 11 deletions SHA256.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ make sure that their SHA values match the values in the list below.
following the instructions at
https://code.visualstudio.com/docs/editor/extension-gallery#_common-questions.
For example, download,
https://salesforce.gallery.vsassets.io/_apis/public/gallery/publisher/salesforce/extension/salesforcedx-vscode-core/58.14.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage.
https://salesforce.gallery.vsassets.io/_apis/public/gallery/publisher/salesforce/extension/salesforcedx-vscode-core/58.14.2/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage.

2. From a terminal, run:

shasum -a 256 <location_of_the_downloaded_file>

3. Confirm that the SHA in your output matches the value in this list of SHAs.

9ae83169d5c2ec1c8204f50b85b120145dda26dee4716d68a42db0e793e4322f salesforcedx-vscode-58.14.1.vsix
fb341b4368876b1a8ccdf17c7ab02df6fac40c626ff134e9db8cadd5a946db01 salesforcedx-vscode-apex-58.14.1.vsix
5b10ff565fbbbfabc34a7805cf1a088a21ed4af0143aa951c2623dc1e283f6f3 salesforcedx-vscode-apex-debugger-58.14.1.vsix
daaab5171e7581dddaf98d20c581a8f55e994c40c938b86c63e79e0e4cebbafd salesforcedx-vscode-apex-replay-debugger-58.14.1.vsix
05cfeac8da4a6f99c201e3cbb9d9b84bfc6fcc327ce7d2ee3b39cc29152ef3e2 salesforcedx-vscode-core-58.14.1.vsix
abba220a6eeb028f11a038004a747123bf2e0b917848a4b5ecd79d44934b275a salesforcedx-vscode-expanded-58.14.1.vsix
07e9ed9cf305635e590ce984cf4ebdc6b173c31052e1b6cc5eb27ffd877199fa salesforcedx-vscode-lightning-58.14.1.vsix
0c4512efcc689bbe06f5f5d1293835cfa77bb4f4d5374f407b93b9cd86cfc213 salesforcedx-vscode-lwc-58.14.1.vsix
096a4df9ee8631acae003e43ef49c31ff380dc6f78d92649d6b447e83836889a salesforcedx-vscode-soql-58.14.1.vsix
1e05f3fe079ad9ec8c68a8d3a1fa38609b05af55601a4193313454a460a55272 salesforcedx-vscode-visualforce-58.14.1.vsix
1c304ae2ca4d25ecbddb547fd75d71fd200d77d996e913fbeb73012bdbca0631 salesforcedx-vscode-58.14.2.vsix
7dec1f1312a49841ff98f5817c636c25c6b3dd6bf0d665296f952b8f0903b597 salesforcedx-vscode-apex-58.14.2.vsix
8f7fb69b0f09be28f853c22cb883d19fca42f743ed717b10f797b958fd19e8c8 salesforcedx-vscode-apex-debugger-58.14.2.vsix
a48c2c8e5cdbd93f76deaf770f12db28260f3cdffbfca421e54f5c9741256ae7 salesforcedx-vscode-apex-replay-debugger-58.14.2.vsix
89a3674fe75c7843b1df504f54756eba738ec9403f10d144d1fe7dce7fc2eb50 salesforcedx-vscode-core-58.14.2.vsix
198ef990de674e3e0a9203d21a5ec1e5b2981879f7f45a6f85eae12ad9802813 salesforcedx-vscode-expanded-58.14.2.vsix
e5ae2d82fc6598fa6c1e9f30e279ad66a88d6a2c8d883744c69678e69e445280 salesforcedx-vscode-lightning-58.14.2.vsix
17a5f9bf3a6ace8394a72bcddca671a1edfff28bebde52d5a62beb023ab1b298 salesforcedx-vscode-lwc-58.14.2.vsix
871a4c6f8b2fd19c432017c7f88d017b58819a038cf32d0c3d99519803a7c138 salesforcedx-vscode-soql-58.14.2.vsix
19193c66ebf631f37c08556d850e8d90a1aa277e2d6398cdb60e08e6bbf6c42f salesforcedx-vscode-visualforce-58.14.2.vsix


4. Change the filename extension for the file that you downloaded from .zip to
Expand Down
27 changes: 27 additions & 0 deletions docs/_articles/en/einstein/einstein-apex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Apex Code Generation
lang: en
---

## Generate Apex Code

Use the Einstein for Developers side bar to write a question or an instruction that describes the task for which you'd like to receive an Apex code suggestion and press **Ask**. Copy the code suggestion you received and paste it into an Apex file to use as "starter" code.

![Sidebar code generation](../../../images/einstein-sidebar.png)

## Use the Command Palette to Generate Apex Code

You can quickly access Einstein for Developers from inside an Apex file in the VS Code editor.

1. Open an existing Apex (`.cls`) file, or create one from the command palette by running the **SFDX: Create Apex Class** command.
2. Put your cursor on the line in the file where you want the generated code to be placed.
3. From the Command Palette, run **Einstein: Generate Code**.
4. For your query, enter a description of the code that you want to generate. For example, “`Write a method that takes an account as a parameter and returns all contacts associated with that account.`
5. Review the code that Einstein generates, and then click **Accept**, **Try Again**, or **Clear**.

Use our example prompts to learn how to get the most out of the generative AI tool.

**Tip**: To access the **Einstein: Generate Code** command through hotkeys, press Cmd+r (macOS) or Ctrl+r (Windows or Linux). You can customize these shortcuts. See [Keyboard Shortcuts editor](https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-editor).


You can customize these shortcuts. See [Keyboard Shortcuts editor](https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-editor).
148 changes: 148 additions & 0 deletions docs/_articles/en/einstein/einstein-example-prompts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
title: Example Prompts and Responses
lang: en
---

## Generated Code Quality

As with all LLM-based products, the technology behind Einstein for Developers is still new. The generated output often requires editing to be customized for your individual project. Some responses aren't optimal. We'd love to hear feedback from you on the generated output through the History & Feedback Panel in the IDE. Your feedback is critical to the continuous training of our large language model (LLM) during the beta program.

We strongly encourage you to let us know when you see examples of less optimal code, so that we can continue to improve generated responses. We recommend tools such as [Apex PMD](https://marketplace.visualstudio.com/items?itemName=chuckjonas.apex-pmd) (already in your Salesforce Extension Pack) and [Salesforce Code Analyzer](https://forcedotcom.github.io/sfdx-scanner/) to ensure the quality of your generated code.

## Prompt Writing Tips

Prompt writing is key to quality code generation. Here are some tips for improved prompt writing and a selection of sample prompts to start you on your generative AI code-assistance journey.

| Original Prompt | Improved Prompt |
| ------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Write Apex code that sorts the list of contacts. | Write Apex code that sorts the list of contacts alphabetically by last name. |
| Write a method that adds two numbers. | Write a method that adds two numbers and returns the result. |
| Write an Apex method that returns fields for an object. | Write an Apex method that accepts an SObject and returns a list of its fields. |

## Example Prompts and Responses

**Prompt:** Write an Apex method that accepts a list of sobjects and a field name and returns a set of non null field values.

**Response:**

```
public Set<String> getFieldValues(List<sObject> records, String fieldName) {
Set<String> fieldValues = new Set<String>();
for (sObject record : records) {
try {
Object fieldValue = record.get(fieldName);
if (fieldValue != null) {
fieldValues.add((String) fieldValue);
}
} catch (Exception e) {
system.debug('Error: ' + e.getMessage());
}
}
return fieldValues;
}
```

**Prompt:** Create an @invocable method that serializes an input list of sObjects and returns JSON.

**Response:**

```
@InvocableMethod(label='Create Account' description='Creates a new account with the specified name, number and symbol.' category='Account')
public static List<String> createAccounts(List<Account> accounts) {
List<String> response = new List<String>();
for (Account account : accounts) {
String jsonAccount = JSON.serialize(account);
response.add(jsonAccount);
}
return response;
}
```

**Prompt:** Write an Apex method that accepts product name as input and retrieves orderitems filtered on product name.

**Response**:

```
public List<OrderItem> getOrderItemsByProductName(String productName) {
List<OrderItem> orderItems = [SELECT Description FROM OrderItem WHERE ProductCode = :productName LIMIT 50];
return orderItems;
}
```

**Prompt:** Write an Apex trigger to add the number of contacts associated with an account.

```
trigger gptcontacttrigger on Account (after insert, after update) {
List<Contact> listContacts = new List<Contact>();
for (Account acc : Trigger.new) {
List<Contact> listaccContacts = [SELECT Id, Name, AccountId FROM Contact WHERE AccountId = :acc.Id];
if (acc.Contacts.size() < listaccContacts.size()) {
acc.addError('Not enough contacts');
}
}
}
```

## Edit a Prompt and Regenerate Output

A well designed prompt is key to getting a good response from Einstein. We encourage you to modify your prompts until you get Apex code that helps you complete your task at hand. When you use the `Einstein: Generate Code` command from the command palette, use the **Retry** and **Accept** options. In the sidebar, edit the prompt and click **Ask**.

For example, the prompt, "Write code to provide the ability to update the FirstName for a list of users" generates this response.

```
public with sharing class AccountService {
public Account createAccount( String accountName, String accountNumber, String tickerSymbol ) {
Account newAcct = new Account(
Name = accountName,
AccountNumber = accountNumber,
TickerSymbol = accountNumber
);
return newAcct;
}
// Function to update the FirstName for a list of users
public static List<User> updateFirstName(List<User> users, String newFirstName) {
for (User u : users) {
if (String.isNotBlank(u.FirstName)) {
u.FirstName = newFirstName;
}
}
return users;
}
```

This response is good, but you can edit the prompt to generate reusable code by creating a method.

Click **Retry** and edit the prompt for more specific output. Update the prompt to say, "Write code to provide the ability to update the FirstName for a list of users as a method". This is the new response.

```
public with sharing class AccountService {
public Account createAccount( String accountName, String accountNumber, String tickerSymbol ) {
Account newAcct = new Account(
Name = accountName,
AccountNumber = accountNumber,
TickerSymbol = accountNumber
);
return newAcct;
}
}
//This is a method that allows updating the FirstName for a list of users
public static void updateFirstName(List<User> users) {
for (User usr : users) {
if (usr.FirstName != null) {
usr.FirstName = 'New First Name';
}
}
}
```

If you like this output, click **Accept**. To update your prompt and regenerate new output, click **Retry**.
24 changes: 24 additions & 0 deletions docs/_articles/en/einstein/einstein-faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Einstein for Developers FAQ
lang: en
---

**What is Einstein for Developers?**

Einstein for Developers is an AI-assisted tooling that is available as an easy-to-install VS Code extension built using Einstein, the secure, custom AI model from Salesforce.

**What data has Einstein for Developers been trained on?**

Einstein for Developers uses our trusted generative AI, CodeGen, to assist you through Salesforce development. CodeGen uses expertise that’s learned from anonymized code patterns.

**Where can I learn more about Einstein for Developers Privacy and Data Protection?**

See [Trusted AI from Salesforce](https://www.salesforceairesearch.com/trusted-ai).

**Will my code ever be shared outside of my development environment?**

No. Salesforce treats your code as confidential information under your Main Service Agreement (MSA) and doesn't disclose it to other Salesforce customers or anyone outside of Salesforce. Some of your code and entity schema can be used to improve Einstein for Developers and train CodeGen. Due to the nature of machine learning, Einstein for Developers can generate output that resembles code that was used to train the model.

**I still have some security concerns, what if my code contains proprietary info?**

Before using any code to label or build models, the research team scrubs all personally identifiable information (PII) and secrets info from the code. This information includes names, company names, phone numbers, address, and hard-coded API tokens. The data is encrypted at rest using customer-managed encryption keys. See [Customer-managed encryption keys (CMEK)](https://cloud.google.com/kms/docs/cmek). We also ensure that only Salesforce employees handle your code, not contractors.
16 changes: 16 additions & 0 deletions docs/_articles/en/einstein/einstein-feedback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Einstein for Developers Feedback and Support
lang: en
---

## Feedback

From the Command Palette run **Einstein: Show Prompt History** to open the Feedback console. Use 👍, 👎and comments for each prompt to provide feedback. To ask questions, request features, and post feedback, use the [Discussions](https://github.com/forcedotcom/Einstein-GPT-for-Developers/discussions) tab.

## Support

If you need support, file an [issue](https://github.com/forcedotcom/Einstein-GPT-for-Developers/issues) in the GitHub repo. Our team triages all incoming issues and gets back to you as fast as we can.

**Note:** You need a github account to create an issue. If you don’t have a GitHub account, it’s easy (and free) to [sign up for one](https://github.com/join?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F&source=header-home).

If you want to provide general feedback, request product enhancements, start discussions with other Einstein for Developers users or the product team, and share best practices, use the [Einstein for Developers Trailblazer Group](https://trailhead.salesforce.com/trailblazer-community/groups/0F94V000000oRJs?tab=discussion&sort=LAST_MODIFIED_DATE_DESC).
25 changes: 25 additions & 0 deletions docs/_articles/en/einstein/einstein-glossary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Einstein for Developers Glossary
lang: en
---

This glossary defines generative AI terms that appear throughout the Einstein documentation.

**generative pre-trained transformer (GPT):** A family of language models developed by OpenAI that are generally trained on a large corpus of text data so they can generate human-like text.

**grounding:** The process used to inject domain-specific knowledge and customer information into the prompt.
human in the loop (HITL): A model that requires human interaction.

**intent:** A user’s goal for interacting with the AI assistant.

**large language model (LLM):** A language model consisting of a neural network with many parameters trained on large quantities of text.

**prompt:** A natural language description of the task to be done. An input to the LLM.

**prompt management:** The suite of tools used to build, manage, package, and share prompts, including the prompt templates and the prompt template store.

**prompt template:** A string with placeholders/tags that can be replaced with custom values to generate a final prompt. The template includes the hyperparameters associated with that prompt and your choice of model/vendor if you're not using default values.

**prompt chaining:** The method to select the right prompt engineering, which is a break-up of complex tasks into several intermediate steps, and then tie it back together in the hope that the AI generates a more concrete, customized, and thus better result. To get the best prompt, use the “Retry” option to regenerate code.

**semantic retrieval:** A scenario where a large language model uses all the knowledge that exists in a customer's CRM data. Each CRM user has access to a personalized generative AI.
Loading

0 comments on commit a0f3707

Please sign in to comment.