Unlocking AI in NetSuite - Key Features and Native LLM Capabilities

Unlocking AI in NetSuite - Key Features and Native LLM Capabilities

NetSuite has been actively incorporating Large Language Models (LLMs) and other AI capabilities into its platform. Here are some of the Key Features and Initiatives;

Text Enhance: This built-in feature uses generative AI to help users create and refine content within NetSuite. It can assist with writing item descriptions, job descriptions, and other text-based content, saving time and improving consistency. ?


NetSuite Text Enhance

NetSuite SuiteAnalytics Assistant: This assistant uses generative AI to help users retrieve information from their NetSuite data and generate reports using natural language queries. ?


NetSuite SuiteAnalytics Assistant

Prompt Studio: This tool allows administrators and developers to fine-tune the output of AI-generated content, ensuring it aligns with specific needs and preferences.


NetSuite Prompt Studio

NetSuite Financial Exception Management: This AI-powered tool automatically detects financial anomalies, helping businesses identify and address potential issues quickly.

SuiteScript Generative AI APIs: These APIs allow developers to integrate LLMs into NetSuite customizations and SuiteApps. This means you can build AI-powered functionalities like report generation, data summarization, and natural language processing directly within NetSuite.

/**
*@NApiVersion 2.1
*/
// This example shows how to send a Prompt to the LLM and Receive a Response
require(['N/llm'],
  function(llm) {        
    const response = llm.generateText({
      // modelFamily is optional. When omitted, the Cohere Command R model is used.
      // To try the Meta Llama model, remove the uncomment the line below
      // modelFamily: llm.ModelFamily.META_LLAMA,
      prompt: "Hello World!",
      modelParameters: {
        maxTokens: 1000,
        temperature: 0.2,
        topK: 3,
        topP: 0.7,
        frequencyPenalty: 0.4,
        presencePenalty: 0
      }
    });
    const responseText = response.text;
    // View remaining monthly free usage
    const remainingUsage = llm.getRemainingFreeUsage(); 
});          

NetSuite leverages Oracle Cloud Infrastructure (OCI) and its Generative AI services to power these AI capabilities. It ensures that customer data remains secure and private within the OCI environment.

SuiteScript Integration to External LLMs: NetSuite can also integrate with external LLMs via APIs. For example, here is a sample code using SuiteScript to interact with a Hugging Face LLM model through their Inference API:

/**
 * @NApiVersion 2.1
 * @NScriptType Suitelet
 */
define(['N/https', 'N/log', 'N/url'], function(https, log, url) {
    /**
     * Definition of the Suitelet script.
     * @param {Object} context - Contains request and response objects.
     */
    function onRequest(context) {
        if (context.request.method === 'GET') {
            let form = context.form;
            form.title = 'Hugging Face LLM Example';
            form.addField({
                id: 'custpage_input',
                type: 'textarea',
                label: 'Enter your text here'
            });

            form.addSubmitButton({
                label: 'Generate Text'
            });
            context.response.writePage(form);
        } else if (context.request.method === 'POST') {
            let inputText = context.request.parameters.custpage_input;
            if (inputText) {
                // Replace with your actual Hugging Face API key and model endpoint
                let hfApiKey = 'YOUR_HUGGING_FACE_API_KEY';
                // Example model
                let modelEndpoint = 'https://api-inference.huggingface.co/models/gpt2'; 

                let response = https.post({
                    url: modelEndpoint,
                    headers: {
                        'Authorization': 'Bearer ' + hfApiKey,
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        "inputs": inputText
                    })
                });

                if (response.code === 200) {
                    let generatedText = JSON.parse(response.body);
                    log.debug('Generated Text', generatedText);

                    let form = context.form;
                    form.title = 'Generated Text';
                    form.addField({
                        id: 'custpage_output',
                        type: 'textarea',
                        label: 'Generated Text',
                        defaultValue: JSON.stringify(generatedText)
                    });
                    context.response.writePage(form);
                } else {
                    log.error('API Error', 'Failed to generate text: ' + response.body);
                    context.response.write('Error: Failed to generate text.');
                }
            }
        }
    }

    return {
        onRequest: onRequest
    };
});
        

Advantages of NetSuite's N/llm Module versus Integration to External LLM:

  1. Integration Ease: The N/llm module is designed to work directly within NetSuite's ecosystem. This means less setup time and reduced complexity in terms of API calls, authentication, and data handling between systems.?Developers can leverage SuiteScript to interact with the LLM, reducing the learning curve.
  2. Performance: Since the N/llm module is native to NetSuite's infrastructure, it has a lower latency compared to making API calls to External LLMs. This results in enhanced responsiveness and better overall performance.
  3. Security and Compliance: Keeping data processing within NetSuite offers better control over data privacy and compliance with regulations like GDPR, HIPAA or CMMC, as there's no external transmission of data.
  4. Predictable Costs: With an integrated solution, costs is more predictable as it's part of the NetSuite service rather than being subject to external API call pricing which can fluctuate based various factors.
  5. Support and Maintenance: Support is provided directly by NetSuite for any issues related to the N/llm module usage. Updates to the LLM functionality are also managed by NetSuite, ensuring compatibility and potentially reducing maintenance overhead.

Disadvantages or Considerations:

  1. Limited Flexibility: If you need to use specific models or capabilities not available through N/llm module, you will find proprietary and public LLM libraries more advantageous. For example, Hugging Face offers a broad range of pre-trained models for various tasks, which are not all available or accessible through NetSuite's N/llm module.
  2. Innovation Pace: Proprietary and public LLM models are getting updated rapidly, offering newer, more advanced models than what might be available through NetSuite's N/llm module.


In summary, NetSuite is actively embracing LLMs and AI to enhance its platform and provide users with powerful tools to improve efficiency, decision-making, and overall productivity. The new LLM capabilities lets developers integrate generative AI models into NetSuite customizations and SuiteApps. Additionally, Oracle Code Assist - a code generation tool powered by LLM running on Oracle Cloud Infrastructure will be made available to assist NetSuite developers. It has the capability to generate, test, analyze, and explain code, delivering a major productivity boost.


Resources:

NetSuite N/llm Module Documentation

NetSuite SuiteScript 2.x Generative AI APIs


#LLM#GenerativeAI#AI#NetSuite


Bryan Flynn

Business Development Manager at Business Solution Partners

1 个月

Thanks, Hussain!

回复

Great post, Hussain! It's exciting to see NetSuite's AI features evolving. As businesses look into these new capabilities, it's key to know how to use them effectively and weigh the tradeoffs of built-in versus external AI solutions.

Anthony Meshnick

Helping companies scale through NetSuite

1 个月

Very insightful, Hussain! Thank you!

回复

要查看或添加评论,请登录

Hussain Zaidi的更多文章

社区洞察

其他会员也浏览了