There is no doubt that the term “Gen AI” (short for Generative AI) has grabbed everyone’s attention. Because of its potential applications across industries and disciplines, everybody wants to test the technology and identify its use cases. Chat GPT and Google Gemini have now become personal assistants for professionals and non-professions alike when it comes to producing drafts, generating ideas, or exploring debugging solutions.
It has become a buzzing topic for discussion in all professional spheres, and now a personal goal for individuals to learn more about it before their next review ?
Either way, it’s interesting to know how GenAI works.
Towards this end, I tried out our own SAP AI Core to get some hands-on experience of this technology by creating a chat assistant.
Purpose: To use ‘generative-ai-hub-sdk’ to access the ‘gpt-35-turbo’ LLM model from SAP’s Generative AI Hub in AI Core
Required Pre-requisite Steps:
First, provision SAP AI core entitlement in SAP BTP cockpit and create the corresponding instance with sap-internal service plan and generate the service key.The service key details enable us to derive the authentication using the clientid, clientsecret and request auth_url that is used to generate Auth Token. Then, save the following values as .env file with below details.
Next, create the deployment configuration using the curl command below that provides the executable, model Name and model Version
In response, it would provide the configurationid, which then needs to be passed to start the deployment and provide a deploymentId
Once the desired LLM is deployed, it would help the bot to understand the text-based context. LLM is built using deep learning techniques, which is what enables it to capture complex patterns in language based on the specification of various parameters.
Next, I defined the chat interface using the LangChain PromptTemplates, and tried langchain.memory ConversationBufferWindowMemory to store the chat history.
The ChatPromptTemplate displayed above helps structure and format prompts to design the interface for multi turn interaction.
SystemMessagePromptTemplate sets the initial context or behaviour for the AI.HumanMessagePromptTemplate represents the user’s input.AIMessagePromptTemplate is used to generate the AI’s response.
‘temperature’, ‘max_tokens’, and ‘top_p’ are parameters in a model that determine the behavior of the chat bot and help fine tune its output.
Higher values of temperature (e.g. 0.7 to 1.0) make the output more random and creative, while lower values (e.g. 0.0 to 0.3) make focused and deterministic.The parameter max_tokens determine the maximum number of tokens (words or word pieces) that the model generates in its response.top_p controls the cumulative probability for nucleus sampling.
And here’s the output:
You are only a few steps away from creating your own chat bot and playing around with its functionalities.
This may well be the small start for those who are yet to venture into the exciting applications of generative AI.
Useful References:
Learning how to use the SAP AI Core service on SAP Business Techn
Prompt LLMs in the generative AI hub in SAP AI Core & Launchpad | SAP Tutorials
There is no doubt that the term “Gen AI” (short for Generative AI) has grabbed everyone’s attention. Because of its potential applications across industries and disciplines, everybody wants to test the technology and identify its use cases. Chat GPT and Google Gemini have now become personal assistants for professionals and non-professions alike when it comes to producing drafts, generating ideas, or exploring debugging solutions.It has become a buzzing topic for discussion in all professional spheres, and now a personal goal for individuals to learn more about it before their next review ? Either way, it’s interesting to know how GenAI works.Towards this end, I tried out our own SAP AI Core to get some hands-on experience of this technology by creating a chat assistant.Purpose: To use ‘generative-ai-hub-sdk’ to access the ‘gpt-35-turbo’ LLM model from SAP’s Generative AI Hub in AI Core Required Pre-requisite Steps:First, provision SAP AI core entitlement in SAP BTP cockpit and create the corresponding instance with sap-internal service plan and generate the service key.The service key details enable us to derive the authentication using the clientid, clientsecret and request auth_url that is used to generate Auth Token. Then, save the following values as .env file with below details.Next, create the deployment configuration using the curl command below that provides the executable, model Name and model VersionIn response, it would provide the configurationid, which then needs to be passed to start the deployment and provide a deploymentIdOnce the desired LLM is deployed, it would help the bot to understand the text-based context. LLM is built using deep learning techniques, which is what enables it to capture complex patterns in language based on the specification of various parameters. Next, I defined the chat interface using the LangChain PromptTemplates, and tried langchain.memory ConversationBufferWindowMemory to store the chat history.The ChatPromptTemplate displayed above helps structure and format prompts to design the interface for multi turn interaction.SystemMessagePromptTemplate sets the initial context or behaviour for the AI.HumanMessagePromptTemplate represents the user’s input.AIMessagePromptTemplate is used to generate the AI’s response. ‘temperature’, ‘max_tokens’, and ‘top_p’ are parameters in a model that determine the behavior of the chat bot and help fine tune its output. Higher values of temperature (e.g. 0.7 to 1.0) make the output more random and creative, while lower values (e.g. 0.0 to 0.3) make focused and deterministic.The parameter max_tokens determine the maximum number of tokens (words or word pieces) that the model generates in its response.top_p controls the cumulative probability for nucleus sampling. And here’s the output:You are only a few steps away from creating your own chat bot and playing around with its functionalities.This may well be the small start for those who are yet to venture into the exciting applications of generative AI. Useful References:Learning how to use the SAP AI Core service on SAP Business TechnPrompt LLMs in the generative AI hub in SAP AI Core & Launchpad | SAP Tutorials Read More Technology Blogs by SAP articles
#SAP
#SAPTechnologyblog
+ There are no comments
Add yours