Chat with Dev Assistant
Dev Assistant is like having a coding partner who's ready to help you write Apex and LWC code. Just chat with it, write instructions, or ask questions. To access the chat interface, click the Agentforce icon in the Activity Bar. Once activated, Agentforce is grounded in the context of your open file, and the ongoing conversation. Dev Assistant suggests code based on what you write and the contents of the file you're working on in your Visual Studio Code editor. After you receive a response from Agentforce, make follow-up requests to fine-tune the response.
See Effective Prompt Writing to learn more about interacting with Dev Assistant.
To frame your query, use slash commands.They’re like ready-made prompt templates. Use them as-is or add details to get more specific responses. Type ‘/’ to see a list of available commands. After you get a response, keep chatting to increase the response accuracy.
Command | Prompt Description |
---|---|
/explain | Explain the code in the active editor. |
/test | Generate a test case. |
/document | Generate documentation for the given code block in the default documentation scheme for the current file's programming language. |
To enable or disable Retrieval Augmented Generation (RAG) in your workspace, go to Settings and search for "Agentforce for Developers". Use the RAG checkbox setting to turn it off or on. RAG generates context-aware responses to your prompts. This means that when RAG is activated, Agentforce considers information about SObjects in your DX project, the currently active file, and previous messages in the chat when generating a response. To get the correct information to the RAG framework before making your request, run SFDX: Refresh SObjects Definitions to bring org metadata in the form of object definitions into your project. For best outcomes, we recommend using RAG on devices with more than than 8 GB of RAM.
-
Ask general questions about building on Salesforce
How do I expose my Apex method to a Lightning Web Component?
-
Ask questions about your Salesforce project
/explain What is the
getSimilarProducts()
method doing? -
Write Apex and LWC code
Create a Lightning web component that uses the lightning-input attribute
-
Once you receive a response, follow up with:
In fact, I'd like to add a rich text input area to my LWC. Let's use the lightning-input-rich-text attribute.
-
Generate a test for a given Apex method
/test Generate a test for the
getSimilarProducts()
method -
What level of Apex code coverage do I currently have in my SFDX project?
-
Give me an example of how I would enforce USER_MODE in Apex
-
Add error handling to
getSimilarProducts()
from my editor
This is a list of known issues with Dev Assistant. The team is working on them internally. Check our github repo for issues related to Agentforce for Developers.
- We know that there can be incorrect spacing between words in the generated output. We're working on it.
- /explain explains everything in your active editor, regardless of your current selection.
- Even if you have multiple tabs open in the IDE, Agentforce considers the context of the active tab.
- Agentforce occasionally generates code or metadata that you don't have locally. Sometimes, Dev Assistant makes grammatical errors. To help us improve the model, report any errors you find in the prompt, response, and code by creating an issue in our GitHub repo.
- The model that powers Dev Assistant has been specifically trained to iteratively generate Apex code. This means it can generate more accurate and higher quality Apex code compared to its other responses. With continued fine-tuning efforts, we expect the model to iteratively serve better responses for other request types.