{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":636,"path":"api-reference/scripts/generate-code-with-autocomplete.md","title":"Generate code with autocomplete","bundle":null,"doc_type":null,"release":"australia","body":"\n# Generate code with autocomplete\n\nThe autocomplete feature of ServiceNow Otto for Code provides you with contextually relevant code suggestions.\n\n## Before you begin\n\nRole required: now.assist.creator\n\n## Procedure\n\n1.  Navigate to any script editor enabled with ServiceNow Otto for Code.\n\n    For example, to open a script include form, navigate to **All** &gt; **System Definition** &gt; **Script Includes** and select a script include.\n\n2.  Start coding in the script editor.\n\n    When you stop typing, a code suggestion is displayed in grey within a few seconds.\n\n    **Note:**\n\n    Retrieval-Augmented Generation \\(RAG\\) enhances auto-complete suggestions and minimizes inaccuracies or hallucinations.\n\n    It may take a few seconds for the code suggestions to appear.\n\n3.  Review the code suggestions generated by the AI and decide whether to accept or reject them:\n\n    -   Press the **tab** key to accept the code suggestion.\n\n        If you accept the code suggestion, it's added to the script.\n\n    -   Press the **esc** key to reject the code suggestion or continue typing.\n\n        If you reject the code suggestion, it isn't added to the script.\n\n4.  After accepting the code suggestions, select **Save**.\n\n5.  Select **Update** to save the script.\n\n    The code suggestion is saved within the script.\n\n    **Note:**\n\n    To disable autocomplete for your session, select **Settings** in the script editor and turn off the **Autocomplete** toggle.\n\n    \\[Omitted image \"soc-settings.png\"\\] Alt text: To disable autocomplete for your session, select Settings in the script editor and turn off the Autocomplete toggle.\n\n\n"}}