├── .abapgit.xml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── SUPPORT.md └── src ├── package.devc.xml └── zpengg_ai_openai_main ├── package.devc.xml ├── zpengg_ai_openai ├── package.devc.xml ├── zpengg_oai_demos │ ├── package.devc.xml │ ├── zp_aisdkdemo_chtcmpl_smpl_oai.prog.abap │ ├── zp_aisdkdemo_chtcmpl_smpl_oai.prog.xml │ ├── zp_aisdkdemo_embeddings_oai.prog.abap │ ├── zp_aisdkdemo_embeddings_oai.prog.xml │ ├── zp_msaisdkdemo_completion_oai.prog.abap │ ├── zp_msaisdkdemo_completion_oai.prog.xml │ ├── zp_msaisdkdemo_files_oai.prog.abap │ ├── zp_msaisdkdemo_files_oai.prog.xml │ ├── zp_msaisdkdemo_finetunes_oai.prog.abap │ ├── zp_msaisdkdemo_finetunes_oai.prog.xml │ ├── zp_msaisdkdemo_models_oai.prog.abap │ ├── zp_msaisdkdemo_models_oai.prog.xml │ ├── zp_msaisdkdemo_params_top_oai.prog.abap │ └── zp_msaisdkdemo_params_top_oai.prog.xml ├── zpengg_oai_sdk_core │ ├── package.devc.xml │ ├── zcl_peng_oai_urlprovider.clas.abap │ ├── zcl_peng_oai_urlprovider.clas.xml │ ├── zif_peng_oai_sdk_constants.intf.abap │ ├── zif_peng_oai_sdk_constants.intf.xml │ ├── zif_peng_oai_sdk_uripatterns.intf.abap │ └── zif_peng_oai_sdk_uripatterns.intf.xml └── zpengg_oai_sdk_v1 │ ├── package.devc.xml │ ├── zcl_peng_oai_sdk_v1_chatcompl.clas.abap │ ├── zcl_peng_oai_sdk_v1_chatcompl.clas.xml │ ├── zcl_peng_oai_sdk_v1_complet.clas.abap │ ├── zcl_peng_oai_sdk_v1_complet.clas.xml │ ├── zcl_peng_oai_sdk_v1_embeding.clas.abap │ └── zcl_peng_oai_sdk_v1_embeding.clas.xml ├── zpengg_ai_openai_azure ├── package.devc.xml └── zpengg_ai_openai_azure_sdk │ ├── package.devc.xml │ ├── zaisdkprofile.tran.xml │ ├── zcl_peng_azoai_sdk_factory.clas.abap │ ├── zcl_peng_azoai_sdk_factory.clas.xml │ ├── zpengg_azoai_sdk_config │ ├── package.devc.xml │ ├── zde_azoaisdk_callbackclass.dtel.xml │ ├── zde_azoaisdk_inactive.dtel.xml │ ├── zde_azoaisdk_profileid.dtel.xml │ ├── zde_azoaisdk_sysid.dtel.xml │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conff00.abap │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conff00.xml │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_confi00.abap │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_confi00.xml │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conft00.abap │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conft00.xml │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conftop.abap │ ├── zfgazoaisdk_conf.fugr.lzfgazoaisdk_conftop.xml │ ├── zfgazoaisdk_conf.fugr.saplzfgazoaisdk_conf.abap │ ├── zfgazoaisdk_conf.fugr.saplzfgazoaisdk_conf.xml │ ├── zfgazoaisdk_conf.fugr.tableframe_zfgazoaisdk_conf.abap │ ├── zfgazoaisdk_conf.fugr.tableproc_zfgazoaisdk_conf.abap │ ├── zfgazoaisdk_conf.fugr.xml │ ├── ztaisdkrunprofil.tabl.xml │ └── ztaisdkrunprofils.tobj.xml │ ├── zpengg_azoai_sdk_core │ ├── package.devc.xml │ ├── zcl_peng_ai_sdk_chatcompl_base.clas.abap │ ├── zcl_peng_ai_sdk_chatcompl_base.clas.xml │ ├── zcl_peng_azoai_centralcontrol.clas.abap │ ├── zcl_peng_azoai_centralcontrol.clas.xml │ ├── zcl_peng_azoai_sdk_base.clas.abap │ ├── zcl_peng_azoai_sdk_base.clas.xml │ ├── zcl_peng_azoai_sdk_compl_base.clas.abap │ ├── zcl_peng_azoai_sdk_compl_base.clas.xml │ ├── zcl_peng_azoai_sdk_component.clas.abap │ ├── zcl_peng_azoai_sdk_component.clas.xml │ ├── zcl_peng_azoai_sdk_config_base.clas.abap │ ├── zcl_peng_azoai_sdk_config_base.clas.xml │ ├── zcl_peng_azoai_sdk_deploy_base.clas.abap │ ├── zcl_peng_azoai_sdk_deploy_base.clas.xml │ ├── zcl_peng_azoai_sdk_embed_base.clas.abap │ ├── zcl_peng_azoai_sdk_embed_base.clas.xml │ ├── zcl_peng_azoai_sdk_file_base.clas.abap │ ├── zcl_peng_azoai_sdk_file_base.clas.xml │ ├── zcl_peng_azoai_sdk_fintun_base.clas.abap │ ├── zcl_peng_azoai_sdk_fintun_base.clas.xml │ ├── zcl_peng_azoai_sdk_helper.clas.abap │ ├── zcl_peng_azoai_sdk_helper.clas.xml │ ├── zcl_peng_azoai_sdk_model_base.clas.abap │ ├── zcl_peng_azoai_sdk_model_base.clas.xml │ ├── zcl_peng_azoai_urlprovider.clas.abap │ ├── zcl_peng_azoai_urlprovider.clas.xml │ ├── zcx_peng_azoai_sdk_exception.clas.abap │ ├── zcx_peng_azoai_sdk_exception.clas.xml │ ├── zif_peng_ai_sdk_comp_chatcompl.intf.abap │ ├── zif_peng_ai_sdk_comp_chatcompl.intf.xml │ ├── zif_peng_azoai_centralcontrol.intf.abap │ ├── zif_peng_azoai_centralcontrol.intf.xml │ ├── zif_peng_azoai_sdk.intf.abap │ ├── zif_peng_azoai_sdk.intf.xml │ ├── zif_peng_azoai_sdk_comp_compl.intf.abap │ ├── zif_peng_azoai_sdk_comp_compl.intf.xml │ ├── zif_peng_azoai_sdk_comp_deploy.intf.abap │ ├── zif_peng_azoai_sdk_comp_deploy.intf.xml │ ├── zif_peng_azoai_sdk_comp_embed.intf.abap │ ├── zif_peng_azoai_sdk_comp_embed.intf.xml │ ├── zif_peng_azoai_sdk_comp_files.intf.abap │ ├── zif_peng_azoai_sdk_comp_files.intf.xml │ ├── zif_peng_azoai_sdk_comp_fintun.intf.abap │ ├── zif_peng_azoai_sdk_comp_fintun.intf.xml │ ├── zif_peng_azoai_sdk_comp_model.intf.abap │ ├── zif_peng_azoai_sdk_comp_model.intf.xml │ ├── zif_peng_azoai_sdk_component.intf.abap │ ├── zif_peng_azoai_sdk_component.intf.xml │ ├── zif_peng_azoai_sdk_config.intf.abap │ ├── zif_peng_azoai_sdk_config.intf.xml │ ├── zif_peng_azoai_sdk_constants.intf.abap │ ├── zif_peng_azoai_sdk_constants.intf.xml │ ├── zif_peng_azoai_sdk_types.intf.abap │ ├── zif_peng_azoai_sdk_types.intf.xml │ ├── zif_peng_azoai_sdk_typinternal.intf.abap │ ├── zif_peng_azoai_sdk_typinternal.intf.xml │ ├── zif_peng_azoai_sdk_uripatterns.intf.abap │ ├── zif_peng_azoai_sdk_uripatterns.intf.xml │ └── zmspeng_azoaisdk_msg.msag.xml │ ├── zpengg_azoai_sdk_demos │ ├── package.devc.xml │ ├── zp_aisdkdemo_chatcompl.prog.abap │ ├── zp_aisdkdemo_chatcompl.prog.xml │ ├── zp_aisdkdemo_chatcompl_simple.prog.abap │ ├── zp_aisdkdemo_chatcompl_simple.prog.xml │ ├── zp_aisdkdemo_embeddings.prog.abap │ ├── zp_aisdkdemo_embeddings.prog.xml │ ├── zp_msaisdkdemo_chatui.prog.abap │ ├── zp_msaisdkdemo_chatui.prog.xml │ ├── zp_msaisdkdemo_chatui_def.prog.abap │ ├── zp_msaisdkdemo_chatui_def.prog.xml │ ├── zp_msaisdkdemo_chatui_top.prog.abap │ ├── zp_msaisdkdemo_chatui_top.prog.xml │ ├── zp_msaisdkdemo_common.prog.abap │ ├── zp_msaisdkdemo_common.prog.xml │ ├── zp_msaisdkdemo_deployments.prog.abap │ ├── zp_msaisdkdemo_deployments.prog.xml │ ├── zp_msaisdkdemo_files.prog.abap │ ├── zp_msaisdkdemo_files.prog.xml │ ├── zp_msaisdkdemo_finetunes.prog.abap │ ├── zp_msaisdkdemo_finetunes.prog.xml │ ├── zp_msaisdkdemo_models.prog.abap │ ├── zp_msaisdkdemo_models.prog.xml │ ├── zp_msaisdkdemo_params_top.prog.abap │ ├── zp_msaisdkdemo_params_top.prog.xml │ ├── zp_msaisdkdemo_selection.prog.abap │ ├── zp_msaisdkdemo_selection.prog.xml │ ├── zp_pengg_azoai_demo_completion.prog.abap │ └── zp_pengg_azoai_demo_completion.prog.xml │ └── zpengg_azoai_sdk_v1 │ ├── package.devc.xml │ ├── zcl_peng_ai_sdk_v1_chatcomplet.clas.abap │ ├── zcl_peng_ai_sdk_v1_chatcomplet.clas.xml │ ├── zcl_peng_azoai_ctrl_denyall.clas.abap │ ├── zcl_peng_azoai_ctrl_denyall.clas.xml │ ├── zcl_peng_azoai_sdk_v1.clas.abap │ ├── zcl_peng_azoai_sdk_v1.clas.xml │ ├── zcl_peng_azoai_sdk_v1_complet.clas.abap │ ├── zcl_peng_azoai_sdk_v1_complet.clas.xml │ ├── zcl_peng_azoai_sdk_v1_config.clas.abap │ ├── zcl_peng_azoai_sdk_v1_config.clas.xml │ ├── zcl_peng_azoai_sdk_v1_deploy.clas.abap │ ├── zcl_peng_azoai_sdk_v1_deploy.clas.xml │ ├── zcl_peng_azoai_sdk_v1_embeding.clas.abap │ ├── zcl_peng_azoai_sdk_v1_embeding.clas.xml │ ├── zcl_peng_azoai_sdk_v1_file.clas.abap │ ├── zcl_peng_azoai_sdk_v1_file.clas.xml │ ├── zcl_peng_azoai_sdk_v1_finetune.clas.abap │ ├── zcl_peng_azoai_sdk_v1_finetune.clas.xml │ ├── zcl_peng_azoai_sdk_v1_model.clas.abap │ └── zcl_peng_azoai_sdk_v1_model.clas.xml └── zpengg_ai_openai_utils ├── package.devc.xml ├── zcl_peng_aisdk_templprov_base.clas.abap ├── zcl_peng_aisdk_templprov_base.clas.xml ├── zcl_peng_aisdk_templprovider.clas.abap ├── zcl_peng_aisdk_templprovider.clas.xml ├── zif_peng_aisdk_endpt_provider.intf.abap └── zif_peng_aisdk_endpt_provider.intf.xml /.abapgit.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E 6 | /src/ 7 | FULL 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Microsoft AI SDK for SAP Version 2.0 2 | 3 | - **[Microsoft AI SDK for SAP Documentation](https://microsoft.github.io/aisdkforsapabap/)** 4 | 5 | - **[Discussion Forum](https://github.com/microsoft/aisdkforsapabap/discussions)** 6 | 7 | - **[Issues/Bug reporting](https://github.com/microsoft/aisdkforsapabap/issues)** 8 | 9 | ## What is Microsoft AI SDK for SAP? 10 | AI SDK for SAP is a software development kit (SDK) designed to provide SAP ABAP developers with the tools needed to create intelligent enterprise applications using artificial intelligence (AI) technologies. 11 | 12 | Microsoft AI SDK for SAP ABAP is designed to be user-friendly, with an intuitive interface that allows developers to easily integrate AI capabilities into ABAP applications. 13 | 14 | Current version is **2.0**, and supports the following AI Engines: 15 | - Azure Open AI 16 | - Open AI. 17 | --- 18 | 19 | ## What is Azure Open AI? 20 | 21 | Azure Open AI is a comprehensive set of AI services and tools provided by Microsoft Azure. It includes powerful machine learning algorithms, natural language processing tools, and cognitive services that can be used to build intelligent applications that can recognize patterns, process natural language, and make predictions based on data. Azure Open AI features pre-built AI models and algorithms, as well as tools for custom model training and deployment. 22 | 23 | 24 | **[Azure Open AI security, compliance, and data privacy](https://learn.microsoft.com/en-us/legal/cognitive-services/openai/data-privacy?context=%2Fazure%2Fcognitive-services%2Fopenai%2Fcontext%2Fcontext).** 25 | 26 | 27 | 28 | ## What is Open AI? 29 | OpenAI is an artificial intelligence research organization that aims to create safe and beneficial AI for humanity. It was founded in 2015 by a group of prominent tech entrepreneurs and researchers. OpenAI conducts cutting-edge research on topics such as generative models, natural language processing, computer vision, and reinforcement learning. It also develops products and platforms that enable anyone to access and use its AI models, such as the OpenAI API and ChatGPT. OpenAI's vision is to create artificial general intelligence (AGI) that can benefit all of humanity without causing harm or being influenced by vested interests. 30 | 31 | >**NOTE** : The above write up about Open AI was generated with [Bing AI Chatbot](https://www.microsoft.com/en-us/bing?form=MA13FJ). 32 | 33 | 34 | 35 | --- 36 | 37 | Using AI SDK for SAP ABAP v 2.0 and integrating AI with SAP ABAP/SAP business processes, developers can create innovative applications that can automate manual tasks, make smarter business decisions, and provide more personalized customer experiences. 38 | 39 | 40 | 41 | # Contributing 42 | 43 | This project is currently in active development. At this time, suggestions and feature requests are most welcome. Please use the discussion forum for exchanging ideas and brainstorming with the community. 44 | 45 | In future, this project will be open to contributions. 46 | 47 | ## Trademarks 48 | 49 | This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 50 | trademarks or logos is subject to and must follow 51 | [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 52 | Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. 53 | Any use of third-party trademarks or logos are subject to those third-party's policies. 54 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # TODO: The maintainer of this repo has not yet edited this file 2 | 3 | **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? 4 | 5 | - **No CSS support:** Fill out this template with information about how to file issues and get help. 6 | - **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps. 7 | - **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide. 8 | 9 | *Then remove this first heading from this SUPPORT.MD file before publishing your repo.* 10 | 11 | # Support 12 | 13 | ## How to file issues and get help 14 | 15 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 16 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 17 | feature request as a new Issue. 18 | 19 | For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE 20 | FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER 21 | CHANNEL. WHERE WILL YOU HELP PEOPLE?**. 22 | 23 | ## Microsoft Support Policy 24 | 25 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above. 26 | -------------------------------------------------------------------------------- /src/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: SAP to AI Integration Modules 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering:Open AI Main Package 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering : Open AI Integration 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Open AI demos 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_aisdkdemo_chtcmpl_smpl_oai.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report ZP_AISDKDEMO_CHTCMPL_SMPL_OAI 3 | *&---------------------------------------------------------------------* 4 | *& 5 | *&---------------------------------------------------------------------* 6 | REPORT zp_aisdkdemo_chtcmpl_smpl_oai. 7 | INCLUDE zp_msaisdkdemo_params_top_oai. "Common Input Parameters (AI End Point, Version, Key) 8 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 9 | 10 | PARAMETERS: 11 | p_depid TYPE string OBLIGATORY LOWER CASE. 12 | 13 | DATA: 14 | chatcompl_input TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_input, 15 | chatcompl_output TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_output. 16 | 17 | 18 | START-OF-SELECTION. 19 | 20 | TRY. 21 | * Create an instance of MS AI SDK for SAP. 22 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 23 | api_version = p_ver 24 | api_base = p_url 25 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-openai 26 | api_key = p_key 27 | ). 28 | 29 | * Construct the prompt with system and user roles. 30 | APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING FIELD-SYMBOL(). 31 | -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-system. 32 | -content = |You are an expert ABAP Developer|. 33 | 34 | APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING . 35 | -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-user. 36 | -content = |Write an ABAP program which gets contents from www.microsoft.com website. Include comments in the code so that anyone can understand the code.|. 37 | 38 | * Invoke Chat completion. 39 | sdk_instance->chat_completions( )->create( 40 | EXPORTING 41 | deploymentid = p_depid 42 | prompts = chatcompl_input 43 | IMPORTING 44 | statuscode = status_code " Status Code 45 | statusreason = status_reason " HTTP status description 46 | json = returnjson " JSON String returned from AI Resource 47 | response = chatcompl_output 48 | error = error " ABAP Ready error details 49 | ). 50 | 51 | * Display the results. 52 | cl_demo_output=>display_text( text = chatcompl_output-choices[ 1 ]-message-content ). 53 | 54 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 55 | MESSAGE ex TYPE 'I'. 56 | 57 | CATCH cx_root. 58 | MESSAGE |An error occured - perhaps the model name is incorrect? Or Access key is incorrect?| TYPE 'I'. 59 | 60 | ENDTRY. 61 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_aisdkdemo_chtcmpl_smpl_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_AISDKDEMO_CHTCMPL_SMPL_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo program for Open AI Chat Completions 16 | 61 17 | 18 | 19 | S 20 | P_DEPID 21 | Model ID 22 | 16 23 | 24 | 25 | S 26 | P_KEY 27 | API Key 28 | 15 29 | 30 | 31 | S 32 | P_URL 33 | Base URL 34 | 16 35 | 36 | 37 | S 38 | P_VER 39 | Version 40 | 15 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_aisdkdemo_embeddings_oai.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report ZP_AISDKDEMO_EMBEDDINGS_OAI 3 | *&---------------------------------------------------------------------* 4 | *& 5 | *&---------------------------------------------------------------------* 6 | REPORT zp_aisdkdemo_embeddings_oai. 7 | INCLUDE zp_msaisdkdemo_params_top_oai. "Common Input Parameters (AI End Point, Version, Key) 8 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 9 | 10 | 11 | PARAMETERS: 12 | p_depid TYPE string OBLIGATORY LOWER CASE. 13 | 14 | DATA: 15 | embeddings_input TYPE zif_peng_azoai_sdk_types=>ty_embeddings_input, 16 | embeddings_output TYPE zif_peng_azoai_sdk_types=>ty_embeddings_output. 17 | 18 | 19 | START-OF-SELECTION. 20 | 21 | TRY. 22 | 23 | * Create an instance of MS AI SDK for SAP. 24 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 25 | api_version = p_ver 26 | api_base = p_url 27 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-openai 28 | api_key = p_key 29 | ). 30 | 31 | * Specify text(s) to generate embedding. 32 | APPEND INITIAL LINE TO embeddings_input-input ASSIGNING FIELD-SYMBOL(). 33 | = 'Hello world!'. 34 | 35 | * Perform the embeddings operation. 36 | sdk_instance->embeddings( )->create( 37 | EXPORTING 38 | deploymentid = p_depid " Deployment ID on which the embedding must be generated. 39 | inputs = embeddings_input " Input texts for embedding 40 | IMPORTING 41 | statuscode = status_code " Status Code 42 | statusreason = status_reason " HTTP status description 43 | json = returnjson " JSON String returned from AI Resource 44 | response = embeddings_output " ABAP Friendly Embeddings operaiton output 45 | error = error " ABAP Ready error details 46 | ). 47 | 48 | BREAK-POINT. 49 | 50 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 51 | MESSAGE ex TYPE 'I'. 52 | ENDTRY. 53 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_aisdkdemo_embeddings_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_AISDKDEMO_EMBEDDINGS_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo program for Open AI Embeddings 16 | 55 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_completion_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_COMPLETION_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 |
15 | ZP_MSAISDKDEMO_COMPLETION_OAI 16 | 9000 17 | E 18 | Main Screen 19 | N 20 | 9000 21 | 047 22 | 176 23 |
24 | 25 | 26 | SCREEN 27 | SCREEN 28 | 29 | 30 | CUST_CTRL 31 | TXTINPUT 32 | SCREEN 33 | 003 34 | 002 35 | 173 36 | 010 37 | 38 | 39 | CUST_CTRL 40 | TXTOUTPUT 41 | SCREEN 42 | 016 43 | 002 44 | 172 45 | 026 46 | 47 | 48 | 49 | 50 | SCREEN 51 | SCREEN 52 | PUSH 53 | BTNASKAI 54 | Ask_AI________ 55 | ICON_START_VIEWER 56 | X 57 | 014 58 | 078 59 | 019 60 | 017 61 | 001 62 | ASKAI 63 | CHAR 64 | N 65 | 66 | 67 | SCREEN 68 | SCREEN 69 | OKCODE 70 | G_OK_CODE 71 | ____________________ 72 | 020 73 | 020 74 | 001 75 | CHAR 76 | X 77 | 78 | 79 | 80 | 81 | PROCESS BEFORE OUTPUT. 82 | 83 | 84 | MODULE PBO. 85 | 86 | 87 | * 88 | 89 | 90 | PROCESS AFTER INPUT. 91 | 92 | 93 | MODULE PAI. 94 | 95 | 96 |
97 |
98 | 99 | 100 | R 101 | MS AI SDK for SAP : Demo program for Open AI Completions 102 | 56 103 | 104 | 105 | S 106 | P_DEPID 107 | Deployment ID 108 | 21 109 | 110 | 111 | S 112 | P_KEY 113 | Key 114 | 11 115 | 116 | 117 | S 118 | P_LENGTH 119 | Length 120 | 14 121 | 122 | 123 | S 124 | P_URL 125 | Base URL 126 | 16 127 | 128 | 129 | S 130 | P_VER 131 | Version 132 | 15 133 | 134 | 135 |
136 |
137 |
138 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_files_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_FILES_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo program for Open AI Files 16 | 50 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_finetunes_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_FINETUNES_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo program for Open AI FineTunes 16 | 54 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_models_oai.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report ZP_MSAISDKDEMO_MODELS_OAI 3 | *&---------------------------------------------------------------------* 4 | *& 5 | *&---------------------------------------------------------------------* 6 | REPORT zp_msaisdkdemo_models_oai. 7 | 8 | INCLUDE zp_msaisdkdemo_params_top_oai. "Common Input Parameters (AI End Point, Version, Key) 9 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 10 | 11 | DATA: 12 | model_list TYPE zif_peng_azoai_sdk_types=>ty_model_list, "ABAP Type for List of Models 13 | model_get TYPE zif_peng_azoai_sdk_types=>ty_model_get. "ABAP Type for A single Model information 14 | 15 | 16 | START-OF-SELECTION. 17 | 18 | TRY. 19 | * Create an instance of MS AI SDK for SAP. 20 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 21 | api_version = p_ver 22 | api_base = p_url 23 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-openai 24 | api_key = p_key 25 | ). 26 | ************************** Get a list of all available Models ****************** 27 | 28 | * Get a list of all models (Models - List ). 29 | sdk_instance->model( )->list( 30 | IMPORTING 31 | ov_statuscode = status_code " Status Code 32 | ov_statusreason = status_reason " HTTP status description 33 | ov_json = returnjson "JSON String returned from AI Resource 34 | ov_model = model_list "List of Models available ( Type :zif_peng_azoai_sdk_types=>ty_model_list ) 35 | ov_error = error "Error if occured, returned from AI Resource (Type : zif_peng_azoai_sdk_types=>ty_error) 36 | ). 37 | ******************************************************************************** 38 | BREAK-POINT. 39 | 40 | ************************** Get details of a specific Model ********************* 41 | 42 | * Get the Model information for Text-Davinci-003 (Models - Get). 43 | sdk_instance->model( )->get( 44 | EXPORTING 45 | iv_modelid = 'text-davinci-003' " Model ID 46 | IMPORTING 47 | ov_statuscode = status_code " HTTP status code 48 | ov_statusreason = status_reason 49 | ov_json = returnjson 50 | ov_model = model_get 51 | ov_error = error 52 | ). 53 | ******************************************************************************** 54 | BREAK-POINT. 55 | 56 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 57 | MESSAGE ex TYPE 'I'. 58 | ENDTRY. 59 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_models_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_MODELS_OAI 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo program for Open AI Models 16 | 51 17 | 18 | 19 | S 20 | P_KEY 21 | Key 22 | 11 23 | 24 | 25 | S 26 | P_URL 27 | Open AI Base URL 28 | 24 29 | 30 | 31 | S 32 | P_VER 33 | Version 34 | 15 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_params_top_oai.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_PARAMS_TOP_OAI 3 | *&---------------------------------------------------------------------* 4 | 5 | PARAMETERS: 6 | p_url TYPE string OBLIGATORY LOWER CASE default 'https://api.openai.com' , 7 | p_ver TYPE string OBLIGATORY LOWER CASE DEFAULT 'v1', 8 | p_key TYPE string OBLIGATORY LOWER CASE. 9 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_demos/zp_msaisdkdemo_params_top_oai.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_PARAMS_TOP_OAI 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include : AI SDK demo for Open AI 15 | 33 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MSPENGG:AISDK: Open AI Support - Core Objects 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/zcl_peng_oai_urlprovider.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_OAI_URLPROVIDER 7 | E 8 | MSPENG:AISDK: Open AI URL Provider 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/zif_peng_oai_sdk_constants.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_oai_sdk_constants 2 | PUBLIC . 3 | 4 | 5 | CONSTANTS: 6 | 7 | * Version Strings currently supported by Open AI. 8 | BEGIN OF c_versions, 9 | v1 TYPE string VALUE 'v1', 10 | END OF c_versions. 11 | 12 | ENDINTERFACE. 13 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/zif_peng_oai_sdk_constants.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_OAI_SDK_CONSTANTS 7 | E 8 | MSPENG:Azure Open AI Constants 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/zif_peng_oai_sdk_uripatterns.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_oai_sdk_uripatterns 2 | PUBLIC . 3 | 4 | CONSTANTS: 5 | 6 | * This is the endpoint ID. In future, if the end point remains the same, we will map this ID to version. 7 | * This allows us to not define the same end point repeatedly. 8 | BEGIN OF version_v1_endpoint, 9 | 10 | * Model end points (https://platform.openai.com/docs/api-reference/models) 11 | BEGIN OF model, 12 | get TYPE string VALUE '{endpoint}/{version}/models/{model-id}' , " GET "https://api.openai.com/v1/models/{model} 13 | list TYPE string VALUE '{endpoint}/{version}/models' , " GET "https://api.openai.com/v1/models 14 | END OF model, 15 | 16 | 17 | * Files end points ( https://platform.openai.com/docs/api-reference/files) 18 | BEGIN OF files, 19 | list TYPE string VALUE '{endpoint}/{version}/files' , " GET https://api.openai.com/v1/files 20 | upload TYPE string VALUE '{endpoint}/{version}/files' , " POST https://api.openai.com/v1/files 21 | delete TYPE string VALUE '{endpoint}/{version}/files/{file-id}' , " DELETE https://api.openai.com/v1/files/{file_id} 22 | get TYPE string VALUE '{endpoint}/{version}/files/{file-id}' , " GET https://api.openai.com/v1/files/{file_id} 23 | get_content TYPE string VALUE '{endpoint}/{version}/files/{file-id}/content' , " GET https://api.openai.com/v1/files/{file_id}/content 24 | END OF files, 25 | 26 | * Fine tunes end points (https://platform.openai.com/docs/api-reference/fine-tunes) 27 | BEGIN OF finetunes, 28 | create TYPE string VALUE '{endpoint}/{version}/fine-tunes' , " POST https://api.openai.com/v1/fine-tunes 29 | list TYPE string VALUE '{endpoint}/{version}/fine-tunes' , " GET https://api.openai.com/v1/fine-tunes 30 | get TYPE string VALUE '{endpoint}/{version}/fine-tunes/{fine-tune-id}' , " GET https://api.openai.com/v1/fine-tunes/{fine_tune_id} 31 | cancel TYPE string VALUE '{endpoint}/{version}/fine-tunes/{fine-tune-id}/cancel' , " POST https://api.openai.com/v1/fine-tunes/{fine_tune_id}/cancel 32 | events TYPE string VALUE '{endpoint}/{version}/fine-tunes/{fine-tune-id}/events' , " GET https://api.openai.com/v1/fine-tunes/{fine_tune_id}/events 33 | delete TYPE string VALUE '{endpoint}/{version}/models/{fine-tune-id}' , " DELETE https://api.openai.com/v1/models/{model} 34 | END OF finetunes, 35 | 36 | BEGIN OF completions, 37 | create TYPE string VALUE '{endpoint}/{version}/completions', "POST https://api.openai.com/v1/completions 38 | END OF completions, 39 | 40 | BEGIN OF embeddings, 41 | create TYPE string VALUE '{endpoint}/{version}/embeddings', "POST https://api.openai.com/v1/embeddings 42 | END OF embeddings, 43 | 44 | BEGIN OF chat_completions, 45 | create TYPE string VALUE '{endpoint}/{version}/chat/completions', "POST https://api.openai.com/v1/chat/completions 46 | END OF chat_completions, 47 | END OF version_v1_endpoint. 48 | 49 | ENDINTERFACE. 50 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_core/zif_peng_oai_sdk_uripatterns.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_OAI_SDK_URIPATTERNS 7 | E 8 | MSPENG:Azure Open AI SDK URI Patterns 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MSPENGG:AISDK: Open AI Implementation V1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/zcl_peng_oai_sdk_v1_chatcompl.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_oai_sdk_v1_chatcompl DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_ai_sdk_chatcompl_base 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | METHODS zif_peng_ai_sdk_comp_chatcompl~create REDEFINITION. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS zcl_peng_oai_sdk_v1_chatcompl IMPLEMENTATION. 15 | METHOD zif_peng_ai_sdk_comp_chatcompl~create. 16 | ***************************************************************************************************************** 17 | * Class : ZCL_PENG_AI_SDK_V1_CHATCOMPLET 18 | * Method : zif_peng_ai_sdk_comp_chatcompl~create 19 | * Created by : GONAIR (Gopal Nair) 20 | * Date : June 9, 2023 21 | *------------------------------------------------------------------------------------------------------------- 22 | * Description 23 | *------------------------------------------------------------------------------------------------------------- 24 | * Performs a Chat completion based on prompts and other parameters. 25 | * 26 | * A Completion operation is about asking the AI engine something, and getting a response. The asking part of this 27 | * interaction is called "prompts". Prompt Engineering is used to create prompts which will guide the AI engine to 28 | * understand exactly what you are asking for, and respond meaningfully for the context of the question. 29 | *------------------------------------------------------------------------------------------------------------- 30 | * Modification History 31 | *------------------------------------------------------------------------------------------------------------- 32 | * June 9, 2023 // GONAIR // Initial Version 33 | ***************************************************************************************************************** 34 | TYPES: BEGIN OF ty_oai_chatcompletioninput, 35 | model TYPE string. 36 | INCLUDE TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_input. 37 | TYPES: END OF ty_oai_chatcompletioninput. 38 | 39 | 40 | DATA: 41 | l_chatcompletions_create TYPE ty_oai_chatcompletioninput. 42 | 43 | * Check if the operation is permitted for the run profile by asking profile handler. 44 | _objconfig->get_runprofile_handler( )->zif_peng_azoai_centralcontrol~perform_operation( 45 | EXPORTING 46 | component_type = _component_type 47 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 48 | ). 49 | 50 | MOVE-CORRESPONDING prompts TO l_chatcompletions_create. 51 | 52 | 53 | * If there are no prompts entered by the user, then put in 1 entry with empty string. 54 | IF l_chatcompletions_create-messages[] IS INITIAL. 55 | RETURN. 56 | ENDIF. 57 | 58 | l_chatcompletions_create-model = deploymentid. 59 | 60 | * Get the actual URL and HTTP communication objects from helper layer. 61 | _objsdkhelper->get_httpobjs_from_uripattern( 62 | EXPORTING 63 | uri_pattern = _objconfig->get_accesspoint_provider( )->get_urltemplate( 64 | component = _component_type 65 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 66 | ) "{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={version}' 67 | ivobj_config = _objconfig 68 | IMPORTING 69 | ov_url = DATA(actual_url) 70 | ovobj_http = DATA(lo_http) 71 | ovobj_http_rest = DATA(lo_http_rest) 72 | ). 73 | 74 | * Prepare the body and set it 75 | DATA(lo_request) = lo_http_rest->if_rest_client~create_request_entity( ). 76 | lo_request->set_content_type( iv_media_type = 'application/json' ). 77 | DATA(post_data) = to_lower( /ui2/cl_json=>serialize( data = l_chatcompletions_create compress = /ui2/cl_json=>c_bool-true ) ) . 78 | lo_request->set_string_data( iv_data = post_data ). 79 | 80 | * Trigger the network operation. 81 | lo_http_rest->if_rest_client~post( io_entity = lo_request ). 82 | 83 | * Get Status, results and error if any from helper layer. 84 | _objsdkhelper->do_receive( 85 | EXPORTING 86 | ivobj_http_client = lo_http 87 | ivobj_http_rest = lo_http_rest 88 | IMPORTING 89 | ov_statuscode = statuscode 90 | ov_statusdescr = statusreason 91 | ov_jsonstring = json 92 | CHANGING 93 | iov_result = response 94 | iov_error = error 95 | ). 96 | 97 | 98 | ENDMETHOD. 99 | 100 | ENDCLASS. 101 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/zcl_peng_oai_sdk_v1_chatcompl.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_OAI_SDK_V1_CHATCOMPL 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/zcl_peng_oai_sdk_v1_complet.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_OAI_SDK_V1_COMPLET 7 | E 8 | MSPENG:AISDK: OpenAI Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/zcl_peng_oai_sdk_v1_embeding.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_oai_sdk_v1_embeding DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_embed_base 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | METHODS zif_peng_azoai_sdk_comp_embed~create REDEFINITION. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS zcl_peng_oai_sdk_v1_embeding IMPLEMENTATION. 15 | METHOD zif_peng_azoai_sdk_comp_embed~create. 16 | ***************************************************************************************************************** 17 | * Class : ZCL_PENG_AZOAI_SDK_V1_EMBEDING 18 | * Method : zif_peng_azoai_sdk_comp_embed~create 19 | * Created by : Gopal Nair 20 | * Date : Jun 9, 2023 21 | *------------------------------------------------------------------------------------------------------------- 22 | * Description 23 | *------------------------------------------------------------------------------------------------------------- 24 | * 25 | *------------------------------------------------------------------------------------------------------------- 26 | * Modification History 27 | *------------------------------------------------------------------------------------------------------------- 28 | * Jun 9, 2023 // GONAIR // Initial Version 29 | ***************************************************************************************************************** 30 | TYPES: BEGIN OF ty_oai_embeddinginput, 31 | model TYPE string. 32 | INCLUDE TYPE zif_peng_azoai_sdk_types=>ty_embeddings_input. 33 | TYPES: END OF ty_oai_embeddinginput. 34 | 35 | DATA: 36 | l_embeddings_oai_input TYPE ty_oai_embeddinginput. 37 | 38 | MOVE-CORRESPONDING inputs TO l_embeddings_oai_input. 39 | l_embeddings_oai_input-model = deploymentid. 40 | 41 | 42 | * Check if the operation is permitted for the run profile by asking profile handler. 43 | _objconfig->get_runprofile_handler( )->zif_peng_azoai_centralcontrol~perform_operation( 44 | EXPORTING 45 | component_type = _component_type 46 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 47 | ). 48 | 49 | * Get the actual URL and HTTP communication objects from helper layer. 50 | _objsdkhelper->get_httpobjs_from_uripattern( 51 | EXPORTING 52 | uri_pattern = _objconfig->get_accesspoint_provider( )->get_urltemplate( 53 | component = _component_type 54 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 55 | ) 56 | ivobj_config = _objconfig 57 | IMPORTING 58 | ov_url = DATA(actual_url) 59 | ovobj_http = DATA(lo_http) 60 | ovobj_http_rest = DATA(lo_http_rest) 61 | ). 62 | 63 | * Prepare the body and set it 64 | DATA(lo_request) = lo_http_rest->if_rest_client~create_request_entity( ). 65 | lo_request->set_content_type( iv_media_type = 'application/json' ). 66 | DATA(post_data) = /ui2/cl_json=>serialize( 67 | data = l_embeddings_oai_input 68 | compress = abap_true 69 | pretty_name = /ui2/cl_json=>pretty_mode-low_case 70 | ). 71 | lo_request->set_string_data( iv_data = post_data ). 72 | 73 | * Trigger the network operation. 74 | lo_http_rest->if_rest_client~post( io_entity = lo_request ). 75 | 76 | * Get Status, results and error if any from helper layer. 77 | _objsdkhelper->do_receive( 78 | EXPORTING 79 | ivobj_http_client = lo_http 80 | ivobj_http_rest = lo_http_rest 81 | IMPORTING 82 | ov_statuscode = statuscode 83 | ov_statusdescr = statusreason 84 | ov_jsonstring = json 85 | CHANGING 86 | iov_result = response 87 | iov_error = error 88 | ). 89 | 90 | 91 | ENDMETHOD. 92 | 93 | ENDCLASS. 94 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai/zpengg_oai_sdk_v1/zcl_peng_oai_sdk_v1_embeding.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_OAI_SDK_V1_EMBEDING 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Azure Open AI Integration 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Azure Open AI SDK 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zaisdkprofile.tran.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZAISDKPROFILE 7 | Ag== 8 | 9 | 10 | ZAISDKPROFILE 11 | 1 12 | X 13 | X 14 | 15 | 16 | E 17 | ZAISDKPROFILE 18 | MS AI SDK - Maintain Run Profile 19 | 20 | 21 | ZAISDKPROFILE 22 | /*SM30 VIEWNAME=ZTAISDKRUNPROFIL;UPDATE=X; 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zcl_peng_azoai_sdk_factory.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_FACTORY 7 | E 8 | MSPENG:Azure Open AI ABAP SDK Factory 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | CONSTRUCTOR 17 | E 18 | INTERNAL ONLY - Constructor 19 | 20 | 21 | GET_INSTANCE 22 | E 23 | Returns an instance of AZOAI SDK Factory 24 | 25 | 26 | GET_SDK 27 | E 28 | Returns an SDK instance appropriate for the version 29 | 30 | 31 | 32 | 33 | GET_SDK 34 | API_BASE 35 | E 36 | API Base URL 37 | 38 | 39 | GET_SDK 40 | API_KEY 41 | E 42 | API Key 43 | 44 | 45 | GET_SDK 46 | API_TYPE 47 | E 48 | API Type 49 | 50 | 51 | GET_SDK 52 | API_VERSION 53 | E 54 | API Version 55 | 56 | 57 | GET_SDK 58 | PARAMS 59 | E 60 | Additional parameters as specified by organization policies 61 | 62 | 63 | GET_SDK 64 | SDK 65 | E 66 | Instance of SDK 67 | 68 | 69 | GET_SDK 70 | SDKPROFILE 71 | E 72 | SDK Profile ID as provided by organization SDK administrator 73 | 74 | 75 | GET_SDK 76 | ZCX_PENG_AZOAI_SDK_EXCEPTION 77 | E 78 | Exception if SDK creation failed. 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Azure Open AI SDK: Configuration 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zde_azoaisdk_callbackclass.dtel.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZDE_AZOAISDK_CALLBACKCLASS 7 | E 8 | SEOCLSNAME 9 | 30 10 | 10 11 | 20 12 | 40 13 | MSPENG:AZOAISDK:Global Profile Call Back Class Name 14 | Profile Handler Class Name 15 | Prof Hndlr 16 | Profile Handler Clas 17 | Profile Handler Class Name 18 | E 19 | D 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zde_azoaisdk_inactive.dtel.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZDE_AZOAISDK_INACTIVE 7 | E 8 | XFELD 9 | 55 10 | 10 11 | 20 12 | 40 13 | MSPENG:AZOAISDK:Inactive Flag 14 | Inactive 15 | Inactive 16 | Inactive 17 | Inactive 18 | E 19 | D 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zde_azoaisdk_profileid.dtel.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZDE_AZOAISDK_PROFILEID 7 | E 8 | CHAR30 9 | 30 10 | 10 11 | 20 12 | 40 13 | MSPENG:AZOAISDK:Run Profile ID 14 | Profile ID 15 | Profile ID 16 | Profile ID 17 | Profile ID 18 | E 19 | D 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zde_azoaisdk_sysid.dtel.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZDE_AZOAISDK_SYSID 7 | E 8 | SYCHAR08 9 | 55 10 | 10 11 | 20 12 | 40 13 | MSPENG:AZOAISDK:System ID 14 | System ID 15 | Sys ID 16 | System ID 17 | System ID 18 | E 19 | D 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conff00.abap: -------------------------------------------------------------------------------- 1 | *---------------------------------------------------------------------* 2 | * view related FORM routines 3 | *---------------------------------------------------------------------* 4 | 5 | * base table related FORM-routines............. 6 | INCLUDE LSVIMFTX . 7 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conff00.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | LZFGAZOAISDK_CONFF00 7 | X 8 | S 9 | D$ 10 | I 11 | S 12 | E 13 | X 14 | D$S 15 | X 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_confi00.abap: -------------------------------------------------------------------------------- 1 | *---------------------------------------------------------------------* 2 | * view related PAI modules 3 | *---------------------------------------------------------------------* 4 | 5 | INCLUDE LSVIMITX . "base table related PAI modules 6 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_confi00.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | LZFGAZOAISDK_CONFI00 7 | X 8 | S 9 | D$ 10 | I 11 | S 12 | E 13 | X 14 | D$S 15 | X 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conft00.abap: -------------------------------------------------------------------------------- 1 | *---------------------------------------------------------------------* 2 | * view related data declarations 3 | *---------------------------------------------------------------------* 4 | *...processing: ZTAISDKRUNPROFIL................................* 5 | DATA: BEGIN OF STATUS_ZTAISDKRUNPROFIL . "state vector 6 | INCLUDE STRUCTURE VIMSTATUS. 7 | DATA: END OF STATUS_ZTAISDKRUNPROFIL . 8 | CONTROLS: TCTRL_ZTAISDKRUNPROFIL 9 | TYPE TABLEVIEW USING SCREEN '0001'. 10 | *.........table declarations:.................................* 11 | TABLES: *ZTAISDKRUNPROFIL . 12 | TABLES: ZTAISDKRUNPROFIL . 13 | 14 | * general table data declarations.............. 15 | INCLUDE LSVIMTDT . 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conft00.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | LZFGAZOAISDK_CONFT00 7 | S 8 | D$ 9 | I 10 | S 11 | E 12 | X 13 | D$S 14 | X 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conftop.abap: -------------------------------------------------------------------------------- 1 | FUNCTION-POOL ZFGAZOAISDK_CONF MESSAGE-ID SV. 2 | 3 | * INCLUDE LZFGAZOAISDK_CONFD... " Local class definition 4 | INCLUDE LSVIMDAT . "general data decl. 5 | INCLUDE LZFGAZOAISDK_CONFT00 . "view rel. data dcl. 6 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.lzfgazoaisdk_conftop.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | LZFGAZOAISDK_CONFTOP 7 | S 8 | D$ 9 | I 10 | S 11 | X 12 | D$S 13 | X 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.saplzfgazoaisdk_conf.abap: -------------------------------------------------------------------------------- 1 | ******************************************************************* 2 | * System-defined Include-files. * 3 | ******************************************************************* 4 | INCLUDE LZFGAZOAISDK_CONFTOP. " Global Declarations 5 | INCLUDE LZFGAZOAISDK_CONFUXX. " Function Modules 6 | 7 | ******************************************************************* 8 | * User-defined Include-files (if necessary). * 9 | ******************************************************************* 10 | * INCLUDE LZFGAZOAISDK_CONFF... " Subroutines 11 | * INCLUDE LZFGAZOAISDK_CONFO... " PBO-Modules 12 | * INCLUDE LZFGAZOAISDK_CONFI... " PAI-Modules 13 | * INCLUDE LZFGAZOAISDK_CONFE... " Events 14 | * INCLUDE LZFGAZOAISDK_CONFP... " Local class implement. 15 | * INCLUDE LZFGAZOAISDK_CONFT99. " ABAP Unit tests 16 | INCLUDE LZFGAZOAISDK_CONFF00 . " subprograms 17 | INCLUDE LZFGAZOAISDK_CONFI00 . " PAI modules 18 | INCLUDE LSVIMFXX . " subprograms 19 | INCLUDE LSVIMOXX . " PBO modules 20 | INCLUDE LSVIMIXX . " PAI modules 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.saplzfgazoaisdk_conf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | SAPLZFGAZOAISDK_CONF 7 | X 8 | S 9 | D$ 10 | F 11 | S 12 | E 13 | X 14 | D$S 15 | X 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.tableframe_zfgazoaisdk_conf.abap: -------------------------------------------------------------------------------- 1 | *---------------------------------------------------------------------* 2 | * program for: TABLEFRAME_ZFGAZOAISDK_CONF 3 | *---------------------------------------------------------------------* 4 | FUNCTION TABLEFRAME_ZFGAZOAISDK_CONF . 5 | 6 | PERFORM TABLEFRAME TABLES X_HEADER X_NAMTAB DBA_SELLIST DPL_SELLIST 7 | EXCL_CUA_FUNCT 8 | USING CORR_NUMBER VIEW_ACTION VIEW_NAME. 9 | 10 | ENDFUNCTION. 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/zfgazoaisdk_conf.fugr.tableproc_zfgazoaisdk_conf.abap: -------------------------------------------------------------------------------- 1 | *---------------------------------------------------------------------* 2 | * program for: TABLEPROC_ZFGAZOAISDK_CONF 3 | *---------------------------------------------------------------------* 4 | FUNCTION TABLEPROC_ZFGAZOAISDK_CONF . 5 | 6 | PERFORM TABLEPROC. 7 | 8 | ENDFUNCTION. 9 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/ztaisdkrunprofil.tabl.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZTAISDKRUNPROFIL 7 | E 8 | TRANSP 9 | X 10 | MSPENG:AZOAISDK:Global Run Profile 11 | X 12 | C 13 | 1 14 | 15 | 16 | ZTAISDKRUNPROFIL 17 | A 18 | 0 19 | APPL2 20 | X 21 | X 22 | X 23 | 24 | 25 | 26 | MANDT 27 | X 28 | MANDT 29 | 0 30 | X 31 | E 32 | 33 | 34 | PROFILE_ID 35 | X 36 | ZDE_AZOAISDK_PROFILEID 37 | 0 38 | X 39 | E 40 | 41 | 42 | SYSID 43 | X 44 | ZDE_AZOAISDK_SYSID 45 | 0 46 | X 47 | E 48 | 49 | 50 | CALLBACK_CLASSNAME 51 | ZDE_AZOAISDK_CALLBACKCLASS 52 | 0 53 | E 54 | 55 | 56 | INACTIVE 57 | ZDE_AZOAISDK_INACTIVE 58 | 0 59 | X 60 | F 61 | E 62 | 63 | 64 | 65 | 66 | ZTAISDKRUNPROFIL 67 | &NC& 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_config/ztaisdkrunprofils.tobj.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZTAISDKRUNPROFIL 7 | S 8 | X 9 | CUST 10 | 2 11 | 3 12 | 13 | 14 | E 15 | ZTAISDKRUNPROFIL 16 | S 17 | MSPENG:AZOAISDK:Global Run Profile 18 | 19 | 20 | 21 | ZTAISDKRUNPROFIL 22 | S 23 | ZTAISDKRUNPROFIL 24 | X 25 | X 26 | 27 | 28 | 29 | 30 | ZTAISDKRUNPROFIL 31 | &NC& 32 | 33 | 34 | ZTAISDKRUNPROFIL 35 | ZFGAZOAISDK_CONF 36 | 1 37 | 0001 38 | X 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering:Azure Open AI SDK Core Objects 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_ai_sdk_chatcompl_base.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_ai_sdk_chatcompl_base DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_component 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | INTERFACES zif_peng_ai_sdk_comp_chatcompl. 9 | METHODS constructor. 10 | 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | ENDCLASS. 14 | 15 | 16 | 17 | CLASS zcl_peng_ai_sdk_chatcompl_base IMPLEMENTATION. 18 | 19 | METHOD constructor. 20 | 21 | super->constructor( ). 22 | _component_type = zif_peng_azoai_sdk_constants=>c_component_type-chat_completions. 23 | ENDMETHOD. 24 | 25 | 26 | 27 | METHOD zif_peng_ai_sdk_comp_chatcompl~create. 28 | ***************************************************************************************************************** 29 | * Class : ZCL_PENG_AI_SDK_CHATCOMPL_BASE 30 | * Method : zif_peng_ai_sdk_comp_chatcompl~create 31 | * Created by : GONAIR (Gopal Nair) 32 | * Date : May 7, 2023 33 | *------------------------------------------------------------------------------------------------------------- 34 | * Description 35 | *------------------------------------------------------------------------------------------------------------- 36 | * This method implementation will only be triggered if sub-classes did not override the create method. This 37 | * can happen if the underlying AI engine does not support completion create operation. 38 | *------------------------------------------------------------------------------------------------------------- 39 | * Modification History 40 | *------------------------------------------------------------------------------------------------------------- 41 | * May 7, 2023 // GONAIR // Initial Version 42 | ***************************************************************************************************************** 43 | 44 | _not_implemented( ). 45 | ENDMETHOD. 46 | 47 | ENDCLASS. 48 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_ai_sdk_chatcompl_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AI_SDK_CHATCOMPL_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Completion Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_centralcontrol.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_CENTRALCONTROL 7 | E 8 | MSPENG:AZOAISDK Central Control Base Class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_BASE 7 | E 8 | MSPENG:Azure Open AI ABAP SDK Base Class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | _CHECK_COMPONENT_SAFETY 17 | E 18 | Check if a component is safe to access 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_compl_base.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_sdk_compl_base DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_component 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | INTERFACES zif_peng_azoai_sdk_comp_compl. 9 | METHODS constructor. 10 | 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | ENDCLASS. 14 | 15 | 16 | 17 | CLASS zcl_peng_azoai_sdk_compl_base IMPLEMENTATION. 18 | 19 | METHOD constructor. 20 | 21 | super->constructor( ). 22 | _component_type = zif_peng_azoai_sdk_constants=>c_component_type-completions. 23 | ENDMETHOD. 24 | 25 | 26 | 27 | METHOD zif_peng_azoai_sdk_comp_compl~create. 28 | ***************************************************************************************************************** 29 | * Class : ZCL_PENG_AZOAI_SDK_COMPL_BASE 30 | * Method : zif_peng_azoai_sdk_comp_compl~create 31 | * Created by : Gopal Nair 32 | * Date : Mar 28, 2023 33 | *------------------------------------------------------------------------------------------------------------- 34 | * Description 35 | *------------------------------------------------------------------------------------------------------------- 36 | * This method implementation will only be triggered if sub-classes did not override the create method. This 37 | * can happen if the underlying AI engine does not support completion create operation. 38 | *------------------------------------------------------------------------------------------------------------- 39 | * Modification History 40 | *------------------------------------------------------------------------------------------------------------- 41 | * Mar 28, 2023 // Gopal Nair // Initial Version 42 | ***************************************************************************************************************** 43 | _not_implemented( ). 44 | ENDMETHOD. 45 | 46 | ENDCLASS. 47 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_compl_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_COMPL_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Completion Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_component.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_sdk_component DEFINITION 2 | PUBLIC 3 | ABSTRACT 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | INTERFACES zif_peng_azoai_sdk_component . 9 | PROTECTED SECTION. 10 | DATA: 11 | _objsdkhelper TYPE REF TO zcl_peng_azoai_sdk_helper. 12 | 13 | DATA: 14 | _objconfig TYPE REF TO zif_peng_azoai_sdk_config, 15 | _objsdk TYPE REF TO zif_peng_azoai_sdk, 16 | _component_type TYPE string. " see : zif_peng_azoai_sdk_constants=>c_component_type 17 | 18 | METHODS: 19 | "!

Raises a Not-Implemented exception.

20 | "! 21 | "! @raising zcx_peng_azoai_sdk_exception |

22 | _not_implemented FINAL 23 | RAISING 24 | zcx_peng_azoai_sdk_exception. 25 | PRIVATE SECTION. 26 | 27 | 28 | ENDCLASS. 29 | 30 | 31 | 32 | CLASS zcl_peng_azoai_sdk_component IMPLEMENTATION. 33 | METHOD zif_peng_azoai_sdk_component~initialize_component. 34 | ***************************************************************************************************************** 35 | * Class : ZCL_PENG_AZOAI_SDK_COMPONENT 36 | * Method : zif_peng_azoai_sdk_component~initialize_component 37 | * Created by : Gopal Nair 38 | * Date : Mar 28, 2023 39 | *------------------------------------------------------------------------------------------------------------- 40 | * Description 41 | *------------------------------------------------------------------------------------------------------------- 42 | * INTERNAL USE ONLY 43 | * 44 | * Initializes an SDK component, and registered sub-objects into the instance. 45 | *------------------------------------------------------------------------------------------------------------- 46 | * Modification History 47 | *------------------------------------------------------------------------------------------------------------- 48 | * Mar 28, 2023 // Gopal Nair // Initial Version 49 | ***************************************************************************************************************** 50 | TRY. 51 | * Initialize the component. This is called from SDK during spinning up. 52 | * Set up helper 53 | _objsdkhelper = zcl_peng_azoai_sdk_helper=>get_instance( ). 54 | * Set up config layer. 55 | _objconfig ?= component_set[ component_type = zif_peng_azoai_sdk_constants=>c_component_type-config ]-component_instance. 56 | * Set up loop back to SDK parent object. 57 | _objsdk ?= component_set[ component_type = zif_peng_azoai_sdk_constants=>c_component_type-sdk ]-component_instance. 58 | 59 | CATCH cx_root. 60 | RAISE EXCEPTION TYPE zcx_peng_azoai_sdk_exception 61 | EXPORTING 62 | textid = zcx_peng_azoai_sdk_exception=>component_init_failed. 63 | 64 | ENDTRY. 65 | ENDMETHOD. 66 | 67 | METHOD _not_implemented. 68 | ***************************************************************************************************************** 69 | * Class : ZCL_PENG_AZOAI_SDK_COMPONENT 70 | * Method : _not_implemented 71 | * Created by : Gopal Nair 72 | * Date : Mar 28, 2023 73 | *------------------------------------------------------------------------------------------------------------- 74 | * Description 75 | *------------------------------------------------------------------------------------------------------------- 76 | * Raises a Not-Implemented exception. 77 | *------------------------------------------------------------------------------------------------------------- 78 | * Modification History 79 | *------------------------------------------------------------------------------------------------------------- 80 | * Mar 28, 2023 // Gopal Nair // Initial Version 81 | ***************************************************************************************************************** 82 | IF _objsdkhelper IS INITIAL. 83 | _objsdkhelper = zcl_peng_azoai_sdk_helper=>get_instance( ). 84 | ENDIF. 85 | * Delegate exception generation to helper. 86 | _objsdkhelper->raise_feature_notimpl_ex( ). 87 | ENDMETHOD. 88 | 89 | ENDCLASS. 90 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_component.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_COMPONENT 7 | E 8 | MSPENG:Azure Open AI SDK Component Base Class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | _NOT_IMPLEMENTED 17 | E 18 | Raises a Not-Implemented exception. 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_config_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_CONFIG_BASE 7 | E 8 | MSPENG:Azure Open AI ABAP SDK Config Base Class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | _DETERMINE_RUNPROFILE 17 | E 18 | Determines the run profile to use 19 | 20 | 21 | _LOAD_RUNPROFILE 22 | E 23 | Loads the SDK run profile from Configuration DB 24 | 25 | 26 | 27 | 28 | _LOAD_RUNPROFILE 29 | PROFILE_ID 30 | E 31 | Profile ID 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_deploy_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_DEPLOY_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Deployments Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_embed_base.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_sdk_embed_base DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_component 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | INTERFACES zif_peng_azoai_sdk_comp_embed. 9 | METHODS constructor. 10 | 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | ENDCLASS. 14 | 15 | 16 | 17 | CLASS zcl_peng_azoai_sdk_embed_base IMPLEMENTATION. 18 | 19 | METHOD constructor. 20 | 21 | super->constructor( ). 22 | _component_type = zif_peng_azoai_sdk_constants=>c_component_type-embeddings. 23 | ENDMETHOD. 24 | 25 | 26 | 27 | METHOD zif_peng_azoai_sdk_comp_embed~create. 28 | ***************************************************************************************************************** 29 | * Class : ZCL_PENG_AZOAI_SDK_COMPL_BASE 30 | * Method : zif_peng_azoai_sdk_comp_embed~create 31 | * Created by : Gopal Nair 32 | * Date : June 2, 2023 33 | *------------------------------------------------------------------------------------------------------------- 34 | * Description 35 | *------------------------------------------------------------------------------------------------------------- 36 | * This method implementation will only be triggered if sub-classes did not override the create method. This 37 | * can happen if the underlying AI engine does not support completion create operation. 38 | *------------------------------------------------------------------------------------------------------------- 39 | * Modification History 40 | *------------------------------------------------------------------------------------------------------------- 41 | * June 2, 2023 // Gopal Nair // Initial Version 42 | ***************************************************************************************************************** 43 | _not_implemented( ). 44 | ENDMETHOD. 45 | 46 | ENDCLASS. 47 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_embed_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_EMBED_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Embeddings Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_file_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_FILE_BASE 7 | E 8 | MSPENG:Azure Open AI SDK File Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_fintun_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_FINTUN_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Fine Tune Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_helper.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_HELPER 7 | E 8 | MSPENG:AZOAISDK Helper Class (INTERNAL USE ONLY) 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | DO_RECEIVE 17 | E 18 | Retrieve the returned data from REST Endpoint communications 19 | 20 | 21 | GET_COMPONENTS_FOR_VERSION 22 | E 23 | Gets the components to be initiated for a given version. 24 | 25 | 26 | GET_HTTPOBJS_FROM_URIPATTERN 27 | E 28 | Generate and return HTTP communication objects 29 | 30 | 31 | GET_INSTANCE 32 | E 33 | Creates or reuse an instance of helper class and returns it. 34 | 35 | 36 | RAISE_FEATURE_NOTIMPL_EX 37 | E 38 | Raises an exception indicating feature was not implemented. 39 | 40 | 41 | 42 | 43 | DO_RECEIVE 44 | IOV_ERROR 45 | E 46 | Error Data (Populated when API call failed at the server) 47 | 48 | 49 | DO_RECEIVE 50 | IOV_RESULT 51 | E 52 | Result data (populated when API call was successful) 53 | 54 | 55 | DO_RECEIVE 56 | IVOBJ_HTTP_CLIENT 57 | E 58 | HTTP Client Object 59 | 60 | 61 | DO_RECEIVE 62 | IVOBJ_HTTP_REST 63 | E 64 | HTTP Rest Object 65 | 66 | 67 | DO_RECEIVE 68 | OV_JSONSTRING 69 | E 70 | Returned JSON String 71 | 72 | 73 | DO_RECEIVE 74 | OV_STATUSCODE 75 | E 76 | Status Code 77 | 78 | 79 | DO_RECEIVE 80 | OV_STATUSDESCR 81 | E 82 | Status Description 83 | 84 | 85 | GET_HTTPOBJS_FROM_URIPATTERN 86 | IVOBJ_CONFIG 87 | E 88 | SDK Configuration instance 89 | 90 | 91 | GET_HTTPOBJS_FROM_URIPATTERN 92 | IVT_TEMPLATECOMPONENTS 93 | E 94 | URI Template components used to construct the full URL 95 | 96 | 97 | GET_HTTPOBJS_FROM_URIPATTERN 98 | OVOBJ_HTTP 99 | E 100 | HTTP Object 101 | 102 | 103 | GET_HTTPOBJS_FROM_URIPATTERN 104 | OVOBJ_HTTP_REST 105 | E 106 | HTTP REST object 107 | 108 | 109 | GET_HTTPOBJS_FROM_URIPATTERN 110 | OV_URL 111 | E 112 | Resolved URL constructed from uri template and components 113 | 114 | 115 | GET_HTTPOBJS_FROM_URIPATTERN 116 | URI_PATTERN 117 | E 118 | URI Pattern of the REST end point 119 | 120 | 121 | GET_INSTANCE 122 | R_RESULT 123 | E 124 | Instance of Helper Class 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_model_base.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_sdk_model_base DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_component 4 | ABSTRACT 5 | CREATE PUBLIC . 6 | 7 | PUBLIC SECTION. 8 | 9 | INTERFACES zif_peng_azoai_sdk_comp_model . 10 | 11 | METHODS constructor. 12 | PROTECTED SECTION. 13 | PRIVATE SECTION. 14 | 15 | ENDCLASS. 16 | 17 | 18 | 19 | CLASS zcl_peng_azoai_sdk_model_base IMPLEMENTATION. 20 | 21 | METHOD constructor. 22 | super->constructor( ). 23 | _component_type = zif_peng_azoai_sdk_constants=>c_component_type-model. "Model Component. 24 | ENDMETHOD. 25 | 26 | 27 | METHOD zif_peng_azoai_sdk_comp_model~get. 28 | ***************************************************************************************************************** 29 | * Class : ZCL_PENG_AZOAI_SDK_MODEL_BASE 30 | * Method : zif_peng_azoai_sdk_comp_model~get 31 | * Created by : Gopal Nair 32 | * Date : Apr 6, 2023 33 | *------------------------------------------------------------------------------------------------------------- 34 | * Description 35 | *------------------------------------------------------------------------------------------------------------- 36 | * This implementation will only be triggered if sub-classes did not override it. 37 | *------------------------------------------------------------------------------------------------------------- 38 | * Modification History 39 | *------------------------------------------------------------------------------------------------------------- 40 | * Apr 6, 2023 // Gopal Nair // Initial Version 41 | ***************************************************************************************************************** 42 | _not_implemented( ). 43 | ENDMETHOD. 44 | 45 | 46 | METHOD zif_peng_azoai_sdk_comp_model~list. 47 | ***************************************************************************************************************** 48 | * Class : ZCL_PENG_AZOAI_SDK_MODEL_BASE 49 | * Method : zif_peng_azoai_sdk_comp_model~list 50 | * Created by : Gopal Nair 51 | * Date : Apr 6, 2023 52 | *------------------------------------------------------------------------------------------------------------- 53 | * Description 54 | *------------------------------------------------------------------------------------------------------------- 55 | * This implementation will only be triggered if sub-classes did not override it. 56 | *------------------------------------------------------------------------------------------------------------- 57 | * Modification History 58 | *------------------------------------------------------------------------------------------------------------- 59 | * Apr 6, 2023 // Gopal Nair // Initial Version 60 | ***************************************************************************************************************** 61 | _not_implemented( ). 62 | ENDMETHOD. 63 | ENDCLASS. 64 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_sdk_model_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_MODEL_BASE 7 | E 8 | MSPENG:Azure Open AI SDK Model Base Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcl_peng_azoai_urlprovider.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_URLPROVIDER 7 | E 8 | MSPENG:AISDK: Azure Open AI URL Provider 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zcx_peng_azoai_sdk_exception.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCX_PENG_AZOAI_SDK_EXCEPTION 7 | E 8 | MSPENG:Azure Open AI ABAP SDK Exception 9 | 40 10 | 1 11 | X 12 | X 13 | X 14 | 15 | 16 | 17 |
18 | 000D3AE5AE2D1EEDB1C53CE26ED63C20 19 | E 20 | 1 21 | CA== 22 |
23 | 24 | 25 | 000D3AE5AE2D1EEDB1C53CE26ED63C20 26 | E 27 | 0001 28 | X 29 | R 30 | 255 31 | 32 | 33 |
34 |
35 | 36 | 37 | LIMU 38 | CPUB 39 | ZCX_PENG_AZOAI_SDK_EXCEPTION 40 | 000D3AE5AE2D1EEDB1C53CE26ED63C20 41 | 0001 42 | 43 | 44 | 45 | 46 | CONSTRUCTOR 47 | E 48 | CONSTRUCTOR 49 | 50 | 51 | IV_ATTR1 52 | E 53 | Comment 54 | 55 | 56 | IV_ATTR2 57 | E 58 | Comment 59 | 60 | 61 | IV_ATTR3 62 | E 63 | Comment 64 | 65 | 66 | IV_ATTR4 67 | E 68 | Comment 69 | 70 | 71 |
72 |
73 |
74 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_ai_sdk_comp_chatcompl.intf.abap: -------------------------------------------------------------------------------- 1 | "!

MSPENG: Azure Open AI SDK - Completions Component

2 | INTERFACE zif_peng_ai_sdk_comp_chatcompl 3 | PUBLIC . 4 | 5 | "!

Performs a Chat Completion.

6 | "! A Completion operation is about asking the AI engine something, and getting a response. The 7 | "! asking part of this interaction is called "prompts". Prompt Engineering is used to create 8 | "! prompts which will guide the AI engine to understand exactly what you are asking for, and respond meaningfully 9 | "! for the context of the question. 10 | "!

11 | "! Prompt Engineering: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/prompt-engineering 12 | "!

13 | "! This method performs a completion operation with the prompts provided in parameter prompts, and returns the 14 | "! response received from AI engine. Both the raw JSON string received from AI enging, as well as a parsed, ABAP ready 15 | "! data structure is provided back to the caller. 16 | "! @parameter deploymentid |

Deployment ID on which the prompt must be run.

17 | "! @parameter prompts |

1 or more prompts and their parameters like token length.

18 | "! @parameter statuscode |

HTTP Response status code.

19 | "! @parameter statusreason |

HTTP Status Reason.

20 | "! @parameter json |

JSON String received from AI engine.

21 | "! @parameter response |

Parsed and ABAP ready data structure from JSON String

22 | "! @parameter error |

Error information parsed from JSON string

23 | "! @raising zcx_peng_azoai_sdk_exception |

Exception - Note - an AI layer error is NOT an exception.

24 | METHODS create 25 | IMPORTING 26 | deploymentid TYPE string 27 | prompts TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_input 28 | EXPORTING 29 | statuscode TYPE i 30 | statusreason TYPE string 31 | json TYPE string 32 | response TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_output 33 | error TYPE zif_peng_azoai_sdk_types=>ty_error 34 | RAISING 35 | zcx_peng_azoai_sdk_exception . 36 | ENDINTERFACE. 37 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_ai_sdk_comp_chatcompl.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AI_SDK_COMP_CHATCOMPL 7 | E 8 | MSPENG: Azure Open AI SDK - Completions Component 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | CREATE 16 | E 17 | Performs a Chat Completion. 18 | 19 | 20 | 21 | 22 | CREATE 23 | DEPLOYMENTID 24 | E 25 | Deployment ID on which the prompt must be run. 26 | 27 | 28 | CREATE 29 | ERROR 30 | E 31 | Error information parsed from JSON string 32 | 33 | 34 | CREATE 35 | JSON 36 | E 37 | JSON String received from AI engine. 38 | 39 | 40 | CREATE 41 | PROMPTS 42 | E 43 | 1 or more prompts and their parameters like token length. 44 | 45 | 46 | CREATE 47 | RESPONSE 48 | E 49 | Parsed and ABAP ready data structure from JSON String 50 | 51 | 52 | CREATE 53 | STATUSCODE 54 | E 55 | HTTP Response status code. 56 | 57 | 58 | CREATE 59 | STATUSREASON 60 | E 61 | HTTP Status Reason. 62 | 63 | 64 | CREATE 65 | ZCX_PENG_AZOAI_SDK_EXCEPTION 66 | E 67 | Exception - Note - an AI layer error is NOT an exception. 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_centralcontrol.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_azoai_centralcontrol 2 | PUBLIC . 3 | 4 | METHODS: 5 | "!

Check if SDK use is permitted

6 | "! Fired before SDK is initialized. To prevent SDK usage, raise the exception. 7 | "!

8 | "! Note: This will be the first call to this handler class, and the only 9 | "! time the api parameters and initialization parameter (init_params) will be passed in. 10 | "! If that information is required for further checks (eg: initialize_sdkcomponent, perform_operation) 11 | "! the implementation of the handler must put these values into an attribute of the object, so that 12 | "! it can be used later, since the instance of the handler used to call each of these methods remains 13 | "! the same. 14 | "! @parameter api_version |

API Version

15 | "! @parameter api_base |

API Base URL

16 | "! @parameter api_type |

API Type

17 | "! @parameter init_params |

Other Initialization Parameters

18 | "! @raising zcx_peng_azoai_sdk_exception |

19 | start_sdk 20 | IMPORTING 21 | api_version TYPE string 22 | api_base TYPE string 23 | api_type TYPE string 24 | sdkprofile TYPE ztaisdkrunprofil 25 | init_params TYPE tihttpnvp 26 | RAISING 27 | zcx_peng_azoai_sdk_exception, 28 | 29 | "!

Check if an SDK component is permitted

30 | "! This method is called prior to initializing a specific component of the SDK, such as a model, deployment, 31 | "! completions, file, finetuning, or embeddings. It takes in the component_type parameter, 32 | "! which specifies the type of component to be initialized. If the component initialization must not be 33 | "! performed, raise the zcx_peng_azoai_sdk_exception (or a sub-class of it) exception. 34 | "!

35 | "! Note:If additional information (eg: API Type, or initialization parameters) are needed 36 | "! to make the determination, be sure to store away parameters passed during "start_sdk()" call into class attributes. 37 | "! @parameter component_type |

Component Type

38 | "! @raising zcx_peng_azoai_sdk_exception |

39 | initialize_sdkcomponent 40 | IMPORTING 41 | component_type TYPE string "See zif_peng_azoai_sdk_constants=>c_component_identifiers --> MODEL / DEPLOYMENT / COMPLETIONS / FILE / FINETUNING / EMBEDDINGS 42 | RAISING 43 | zcx_peng_azoai_sdk_exception, 44 | 45 | "!

Check if a specific operation on a component is permitted

46 | "! This method is used to perform an operation on a specific component of the SDK. It takes in the component_type 47 | "! and operation parameters, which specify the type of component and the operation to be performed, respectively. 48 | "! If the operation should not be performed, raise the zcx_peng_azoai_sdk_exception (or sub-class of it) exception. 49 | "!

50 | "! Note: This will be the first call to this handler class, and the only 51 | "! time the api parameters and initialization parameter (init_params) will be passed in. 52 | "! If that information is required for further checks (eg: initialize_sdkcomponent, perform_operation) 53 | "! the implementation of the handler must put these values into an attribute of the object, so that 54 | "! it can be used later, since the instance of the handler used to call each of these methods remains 55 | "! the same. 56 | "! @parameter component_type |

Component Type

57 | "! @parameter operation |

Operation to be performed

58 | "! @raising zcx_peng_azoai_sdk_exception |

59 | perform_operation 60 | IMPORTING 61 | component_type TYPE string 62 | operation TYPE string 63 | RAISING 64 | zcx_peng_azoai_sdk_exception. 65 | 66 | 67 | 68 | ENDINTERFACE. 69 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_centralcontrol.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_CENTRALCONTROL 7 | E 8 | MSPENG: Interface for Central Control 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | INITIALIZE_SDKCOMPONENT 16 | E 17 | Check if an SDK component is permitted 18 | 19 | 20 | PERFORM_OPERATION 21 | E 22 | Check if a specific operation on a component is permitted 23 | 24 | 25 | START_SDK 26 | E 27 | Check if SDK use is permitted 28 | 29 | 30 | 31 | 32 | INITIALIZE_SDKCOMPONENT 33 | COMPONENT_TYPE 34 | E 35 | Component Type 36 | 37 | 38 | PERFORM_OPERATION 39 | COMPONENT_TYPE 40 | E 41 | Component Type 42 | 43 | 44 | PERFORM_OPERATION 45 | OPERATION 46 | E 47 | Operation to be performed 48 | 49 | 50 | START_SDK 51 | API_BASE 52 | E 53 | API Base URL 54 | 55 | 56 | START_SDK 57 | API_TYPE 58 | E 59 | API Type 60 | 61 | 62 | START_SDK 63 | API_VERSION 64 | E 65 | API Version 66 | 67 | 68 | START_SDK 69 | INIT_PARAMS 70 | E 71 | Other Initialization Parameters 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK 7 | E 8 | MSPENG:Azure Open AI SDK Interface 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | CHAT_COMPLETIONS 16 | E 17 | Returns an instace of SDK Chat Completions component 18 | 19 | 20 | COMPLETIONS 21 | E 22 | Returns an instance of SDK Completions Component 23 | 24 | 25 | DEPLOYMENTS 26 | E 27 | Returns an instance of SDK Deployments Component 28 | 29 | 30 | EMBEDDINGS 31 | E 32 | Returns an instance of SDK Embeddings component 33 | 34 | 35 | FILES 36 | E 37 | Returns an instance of SDK Files Component 38 | 39 | 40 | FINETUNES 41 | E 42 | Returns an instance of SDK Fine-Tunes component 43 | 44 | 45 | INITIALIZE 46 | E 47 | Initialize the SDK (Internal use Only) 48 | 49 | 50 | MODEL 51 | E 52 | Returns the SDK Model Operation Component 53 | 54 | 55 | 56 | 57 | CHAT_COMPLETIONS 58 | CHAT_COMPLETIONS 59 | E 60 | Chat Completions SDK Component 61 | 62 | 63 | COMPLETIONS 64 | COMPLETIONS 65 | E 66 | Completions SDK Component 67 | 68 | 69 | DEPLOYMENTS 70 | DEPLOYMENTS 71 | E 72 | An instance of SDK Deployment Component 73 | 74 | 75 | EMBEDDINGS 76 | EMBEDDING 77 | E 78 | Embeddings SDK Component 79 | 80 | 81 | FILES 82 | FILES 83 | E 84 | Files SDK Component 85 | 86 | 87 | FINETUNES 88 | FINETUNES 89 | E 90 | FineTunes SDK Component 91 | 92 | 93 | INITIALIZE 94 | CONFIG 95 | E 96 | MSPENG:Azure Open AI Config Interface 97 | 98 | 99 | INITIALIZE 100 | ZCX_PENG_AZOAI_SDK_EXCEPTION 101 | E 102 | MSPENG:Azure Open AI ABAP SDK Exception 103 | 104 | 105 | MODEL 106 | ZCX_PENG_AZOAI_SDK_EXCEPTION 107 | E 108 | MSPENG:Azure Open AI ABAP SDK Exception 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_compl.intf.abap: -------------------------------------------------------------------------------- 1 | "!

MSPENG: Azure Open AI SDK - Completions Component

2 | INTERFACE zif_peng_azoai_sdk_comp_compl 3 | PUBLIC . 4 | 5 | * INTERFACES zif_peng_azoai_sdk_component . 6 | 7 | "!

Performs a completion based on prompts and other parameters.

8 | "! A Completion operation is about asking the AI engine something, and getting a response. The 9 | "! asking part of this interaction is called "prompts". Prompt Engineering is used to create 10 | "! prompts which will guide the AI engine to understand exactly what you are asking for, and respond meaningfully 11 | "! for the context of the question. 12 | "!

13 | "! Prompt Engineering: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/prompt-engineering 14 | "!

15 | "! This method performs a completion operation with the prompts provided in parameter prompts, and returns the 16 | "! response received from AI engine. Both the raw JSON string received from AI enging, as well as a parsed, ABAP ready 17 | "! data structure is provided back to the caller. 18 | "!

19 | "! Parameter Details : Prompts
20 | "! prompt : Internal table of strings
21 | "! The prompt(s) to generate completions for a list of strings

22 | "! max_tokens:Integer
23 | "! The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens can't exceed the model's 24 | "! context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).

25 | "! user: String
26 | "! A unique identifier representing your end-user, which can help monitoring and detecting abuse

27 | "! n:Integer
28 | "! How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly 29 | "! consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop. 30 | "! 31 | "! 32 | "! @parameter deploymentid |

Deployment ID on which the prompt must be run.

33 | "! @parameter prompts |

1 or more prompts and their parameters like token length.

34 | "! @parameter statuscode |

HTTP Response status code.

35 | "! @parameter statusreason |

HTTP Status Reason.

36 | "! @parameter json |

JSON String received from AI engine.

37 | "! @parameter response |

Parsed and ABAP ready data structure from JSON String

38 | "! @parameter error |

Error information parsed from JSON string

39 | "! @raising zcx_peng_azoai_sdk_exception |

Exception - Note - an AI layer error is NOT an exception.

40 | METHODS create 41 | IMPORTING 42 | deploymentid TYPE string 43 | prompts TYPE zif_peng_azoai_sdk_types=>ty_completion_input 44 | EXPORTING 45 | statuscode TYPE i 46 | statusreason TYPE string 47 | json TYPE string 48 | response TYPE zif_peng_azoai_sdk_types=>ty_completion_output 49 | error TYPE zif_peng_azoai_sdk_types=>ty_error 50 | RAISING 51 | zcx_peng_azoai_sdk_exception . 52 | ENDINTERFACE. 53 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_compl.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_COMP_COMPL 7 | E 8 | MSPENG: Azure Open AI SDK - Completions Component 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | CREATE 16 | E 17 | Performs a completion based on prompts and other parameters. 18 | 19 | 20 | 21 | 22 | CREATE 23 | DEPLOYMENTID 24 | E 25 | Deployment ID on which the prompt must be run. 26 | 27 | 28 | CREATE 29 | ERROR 30 | E 31 | Error information parsed from JSON string 32 | 33 | 34 | CREATE 35 | JSON 36 | E 37 | JSON String received from AI engine. 38 | 39 | 40 | CREATE 41 | PROMPTS 42 | E 43 | 1 or more prompts and their parameters like token length. 44 | 45 | 46 | CREATE 47 | RESPONSE 48 | E 49 | Parsed and ABAP ready data structure from JSON String 50 | 51 | 52 | CREATE 53 | STATUSCODE 54 | E 55 | HTTP Response status code. 56 | 57 | 58 | CREATE 59 | STATUSREASON 60 | E 61 | HTTP Status Reason. 62 | 63 | 64 | CREATE 65 | ZCX_PENG_AZOAI_SDK_EXCEPTION 66 | E 67 | Exception - Note - an AI layer error is NOT an exception. 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_embed.intf.abap: -------------------------------------------------------------------------------- 1 | "!

MSPENG: Azure Open AI SDK - Embeddings Component

2 | INTERFACE zif_peng_azoai_sdk_comp_embed 3 | PUBLIC . 4 | 5 | 6 | "!

Creates embedding from input text.

7 | "! 8 | "! @parameter deploymentid |

Deployment ID on which the embedding must be generated.

9 | "! @parameter inputs |

Input texts for embedding

10 | "! @parameter statuscode |

HTTP Response status code.

11 | "! @parameter statusreason |

HTTP Status Reason.

12 | "! @parameter json |

JSON String received from AI engine.

13 | "! @parameter response |

Parsed and ABAP ready data structure from JSON String

14 | "! @parameter error |

Error information parsed from JSON string

15 | "! @raising zcx_peng_azoai_sdk_exception |

Exception - Note - an AI layer error is NOT an exception.

16 | METHODS create 17 | IMPORTING 18 | deploymentid TYPE string 19 | inputs TYPE zif_peng_azoai_sdk_types=>ty_embeddings_input 20 | EXPORTING 21 | statuscode TYPE i 22 | statusreason TYPE string 23 | json TYPE string 24 | response TYPE zif_peng_azoai_sdk_types=>ty_embeddings_output 25 | error TYPE zif_peng_azoai_sdk_types=>ty_error 26 | RAISING 27 | zcx_peng_azoai_sdk_exception . 28 | ENDINTERFACE. 29 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_embed.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_COMP_EMBED 7 | E 8 | MSPENG: Azure Open AI SDK - Embeddings Component 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | CREATE 16 | E 17 | Creates embedding from input text. 18 | 19 | 20 | 21 | 22 | CREATE 23 | DEPLOYMENTID 24 | E 25 | Deployment ID on which the embedding must be generated. 26 | 27 | 28 | CREATE 29 | ERROR 30 | E 31 | Error information parsed from JSON string 32 | 33 | 34 | CREATE 35 | INPUTS 36 | E 37 | Input texts for embedding 38 | 39 | 40 | CREATE 41 | JSON 42 | E 43 | JSON String received from AI engine. 44 | 45 | 46 | CREATE 47 | RESPONSE 48 | E 49 | Parsed and ABAP ready data structure from JSON String 50 | 51 | 52 | CREATE 53 | STATUSCODE 54 | E 55 | HTTP Response status code. 56 | 57 | 58 | CREATE 59 | STATUSREASON 60 | E 61 | HTTP Status Reason. 62 | 63 | 64 | CREATE 65 | ZCX_PENG_AZOAI_SDK_EXCEPTION 66 | E 67 | Exception - Note - an AI layer error is NOT an exception. 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_model.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_azoai_sdk_comp_model 2 | PUBLIC . 3 | 4 | 5 | * INTERFACES zif_peng_azoai_sdk_component . 6 | 7 | "!

Get details of a single model.

8 | "! Get details of a specific model, as specified in model ID parameter. 9 | "! @parameter iv_modelid |

Model ID

10 | "! @parameter ov_statuscode |

Status Code

11 | "! @parameter ov_statusreason |

Status Description

12 | "! @parameter ov_json |

JSON string with information about deployment, or error.

13 | "! @parameter ov_model |

ABAP ready model details.

14 | "! @parameter ov_error |

ABAP ready error details

15 | "! @raising zcx_peng_azoai_sdk_exception |

16 | METHODS get 17 | IMPORTING 18 | !iv_modelid TYPE string 19 | EXPORTING 20 | ov_statuscode TYPE i 21 | ov_statusreason TYPE string 22 | ov_json TYPE string 23 | ov_model TYPE zif_peng_azoai_sdk_types=>ty_model_get 24 | ov_error TYPE zif_peng_azoai_sdk_types=>ty_error 25 | RAISING 26 | zcx_peng_azoai_sdk_exception . 27 | 28 | 29 | "!

List all models available

30 | "! Provides a list of all models available for deployment. 31 | "! @parameter ov_statuscode |

Status Code

32 | "! @parameter ov_statusreason |

Status Description

33 | "! @parameter ov_json |

JSON string with information about deployment, or error.

34 | "! @parameter ov_model |

ABAP ready model list.

35 | "! @parameter ov_error |

ABAP ready error details

36 | "! @raising zcx_peng_azoai_sdk_exception |

37 | METHODS list 38 | EXPORTING 39 | ov_statuscode TYPE i 40 | ov_statusreason TYPE string 41 | ov_json TYPE string 42 | ov_model TYPE zif_peng_azoai_sdk_types=>ty_model_list 43 | ov_error TYPE zif_peng_azoai_sdk_types=>ty_error 44 | RAISING 45 | zcx_peng_azoai_sdk_exception . 46 | ENDINTERFACE. 47 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_comp_model.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_COMP_MODEL 7 | E 8 | MSPENG:Azure Open AI SDK - Model Component 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | GET 16 | E 17 | Get details of a single model. 18 | 19 | 20 | LIST 21 | E 22 | List all models available 23 | 24 | 25 | 26 | 27 | GET 28 | IV_MODELID 29 | E 30 | Model ID 31 | 32 | 33 | GET 34 | OV_ERROR 35 | E 36 | ABAP ready error details 37 | 38 | 39 | GET 40 | OV_JSON 41 | E 42 | JSON string with information about deployment, or error. 43 | 44 | 45 | GET 46 | OV_MODEL 47 | E 48 | ABAP ready model details. 49 | 50 | 51 | GET 52 | OV_STATUSCODE 53 | E 54 | Status Code 55 | 56 | 57 | GET 58 | OV_STATUSREASON 59 | E 60 | Status Description 61 | 62 | 63 | LIST 64 | OV_ERROR 65 | E 66 | ABAP ready error details 67 | 68 | 69 | LIST 70 | OV_JSON 71 | E 72 | JSON string with information about deployment, or error. 73 | 74 | 75 | LIST 76 | OV_MODEL 77 | E 78 | ABAP ready model list. 79 | 80 | 81 | LIST 82 | OV_STATUSCODE 83 | E 84 | Status Code 85 | 86 | 87 | LIST 88 | OV_STATUSREASON 89 | E 90 | Status Description 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_component.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_azoai_sdk_component 2 | PUBLIC . 3 | 4 | 5 | "!

Initialize an SDK Component (Internal Use Only)

6 | "! INTERNAL USE ONLY 7 | "!

8 | "! Initializes an SDK component, and registered sub-objects into the instance. 9 | "! @parameter component_set |

Table of component parameters and sub-components

10 | "! @raising zcx_peng_azoai_sdk_exception |

11 | METHODS initialize_component 12 | IMPORTING 13 | component_set TYPE zif_peng_azoai_sdk_typinternal=>tty_component_init_param 14 | RAISING 15 | zcx_peng_azoai_sdk_exception. 16 | 17 | ENDINTERFACE. 18 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_component.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_COMPONENT 7 | E 8 | MSPENG:Azure Open AI SDK Component Interface 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | INITIALIZE_COMPONENT 16 | E 17 | Initialize an SDK Component (Internal Use Only) 18 | 19 | 20 | 21 | 22 | INITIALIZE_COMPONENT 23 | COMPONENT_SET 24 | E 25 | Table of component parameters and sub-components 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_constants.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_azoai_sdk_constants 2 | PUBLIC . 3 | 4 | 5 | CONSTANTS: 6 | 7 | * Version Strings currently supported by Azure Open AI. 8 | BEGIN OF c_versions, 9 | v_2022_12_01 TYPE string VALUE '2022-12-01', 10 | v_2023_03_15_preview TYPE string VALUE '2023-03-15-preview', 11 | v_2023_05_15 TYPE string VALUE '2023-05-15', 12 | v_2023_06_01_preview TYPE string VALUE '2023-06-01-preview', 13 | v_2023_07_01_preview TYPE string VALUE '2023-07-01-preview', 14 | v_2023_08_01_preview TYPE string VALUE '2023-08-01-preview', 15 | END OF c_versions, 16 | 17 | 18 | * List of component identifiers/names. This is used internally for interaction and initialization of AI components. 19 | BEGIN OF c_component_type, 20 | sdk TYPE string VALUE 'SDK', 21 | config TYPE string VALUE 'CONFIG', 22 | helper TYPE string VALUE 'HELPER', 23 | model TYPE string VALUE 'MODEL', 24 | deployment TYPE string VALUE 'DEPLOYMENT', 25 | completions TYPE string VALUE 'COMPLETIONS', 26 | chat_completions TYPE string VALUE 'CHAT_COMPLETIONS', 27 | file TYPE string VALUE 'FILE', 28 | fine_tuning TYPE string VALUE 'FINETUNING', 29 | embeddings TYPE string VALUE 'EMBEDDINGS', 30 | END OF c_component_type, 31 | 32 | * Operations supported by components. NOTE: This is an exhaustive list of operations by all components. Not all operations 33 | * are supported by every component. 34 | BEGIN OF c_component_operations, 35 | cancel TYPE string VALUE 'CANCEL', 36 | create TYPE string VALUE 'CREATE', 37 | delete TYPE string VALUE 'DELETE', 38 | get TYPE string VALUE 'GET', 39 | get_content TYPE string VALUE 'GET_CONTENT', 40 | get_events TYPE string VALUE 'GET_EVENTS', 41 | import TYPE string VALUE 'IMPORT', 42 | initialize TYPE string VALUE 'INITIALIZE', 43 | list TYPE string VALUE 'LIST', 44 | update TYPE string VALUE 'UPDATE', 45 | upload TYPE string VALUE 'UPLOAD', 46 | END OF c_component_operations, 47 | 48 | BEGIN OF c_component_classification, 49 | core TYPE string VALUE 'CORE', 50 | submodule TYPE string VALUE 'SUBMODULE', 51 | END OF c_component_classification, 52 | 53 | 54 | * open AI resource identifier. 55 | c_azure_openairesource TYPE string VALUE '.openai.azure.com', 56 | c_openairesource TYPE string VALUE 'api.openai.com', 57 | 58 | * File purpose. 59 | BEGIN OF c_filepurpose, 60 | finetune TYPE string VALUE 'fine-tune', 61 | finetuneresult TYPE string VALUE 'fine-tune-results', 62 | END OF c_filepurpose, 63 | 64 | c_file_upload_boundary TYPE string VALUE '----MSPlatformEngineering{guid}', 65 | 66 | * API Authentication strategies currently supported. 67 | BEGIN OF c_apitype, 68 | azure TYPE string VALUE 'azure', 69 | azure_ad TYPE string VALUE 'azure_ad', 70 | openai TYPE string VALUE 'openai', 71 | END OF c_apitype, 72 | 73 | 74 | * API Authentication Header Parameter values 75 | * Author Side NOTE : Wish there were ENums in ECC - but unfortunately, its only available in S4. 76 | BEGIN OF c_authheader_paramnames, 77 | api_key TYPE string VALUE 'api-key', 78 | authorization TYPE string VALUE 'Authorization', 79 | bearer TYPE string VALUE 'Bearer', 80 | END OF c_authheader_paramnames, 81 | 82 | * Operational parameter names. This will be used for passing in operational params during config initialization. 83 | BEGIN OF c_operational_paramnames, 84 | version TYPE string VALUE 'version', 85 | endpoint TYPE string VALUE 'endpoint', 86 | destination TYPE string VALUE 'destination', 87 | apitype TYPE string VALUE 'apitype', 88 | apikey TYPE string VALUE 'apikey', 89 | END OF c_operational_paramnames, 90 | 91 | * Central Control Class Name. 92 | c_central_control_class TYPE string VALUE 'ZCL_PENG_AZOAI_CENTRALCONTROL', 93 | c_sdk_default_profile_name TYPE zde_azoaisdk_profileid VALUE 'DEFAULT', 94 | 95 | BEGIN OF c_urltemplateproviders, 96 | azureopenai TYPE string VALUE 'zcl_peng_azoai_urlprovider', 97 | openai TYPE string VALUE 'zcl_peng_oai_urlprovider', 98 | END OF c_urltemplateproviders, 99 | 100 | BEGIN OF c_chatcompletion_role, 101 | user TYPE string VALUE 'user', 102 | assistant TYPE string VALUE 'assistant', 103 | system TYPE string VALUE 'system', 104 | END OF c_chatcompletion_role. 105 | 106 | 107 | 108 | 109 | 110 | ENDINTERFACE. 111 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_constants.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_CONSTANTS 7 | E 8 | MSPENG:Azure Open AI Constants 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_types.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_TYPES 7 | E 8 | MSPENG:Azure Open AI Types Interface 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_typinternal.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_TYPINTERNAL 7 | E 8 | MSPENG:Azure Open AI SDK Internal Data Types (DO NOT USE) 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_uripatterns.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_azoai_sdk_uripatterns 2 | PUBLIC . 3 | 4 | CONSTANTS: 5 | 6 | BEGIN OF supported_protocols, 7 | https TYPE string VALUE 'https://', 8 | END OF supported_protocols, 9 | 10 | BEGIN OF template_ids, 11 | endpoint TYPE string VALUE '{endpoint}', 12 | version TYPE string VALUE '{version}', 13 | deploymentid TYPE string VALUE '{deployment-id}', 14 | modelid TYPE string VALUE '{model-id}', 15 | fileid TYPE string VALUE '{file-id}', 16 | finetuneid TYPE string VALUE '{fine-tune-id}', 17 | END OF template_ids, 18 | 19 | * This is the endpoint ID. In future, if the end point remains the same, we will map this ID to version. 20 | * This allows us to not define the same end point repeatedly. 21 | BEGIN OF version_20221201_endpoint, 22 | 23 | * Deployment End points (https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/deployments) 24 | BEGIN OF deployments, 25 | create TYPE string VALUE '{endpoint}/openai/deployments?api-version={version}' , "HTTP - POST. 26 | delete TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}?api-version={version}' , "HTTP - DELETE 27 | get TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}?api-version={version}' , "HTTP - GET 28 | list TYPE string VALUE '{endpoint}/openai/deployments?api-version={version}' , "HTTP - GET. 29 | update TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}?api-version={version}' , "HTTP - PATCH 30 | END OF deployments, 31 | 32 | 33 | * Model end points (https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/models) 34 | BEGIN OF model, 35 | get TYPE string VALUE '{endpoint}/openai/models/{model-id}?api-version={version}' , "HTTP - GET 36 | list TYPE string VALUE '{endpoint}/openai/models?api-version={version}' , "HTTP - GET 37 | END OF model, 38 | 39 | * Files end points ( https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/files) 40 | BEGIN OF files, 41 | delete TYPE string VALUE '{endpoint}/openai/files/{file-id}?api-version={version}', 42 | get TYPE string VALUE '{endpoint}/openai/files/{file-id}?api-version={version}', 43 | get_content TYPE string VALUE '{endpoint}/openai/files/{file-id}/content?api-version={version}', 44 | import TYPE string VALUE '{endpoint}/openai/files/import?api-version={version}', 45 | list TYPE string VALUE '{endpoint}/openai/files?api-version={version}', 46 | upload TYPE string VALUE '{endpoint}/openai/files?api-version={version}', 47 | END OF files, 48 | 49 | * Fine tunes end points (https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/fine-tunes) 50 | BEGIN OF finetunes, 51 | cancel TYPE string VALUE '{endpoint}/openai/fine-tunes/{fine-tune-id}/cancel?api-version={version}' , "HTTP - POST 52 | create TYPE string VALUE '{endpoint}/openai/fine-tunes?api-version={version}' , "HTTP - POST 53 | delete TYPE string VALUE '{endpoint}/openai/fine-tunes/{fine-tune-id}?api-version={version}' , "HTTP - DELETE 54 | get TYPE string VALUE '{endpoint}/openai/fine-tunes/{fine-tune-id}?api-version={version}' , "HTTP - GET 55 | events TYPE string VALUE '{endpoint}/openai/fine-tunes/{fine-tune-id}/events?api-version={version}' , "HTTP - GET 56 | list TYPE string VALUE '{endpoint}/openai/fine-tunes?api-version={version}' , "HTTP - GET 57 | END OF finetunes, 58 | 59 | BEGIN OF completions, 60 | create TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}/completions?api-version={version}', "HTTP - POST 61 | END OF completions, 62 | 63 | BEGIN OF embeddings, 64 | create TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}/embeddings?api-version={version}', "HTTP - POST 65 | END OF embeddings, 66 | END OF version_20221201_endpoint, 67 | 68 | BEGIN OF version_2023_03_15_preview, 69 | BEGIN OF completions, 70 | create TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={version}', "HTTP - POST 71 | END OF completions, 72 | BEGIN OF chat_completions, 73 | create TYPE string VALUE '{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={version}', "HTTP - POST 74 | END OF chat_completions, 75 | END OF version_2023_03_15_preview. 76 | 77 | ENDINTERFACE. 78 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zif_peng_azoai_sdk_uripatterns.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AZOAI_SDK_URIPATTERNS 7 | E 8 | MSPENG:Azure Open AI SDK URI Patterns 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_core/zmspeng_azoaisdk_msg.msag.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZMSPENG_AZOAISDK_MSG 7 | E 8 | MSPENG:Azure Open AI SDK Messages 9 | 10 | 11 | 12 | E 13 | ZMSPENG_AZOAISDK_MSG 14 | 000 15 | Version Not Supported. 16 | 17 | 18 | E 19 | ZMSPENG_AZOAISDK_MSG 20 | 001 21 | Invalid Azure Open AI Resource Base URL 22 | 23 | 24 | E 25 | ZMSPENG_AZOAISDK_MSG 26 | 002 27 | Invalid Authentication &. 28 | 29 | 30 | E 31 | ZMSPENG_AZOAISDK_MSG 32 | 003 33 | Feature Not Implemented or Requested operation not valid for version. 34 | 35 | 36 | E 37 | ZMSPENG_AZOAISDK_MSG 38 | 004 39 | Communication Failure to Azure Open AI Resource. Check URL. 40 | 41 | 42 | E 43 | ZMSPENG_AZOAISDK_MSG 44 | 005 45 | Component Initialization Failed (Internal SDK Error). 46 | 47 | 48 | E 49 | ZMSPENG_AZOAISDK_MSG 50 | 006 51 | Parameter & not available. 52 | 53 | 54 | E 55 | ZMSPENG_AZOAISDK_MSG 56 | 007 57 | Error in profile. Invalid Handler class. 58 | 59 | 60 | E 61 | ZMSPENG_AZOAISDK_MSG 62 | 008 63 | & Usage not permitted through run profile. Contact SDK Administrator. 64 | 65 | 66 | E 67 | ZMSPENG_AZOAISDK_MSG 68 | 009 69 | & Usage not valid for version. 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Azure Open AI SDK Demos 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_aisdkdemo_chatcompl_simple.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report zp_aisdkdemo_chatcompl_simple 3 | *&---------------------------------------------------------------------* 4 | *& 5 | *&---------------------------------------------------------------------* 6 | REPORT zp_aisdkdemo_chatcompl_simple. 7 | 8 | *INCLUDE zp_msaisdkdemo_params_top. "Common Input Parameters (AI End Point, Version, Key) 9 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 10 | 11 | PARAMETERS: 12 | p_url TYPE string OBLIGATORY LOWER CASE, 13 | p_ver TYPE string OBLIGATORY LOWER CASE DEFAULT '2023-03-15-preview', 14 | p_key TYPE string OBLIGATORY LOWER CASE. 15 | 16 | 17 | PARAMETERS: 18 | p_depid TYPE string OBLIGATORY LOWER CASE. 19 | 20 | DATA: 21 | chatcompl_input TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_input, 22 | chatcompl_output TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_output. 23 | 24 | 25 | START-OF-SELECTION. 26 | 27 | TRY. 28 | * Create an instance of MS AI SDK for SAP. 29 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 30 | api_version = p_ver 31 | api_base = p_url 32 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-azure 33 | api_key = p_key 34 | ). 35 | 36 | * Construct the prompt with system and user roles. 37 | * APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING FIELD-SYMBOL(). 38 | * -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-system. 39 | * -content = |You are an expert ABAP Developer|. 40 | * 41 | * APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING . 42 | * -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-user. 43 | * -content = |Write an ABAP program which gets contents from www.microsoft.com website. Include comments in the code so that anyone can understand the code.|. 44 | 45 | APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING FIELD-SYMBOL(). 46 | -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-system. 47 | -content = |You are a math expert |. 48 | 49 | APPEND INITIAL LINE TO chatcompl_input-messages ASSIGNING . 50 | -role = zif_peng_azoai_sdk_constants=>c_chatcompletion_role-user. 51 | -content = | Using 5 randome numbers from 1 to 10, generate the sum, product and show me the result.|. 52 | -content = |{ -content } Additionally, generate ABAP code and Python code and format the code text using HTML so that I can display it. |. 53 | -content = |{ -content } Make sure, the entire response is provided as richly formatted HTML page so that it can be displayed in a browser. |. 54 | 55 | 56 | * Invoke Chat completion. 57 | sdk_instance->chat_completions( )->create( 58 | EXPORTING 59 | deploymentid = p_depid 60 | prompts = chatcompl_input 61 | IMPORTING 62 | statuscode = status_code " Status Code 63 | statusreason = status_reason " HTTP status description 64 | json = returnjson " JSON String returned from AI Resource 65 | response = chatcompl_output 66 | error = error " ABAP Ready error details 67 | ). 68 | 69 | * Display the results. 70 | * cl_demo_output=>display_text( text = chatcompl_output-choices[ 1 ]-message-content ). 71 | cl_demo_output=>display_html( html = chatcompl_output-choices[ 1 ]-message-content ). 72 | 73 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 74 | MESSAGE ex TYPE 'I'. 75 | 76 | CATCH cx_root. 77 | MESSAGE |An error occured - perhaps the model name is incorrect? Or Access key is incorrect?| TYPE 'I'. 78 | ENDTRY. 79 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_aisdkdemo_chatcompl_simple.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_AISDKDEMO_CHATCOMPL_SIMPLE 7 | S 8 | 1 9 | X 10 | D$S 11 | X 12 | 13 | 14 | 15 | R 16 | MSPENG: AI SDK Demo programs - Chat Completions - Simple 17 | 56 18 | 19 | 20 | S 21 | P_DEPID 22 | Deployment ID 23 | 21 24 | 25 | 26 | S 27 | P_KEY 28 | Key 29 | 11 30 | 31 | 32 | S 33 | P_URL 34 | Azure Open AI Base URL 35 | 30 36 | 37 | 38 | S 39 | P_VER 40 | Version 41 | 15 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_aisdkdemo_embeddings.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report ZP_AISDKDEMO_EMBEDDINGS 3 | *&---------------------------------------------------------------------* 4 | *& 5 | *&---------------------------------------------------------------------* 6 | REPORT zp_aisdkdemo_embeddings. 7 | 8 | 9 | INCLUDE zp_msaisdkdemo_params_top. "Common Input Parameters (AI End Point, Version, Key) 10 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 11 | 12 | PARAMETERS: 13 | p_depid TYPE string OBLIGATORY LOWER CASE. 14 | 15 | DATA: 16 | embeddings_input TYPE zif_peng_azoai_sdk_types=>ty_embeddings_input, 17 | embeddings_output TYPE zif_peng_azoai_sdk_types=>ty_embeddings_output. 18 | 19 | 20 | START-OF-SELECTION. 21 | 22 | TRY. 23 | 24 | * Create an instance of MS AI SDK for SAP. 25 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 26 | api_version = p_ver 27 | api_base = p_url 28 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-azure 29 | api_key = p_key 30 | ). 31 | 32 | * Specify text(s) to generate embedding. 33 | APPEND INITIAL LINE TO embeddings_input-input ASSIGNING FIELD-SYMBOL(). 34 | = 'Hello world!'. 35 | 36 | * Perform the embeddings operation. 37 | sdk_instance->embeddings( )->create( 38 | EXPORTING 39 | deploymentid = p_depid " Deployment ID on which the embedding must be generated. 40 | inputs = embeddings_input " Input texts for embedding 41 | IMPORTING 42 | statuscode = status_code " Status Code 43 | statusreason = status_reason " HTTP status description 44 | json = returnjson " JSON String returned from AI Resource 45 | response = embeddings_output " ABAP Friendly Embeddings operaiton output 46 | error = error " ABAP Ready error details 47 | ). 48 | 49 | BREAK-POINT. 50 | 51 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 52 | MESSAGE ex TYPE 'I'. 53 | ENDTRY. 54 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_aisdkdemo_embeddings.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_AISDKDEMO_EMBEDDINGS 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MSPENG: AI SDK Demo programs - Embeddings 16 | 41 17 | 18 | 19 | S 20 | P_DEPID 21 | Deployment ID 22 | 21 23 | 24 | 25 | S 26 | P_KEY 27 | Key 28 | 11 29 | 30 | 31 | S 32 | P_URL 33 | Base URL 34 | 16 35 | 36 | 37 | S 38 | P_VER 39 | Version 40 | 15 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_chatui.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_CHATUI 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include ZP_MSAISDKDEMO_CHATUI 15 | 29 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_chatui_def.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_CHATUI_DEF 3 | * Provide Defaults for UI Elements 4 | *&---------------------------------------------------------------------* 5 | 6 | 7 | gv_temp_info = 8 | |It controls randomness. | && 9 | |Lowering the temperature means that the model will produce more repetitive and deterministic responses. | && 10 | |Increasing the temperature will result in more unexpected or creative responses. | && 11 | |Try adjusting temperature or Top P but not both.|. 12 | gv_topp_info = |Similar to temperature, this controls randomness but uses a different method. | && 13 | |Lowering Top P will narrow the model’s token selection to likelier tokens. | && 14 | |Increasing Top P will let the model choose from tokens with both high and low likelihood.| && 15 | |Try adjusting temperature or Top P but not both.|. 16 | gv_stop_info = |Make the model end its response at a desired point. | && 17 | |Make the model end its response at a desired point. | && 18 | |You can include as many as four stop sequences. | . 19 | gv_pres_info = |Reduce the chance of repeating any token that has appeared in the text at all so far. | && 20 | | This increases the likelihood of introducing new topics in a response. | . 21 | gv_freq_info = |Reduce the chance of repeating a token proportionally based on how often it has appeared in the text so far.| && 22 | |This decreases the likelihood of repeating the exact same text in a response.|. 23 | 24 | g_templtable = value #( ( key = 1 temp_name = 'Empty Template' temp_text = value #( ( lineno = 1 text_line = '' ) ) ) 25 | ( key = 2 temp_name = 'Default Template' 26 | temp_text = value #( ( lineno = 1 text_line = 'You are an AI assistant that helps people find information.' ) ) ) 27 | ( key = 3 temp_name = 'JSON Formatter Assistant' 28 | temp_text = value #( ( lineno = 1 text_line = 'You are an AI assistant that helps users turn a natural language list into JSON format.' ) ) ) 29 | ( key = 4 temp_name = 'ABAP Developer Assistant' 30 | temp_text = value #( ( lineno = 1 text_line = 'You are an AI assistant that helps people with ABAP syntax.' ) 31 | ( lineno = 2 text_line = 'User will provide requirement in natural language.' ) 32 | ( lineno = 3 text_line = 'You will provide ABAP code for implementing that requirement.' ) ) ) 33 | ( key = 5 temp_name = 'ABAP Documentation Assistant' 34 | temp_text = 35 | value #( ( lineno = 1 text_line = 'You are an AI assistant that explains ABAP Code.' ) 36 | ( lineno = 2 text_line = 'User will provide an ABAP program.' ) 37 | ( lineno = 3 text_line = 'You will explain ABAP code in natural language.' ) 38 | ( lineno = 4 text_line = 'Add sections with headings for explaining multiple line of code' ) ) ) 39 | 40 | ( key = 6 temp_name = 'Summarization Template' 41 | temp_text = value #( ( lineno = 1 text_line = 'You are an AI assistant that helps people ' ) 42 | ( lineno = 2 text_line = 'to generate abstractive summaries of texts.' ) 43 | ( lineno = 3 text_line = 'Based on users input you can generate summary as keypoints or paragraph' ) 44 | ) 45 | ) ). 46 | 47 | g_item_table = value #( for l_tempstruct in g_templtable ( key = l_tempstruct-key 48 | text = l_tempstruct-temp_name ) 49 | ). 50 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_chatui_def.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_CHATUI_DEF 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include ZP_MSAISDKDEMO_CHATUI_DEF 15 | 33 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_chatui_top.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_CHATUI_TOP 3 | *&---------------------------------------------------------------------* 4 | 5 | constants: c_line_length type i value 256. 6 | 7 | constants : c_label_width type i value 15, 8 | c_parameter1_text type string 9 | value ' 0 - 1', 10 | c_parameter2_text type string value ' 0 - 2', " (0.10,0.11,0.20,..1.9, 2 etc. )', 11 | c_parameter3_text type string value 'e.g. <|im_end|> ', 12 | c_def_aitext type string value 'You are an AI Assistant that helps people find information.'. 13 | * define table type for data exchange 14 | types: begin of mytable_line, 15 | line(c_line_length) type c, 16 | end of mytable_line . 17 | TYPES: BEGIN OF t_text, 18 | lineno TYPE i, 19 | text_line type string , 20 | END OF t_text, 21 | t_text_tab TYPE STANDARD TABLE OF t_text with NON-UNIQUE key lineno . 22 | types : begin of template_type, 23 | key type i, 24 | temp_name type string, 25 | temp_text type t_text_tab , 26 | end of template_type. 27 | * table to exchange text 28 | data g_templtable TYPE TABLE OF template_type. 29 | data g_mytable type table of mytable_line. 30 | data g_systable type table of mytable_line. 31 | data: g_templates type table of template_type,w_template type template_type. 32 | data: g_item_table TYPE VRM_VALUES," INITIAL SIZE 0, 33 | g_ITEM_STRUCT TYPE VRM_VALUE. 34 | data : gv_txt_temp type string value 'Use a template to get started, or just start writing your own system message below.'. 35 | data: gv_temp_info type string, 36 | gv_topp_info type string, 37 | gv_stop_info type string, 38 | gv_freq_info type string, 39 | gv_pres_info type string. 40 | 41 | data: 42 | g_text_input type ref to cl_gui_textedit, "Text Editor for taking user's input 43 | g_sysmsg_input type ref to cl_gui_textedit, "Text Editor for System Message 44 | g_input_temp type ref to cl_gui_input_field, "Text field for Temperature 45 | g_input_topp type ref to cl_gui_input_field, "Text field for TopP 46 | g_input_stop type ref to cl_gui_input_field, "Text field for Stop Sequence 47 | g_input_freq type ref to cl_gui_input_field, "Text field for Frequency Penalty 48 | g_input_pres type ref to cl_gui_input_field, "Text field for Presence Penalty 49 | g_systemp_sel type ref to cl_gui_combobox, 50 | 51 | label_ec_input type string, 52 | g_str_input type string, 53 | g_sys_input type string, 54 | g_text_output type ref to cl_gui_textedit, 55 | g_str_output type string, 56 | g_ok_code like sy-ucomm, 57 | 58 | * n TYPE i, "How many chat completion choices to generate for each input message 59 | 60 | g_temp_val type string, " Temperature 61 | g_topt_val type string, " Topt 62 | g_stop_val type string, " Stop Sequence 63 | g_freq_val type string, " Frequency Penalty 64 | g_pres_val type string. " Presence Penalty 65 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_chatui_top.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_CHATUI_TOP 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include ZP_MSAISDKDEMO_CHATUI_TOP 15 | 33 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_common.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_COMMON 3 | *&---------------------------------------------------------------------* 4 | 5 | DATA: 6 | sdk_instance TYPE REF TO zif_peng_azoai_sdk, "MS AI SDK for SAP Instance 7 | status_code TYPE i, "Return Status Code 8 | status_reason TYPE string, "Return Status Reason 9 | returnjson TYPE string, "Return JSON. The content of this JSON string is parsed and made available through ABAP data types. 10 | error TYPE zif_peng_azoai_sdk_types=>ty_error. "ABAP Type for Error 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_common.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_COMMON 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | MS Platform Engineering: Azure Open AI SDK Demos: Common Data 15 | 61 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_deployments.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_DEPLOYMENTS 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo Program for Deployment 16 | 47 17 | 18 | 19 | S 20 | P_KEY 21 | Key 22 | 11 23 | 24 | 25 | S 26 | P_MODID 27 | Model ID for Deployment 28 | 31 29 | 30 | 31 | S 32 | P_URL 33 | Base URL 34 | 16 35 | 36 | 37 | S 38 | P_VER 39 | Version 40 | 15 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_files.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_FILES 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo Program for Files 16 | 55 17 | 18 | 19 | S 20 | P_KEY 21 | Key 22 | 11 23 | 24 | 25 | S 26 | P_URL 27 | Base URL 28 | 16 29 | 30 | 31 | S 32 | P_VER 33 | Version 34 | 15 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_finetunes.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_FINETUNES 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo Program for Fine Tunes 16 | 55 17 | 18 | 19 | S 20 | P_KEY 21 | Key 22 | 11 23 | 24 | 25 | S 26 | P_URL 27 | Base URL 28 | 16 29 | 30 | 31 | S 32 | P_VER 33 | Version 34 | 15 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_models.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Report ZP_MSAISDKDEMO_MODELS 3 | *& 4 | *&---------------------------------------------------------------------* 5 | *& 6 | *& 7 | *&---------------------------------------------------------------------* 8 | REPORT zp_msaisdkdemo_models. 9 | INCLUDE zp_msaisdkdemo_params_top. "Common Input Parameters (AI End Point, Version, Key) 10 | INCLUDE zp_msaisdkdemo_common. "Common Data Declarations (SDK Instance Object, status Code, Status Reason, Return JSON String, Error ) 11 | 12 | DATA: 13 | model_list TYPE zif_peng_azoai_sdk_types=>ty_model_list, "ABAP Type for List of Models 14 | model_get TYPE zif_peng_azoai_sdk_types=>ty_model_get. "ABAP Type for A single Model information 15 | 16 | 17 | START-OF-SELECTION. 18 | 19 | TRY. 20 | * Create an instance of MS AI SDK for SAP. 21 | sdk_instance = zcl_peng_azoai_sdk_factory=>get_instance( )->get_sdk( 22 | api_version = p_ver 23 | api_base = p_url 24 | api_type = zif_peng_azoai_sdk_constants=>c_apitype-azure 25 | api_key = p_key 26 | ). 27 | ************************** Get a list of all available Models ****************** 28 | 29 | * Get a list of all models (Models - List ). 30 | sdk_instance->model( )->list( 31 | IMPORTING 32 | ov_statuscode = status_code " Status Code 33 | ov_statusreason = status_reason " HTTP status description 34 | ov_json = returnjson "JSON String returned from AI Resource 35 | ov_model = model_list "List of Models available ( Type :zif_peng_azoai_sdk_types=>ty_model_list ) 36 | ov_error = error "Error if occured, returned from AI Resource (Type : zif_peng_azoai_sdk_types=>ty_error) 37 | ). 38 | ******************************************************************************** 39 | BREAK-POINT. 40 | 41 | ************************** Get details of a specific Model ********************* 42 | 43 | * Get the Model information for Text-Davinci-003 (Models - Get). 44 | sdk_instance->model( )->get( 45 | EXPORTING 46 | iv_modelid = 'text-davinci-003' " Model ID 47 | IMPORTING 48 | ov_statuscode = status_code " HTTP status code 49 | ov_statusreason = status_reason 50 | ov_json = returnjson 51 | ov_model = model_get 52 | ov_error = error 53 | ). 54 | ******************************************************************************** 55 | BREAK-POINT. 56 | 57 | CATCH zcx_peng_azoai_sdk_exception INTO DATA(ex). " MSPENG:Azure Open AI ABAP SDK Exception 58 | MESSAGE ex TYPE 'I'. 59 | ENDTRY. 60 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_models.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_MODELS 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 | R 15 | MS AI SDK for SAP : Demo Program for Model 16 | 55 17 | 18 | 19 | S 20 | P_KEY 21 | Key 22 | 11 23 | 24 | 25 | S 26 | P_URL 27 | Base URL 28 | 16 29 | 30 | 31 | S 32 | P_VER 33 | Version 34 | 15 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_params_top.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_PARAMS_TOP Report ZP_MSAISDKDEMO_MODELS 3 | *& 4 | *&---------------------------------------------------------------------* 5 | *REPORT ZP_MSAISDKDEMO_MODELS. 6 | PARAMETERS: 7 | p_url TYPE string OBLIGATORY LOWER CASE, 8 | p_ver TYPE string OBLIGATORY LOWER CASE DEFAULT '2022-12-01', 9 | p_key TYPE string OBLIGATORY LOWER CASE. 10 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_params_top.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_PARAMS_TOP 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include ZP_MSAISDKDEMO_PARAMS_TOP 15 | 33 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_selection.prog.abap: -------------------------------------------------------------------------------- 1 | *&---------------------------------------------------------------------* 2 | *& Include ZP_MSAISDKDEMO_SELECTION 3 | *&---------------------------------------------------------------------* 4 | parameters: 5 | p_url type string obligatory lower case, 6 | p_ver type string obligatory lower case default '2023-03-15-preview', 7 | p_key type string obligatory lower case. 8 | 9 | 10 | parameters: 11 | p_depid type string obligatory lower case. 12 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_msaisdkdemo_selection.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_MSAISDKDEMO_SELECTION 7 | I 8 | E 9 | X 10 | 11 | 12 | 13 | R 14 | Include ZP_MSAISDKDEMO_SELECTION 15 | 32 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_demos/zp_pengg_azoai_demo_completion.prog.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZP_PENGG_AZOAI_DEMO_COMPLETION 7 | 1 8 | E 9 | X 10 | X 11 | 12 | 13 | 14 |
15 | ZP_PENGG_AZOAI_DEMO_COMPLETION 16 | 9000 17 | E 18 | Main Screen 19 | N 20 | 9000 21 | 047 22 | 176 23 |
24 | 25 | 26 | SCREEN 27 | SCREEN 28 | 29 | 30 | CUST_CTRL 31 | TXTINPUT 32 | SCREEN 33 | 003 34 | 002 35 | 173 36 | 010 37 | 38 | 39 | CUST_CTRL 40 | TXTOUTPUT 41 | SCREEN 42 | 016 43 | 002 44 | 172 45 | 026 46 | 47 | 48 | 49 | 50 | SCREEN 51 | SCREEN 52 | PUSH 53 | BTNASKAI 54 | Ask_AI________ 55 | ICON_START_VIEWER 56 | X 57 | 014 58 | 078 59 | 019 60 | 017 61 | 001 62 | ASKAI 63 | CHAR 64 | N 65 | 66 | 67 | SCREEN 68 | SCREEN 69 | OKCODE 70 | G_OK_CODE 71 | ____________________ 72 | 020 73 | 020 74 | 001 75 | CHAR 76 | X 77 | 78 | 79 | 80 | 81 | PROCESS BEFORE OUTPUT. 82 | 83 | 84 | MODULE PBO. 85 | 86 | 87 | * 88 | 89 | 90 | PROCESS AFTER INPUT. 91 | 92 | 93 | MODULE PAI. 94 | 95 | 96 |
97 |
98 | 99 | 100 | R 101 | Microsoft Platform Engineering: Azure Open AI SDK Demo - Completions 102 | 68 103 | 104 | 105 | S 106 | P_DEPID 107 | Deployment ID 108 | 21 109 | 110 | 111 | S 112 | P_KEY 113 | Key 114 | 30 115 | 116 | 117 | S 118 | P_LENGTH 119 | Token Length 120 | 20 121 | 122 | 123 | S 124 | P_URL 125 | Azure Open AI Base URL 126 | 30 127 | 128 | 129 | S 130 | P_VER 131 | Version 132 | 15 133 | 134 | 135 |
136 |
137 |
138 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering:Azure Open AI SDK Version 1.0 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_ai_sdk_v1_chatcomplet.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_ai_sdk_v1_chatcomplet DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_ai_sdk_chatcompl_base 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | METHODS zif_peng_ai_sdk_comp_chatcompl~create REDEFINITION. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS zcl_peng_ai_sdk_v1_chatcomplet IMPLEMENTATION. 15 | METHOD zif_peng_ai_sdk_comp_chatcompl~create. 16 | ***************************************************************************************************************** 17 | * Class : ZCL_PENG_AI_SDK_V1_CHATCOMPLET 18 | * Method : zif_peng_ai_sdk_comp_chatcompl~create 19 | * Created by : GONAIR (Gopal Nair) 20 | * Date : May 7, 2023 21 | *------------------------------------------------------------------------------------------------------------- 22 | * Description 23 | *------------------------------------------------------------------------------------------------------------- 24 | * Performs a Chat completion based on prompts and other parameters. 25 | * 26 | * A Completion operation is about asking the AI engine something, and getting a response. The asking part of this 27 | * interaction is called "prompts". Prompt Engineering is used to create prompts which will guide the AI engine to 28 | * understand exactly what you are asking for, and respond meaningfully for the context of the question. 29 | *------------------------------------------------------------------------------------------------------------- 30 | * Modification History 31 | *------------------------------------------------------------------------------------------------------------- 32 | * May 7, 2023 // GONAIR // Initial Version 33 | ***************************************************************************************************************** 34 | 35 | DATA: 36 | l_completions_create TYPE zif_peng_azoai_sdk_types=>ty_chatcompletion_input. 37 | 38 | * Check if the operation is permitted for the run profile by asking profile handler. 39 | _objconfig->get_runprofile_handler( )->zif_peng_azoai_centralcontrol~perform_operation( 40 | EXPORTING 41 | component_type = _component_type 42 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 43 | ). 44 | 45 | 46 | l_completions_create = prompts. 47 | 48 | * If there are no prompts entered by the user, then put in 1 entry with empty string. 49 | IF l_completions_create-messages[] IS INITIAL. 50 | RETURN. 51 | ENDIF. 52 | 53 | * Get the actual URL and HTTP communication objects from helper layer. 54 | _objsdkhelper->get_httpobjs_from_uripattern( 55 | EXPORTING 56 | uri_pattern = _objconfig->get_accesspoint_provider( )->get_urltemplate( 57 | component = _component_type 58 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 59 | ) "{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={version}' 60 | ivobj_config = _objconfig 61 | ivt_templatecomponents = VALUE #( ( name = zif_peng_azoai_sdk_uripatterns=>template_ids-deploymentid value = deploymentid ) ) "Deployment ID. 62 | IMPORTING 63 | ov_url = DATA(actual_url) 64 | ovobj_http = DATA(lo_http) 65 | ovobj_http_rest = DATA(lo_http_rest) 66 | ). 67 | 68 | * Prepare the body and set it 69 | DATA(lo_request) = lo_http_rest->if_rest_client~create_request_entity( ). 70 | lo_request->set_content_type( iv_media_type = 'application/json' ). 71 | DATA(post_data) = to_lower( /ui2/cl_json=>serialize( data = l_completions_create compress = /ui2/cl_json=>c_bool-true ) ) . 72 | lo_request->set_string_data( iv_data = post_data ). 73 | 74 | * Trigger the network operation. 75 | lo_http_rest->if_rest_client~post( io_entity = lo_request ). 76 | 77 | * Get Status, results and error if any from helper layer. 78 | _objsdkhelper->do_receive( 79 | EXPORTING 80 | ivobj_http_client = lo_http 81 | ivobj_http_rest = lo_http_rest 82 | IMPORTING 83 | ov_statuscode = statuscode 84 | ov_statusdescr = statusreason 85 | ov_jsonstring = json 86 | CHANGING 87 | iov_result = response 88 | iov_error = error 89 | ). 90 | 91 | 92 | ENDMETHOD. 93 | 94 | ENDCLASS. 95 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_ai_sdk_v1_chatcomplet.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AI_SDK_V1_CHATCOMPLET 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_ctrl_denyall.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_ctrl_denyall DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_centralcontrol 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | METHODS: 8 | zif_peng_azoai_centralcontrol~start_sdk REDEFINITION, 9 | zif_peng_azoai_centralcontrol~initialize_sdkcomponent REDEFINITION, 10 | zif_peng_azoai_centralcontrol~perform_operation REDEFINITION. 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | ENDCLASS. 14 | 15 | 16 | 17 | CLASS zcl_peng_azoai_ctrl_denyall IMPLEMENTATION. 18 | METHOD zif_peng_azoai_centralcontrol~initialize_sdkcomponent. 19 | RAISE EXCEPTION TYPE zcx_peng_azoai_sdk_exception 20 | EXPORTING 21 | textid = zcx_peng_azoai_sdk_exception=>component_use_not_permitted 22 | iv_attr1 = CONV #( component_type ). 23 | 24 | ENDMETHOD. 25 | 26 | METHOD zif_peng_azoai_centralcontrol~perform_operation. 27 | RAISE EXCEPTION TYPE zcx_peng_azoai_sdk_exception 28 | EXPORTING 29 | textid = zcx_peng_azoai_sdk_exception=>component_use_not_permitted 30 | iv_attr1 = |{ component_type }/{ operation }|. 31 | ENDMETHOD. 32 | 33 | METHOD zif_peng_azoai_centralcontrol~start_sdk. 34 | RAISE EXCEPTION TYPE zcx_peng_azoai_sdk_exception 35 | EXPORTING 36 | textid = zcx_peng_azoai_sdk_exception=>component_use_not_permitted 37 | iv_attr1 = |AI SDK|. 38 | ENDMETHOD. 39 | 40 | ENDCLASS. 41 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_ctrl_denyall.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_CTRL_DENYALL 7 | E 8 | MSPENG:AZOAISDK Central Control - Deny All Plugin 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1 7 | E 8 | MSPENG:Azure Open AI ABAP SDK 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_complet.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_COMPLET 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_config.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_CONFIG 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Config 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | _LOAD_SUPPORTED_AUTHSTRATEGIES 17 | E 18 | Load supported Auth Strategies. 19 | 20 | 21 | _LOAD_SUPPORTED_VERSIONS 22 | E 23 | Load supported versions 24 | 25 | 26 | _SET_API_BASE 27 | E 28 | Sets the API Base URL 29 | 30 | 31 | _SET_API_VERSION 32 | E 33 | Sets the API version into config object 34 | 35 | 36 | _SET_AUTHENTICATION 37 | E 38 | Sets Authentication strategy 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_deploy.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_DEPLOY 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Deployments Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_embeding.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_azoai_sdk_v1_embeding DEFINITION 2 | PUBLIC 3 | INHERITING FROM zcl_peng_azoai_sdk_embed_base 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | METHODS zif_peng_azoai_sdk_comp_embed~create REDEFINITION. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS zcl_peng_azoai_sdk_v1_embeding IMPLEMENTATION. 15 | METHOD zif_peng_azoai_sdk_comp_embed~create. 16 | ***************************************************************************************************************** 17 | * Class : ZCL_PENG_AZOAI_SDK_V1_EMBEDING 18 | * Method : zif_peng_azoai_sdk_comp_embed~create 19 | * Created by : Gopal Nair 20 | * Date : Jun 2, 2023 21 | *------------------------------------------------------------------------------------------------------------- 22 | * Description 23 | *------------------------------------------------------------------------------------------------------------- 24 | * 25 | *------------------------------------------------------------------------------------------------------------- 26 | * Modification History 27 | *------------------------------------------------------------------------------------------------------------- 28 | * Jun 2, 2023 // GONAIR // Initial Version 29 | ***************************************************************************************************************** 30 | 31 | * Check if the operation is permitted for the run profile by asking profile handler. 32 | _objconfig->get_runprofile_handler( )->zif_peng_azoai_centralcontrol~perform_operation( 33 | EXPORTING 34 | component_type = _component_type 35 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 36 | ). 37 | 38 | * Get the actual URL and HTTP communication objects from helper layer. 39 | _objsdkhelper->get_httpobjs_from_uripattern( 40 | EXPORTING 41 | uri_pattern = _objconfig->get_accesspoint_provider( )->get_urltemplate( 42 | component = _component_type 43 | operation = zif_peng_azoai_sdk_constants=>c_component_operations-create 44 | ) "{endpoint}/openai/deployments/{deployment-id}/embeddings?api-version={version}' 45 | ivobj_config = _objconfig 46 | ivt_templatecomponents = VALUE #( ( name = zif_peng_azoai_sdk_uripatterns=>template_ids-deploymentid value = deploymentid ) ) "Deployment ID. 47 | IMPORTING 48 | ov_url = DATA(actual_url) 49 | ovobj_http = DATA(lo_http) 50 | ovobj_http_rest = DATA(lo_http_rest) 51 | ). 52 | 53 | * Prepare the body and set it 54 | DATA(lo_request) = lo_http_rest->if_rest_client~create_request_entity( ). 55 | lo_request->set_content_type( iv_media_type = 'application/json' ). 56 | DATA(post_data) = to_lower( /ui2/cl_json=>serialize( data = inputs ) ) . 57 | lo_request->set_string_data( iv_data = post_data ). 58 | 59 | * Trigger the network operation. 60 | lo_http_rest->if_rest_client~post( io_entity = lo_request ). 61 | 62 | * Get Status, results and error if any from helper layer. 63 | _objsdkhelper->do_receive( 64 | EXPORTING 65 | ivobj_http_client = lo_http 66 | ivobj_http_rest = lo_http_rest 67 | IMPORTING 68 | ov_statuscode = statuscode 69 | ov_statusdescr = statusreason 70 | ov_jsonstring = json 71 | CHANGING 72 | iov_result = response 73 | iov_error = error 74 | ). 75 | 76 | 77 | ENDMETHOD. 78 | 79 | ENDCLASS. 80 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_embeding.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_EMBEDING 7 | E 8 | MSPENG:Azure OpenAI ABAP SDK Completions Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_file.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_FILE 7 | E 8 | MSPENG:Azure Open AI SDK File Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_finetune.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_FINETUNE 7 | E 8 | MSPENG:Azure Open AI SDK Fine Tune Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_azure/zpengg_ai_openai_azure_sdk/zpengg_azoai_sdk_v1/zcl_peng_azoai_sdk_v1_model.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AZOAI_SDK_V1_MODEL 7 | E 8 | MSPENG:Azure Open AI SDK Model Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MS Platform Engineering: Open AI Common Utils 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/zcl_peng_aisdk_templprov_base.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_peng_aisdk_templprov_base DEFINITION 2 | PUBLIC 3 | CREATE PUBLIC . 4 | 5 | PUBLIC SECTION. 6 | 7 | INTERFACES zif_peng_aisdk_endpt_provider . 8 | PROTECTED SECTION. 9 | DATA: 10 | _version TYPE string, 11 | _additional_init_params TYPE tihttpnvp, 12 | _t_endpoint_dictionary TYPE zif_peng_azoai_sdk_typinternal=>tty_endpoint_url_info. 13 | 14 | PRIVATE SECTION. 15 | ENDCLASS. 16 | 17 | 18 | 19 | CLASS zcl_peng_aisdk_templprov_base IMPLEMENTATION. 20 | METHOD zif_peng_aisdk_endpt_provider~get_endpoint_template. 21 | ***************************************************************************************************************** 22 | * Class : ZCL_PENG_AISDK_TEMPLPROV_BASE 23 | * Method : zif_peng_aisdk_endpt_provider~get_endpoint_template 24 | * Created by : Gopal Nair 25 | * Date : Jun 5, 2023 26 | *------------------------------------------------------------------------------------------------------------- 27 | * Description 28 | *------------------------------------------------------------------------------------------------------------- 29 | * Gets the URL end point for a specific Component/Operation 30 | * This method returns the specific end point URL for an operation on an AI engine. 31 | *------------------------------------------------------------------------------------------------------------- 32 | * Modification History 33 | *------------------------------------------------------------------------------------------------------------- 34 | * Jun 5, 2023 // GONAIR // Initial Version 35 | ***************************************************************************************************************** 36 | 37 | * Check if the component type + operation combo has an access URL available. If not, raise exception and exit. 38 | 39 | IF line_exists( _t_endpoint_dictionary[ version = _version component_type = component operation = operation ] ). 40 | endpoint_template = _t_endpoint_dictionary[ version = _version component_type = component operation = operation ]-access_url. 41 | ELSE. 42 | RAISE EXCEPTION TYPE zcx_peng_azoai_sdk_exception 43 | EXPORTING 44 | textid = zcx_peng_azoai_sdk_exception=>not_implemented. 45 | 46 | ENDIF. 47 | ENDMETHOD. 48 | 49 | METHOD zif_peng_aisdk_endpt_provider~initialize. 50 | ***************************************************************************************************************** 51 | * Class : ZCL_PENG_AISDK_TEMPLPROV_BASE 52 | * Method : zif_peng_aisdk_endpt_provider~initialize 53 | * Created by : GONAIR (Gopal Nair) 54 | * Date : Jun 5, 2023 55 | *------------------------------------------------------------------------------------------------------------- 56 | * Description 57 | *------------------------------------------------------------------------------------------------------------- 58 | * Initialize the URL provider 59 | * This method is called by AI SDK core to initialize the URL provider. It passes in a version ID. 60 | * The version may/maynot play a role in the URL end point, but its there to use. 61 | *------------------------------------------------------------------------------------------------------------- 62 | * Modification History 63 | *------------------------------------------------------------------------------------------------------------- 64 | * Jun 5, 2023 // GONAIR // Initial Version 65 | ***************************************************************************************************************** 66 | _version = api_version. 67 | _additional_init_params = additional_params. 68 | ENDMETHOD. 69 | 70 | ENDCLASS. 71 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/zcl_peng_aisdk_templprov_base.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AISDK_TEMPLPROV_BASE 7 | E 8 | MSPENG:AISDK: Base Class for Access Point URL provider 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/zcl_peng_aisdk_templprovider.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PENG_AISDK_TEMPLPROVIDER 7 | E 8 | MSPENG:AZOAISDK URL Template Provider (INTERNAL USE ONLY) 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | CONSTRUCTOR 17 | E 18 | Creates and returns an instance of URL provider 19 | 20 | 21 | GET_URLTEMPLATE 22 | E 23 | Gets the URL Template if defined 24 | 25 | 26 | 27 | 28 | CONSTRUCTOR 29 | API_TYPE 30 | E 31 | API Type 32 | 33 | 34 | CONSTRUCTOR 35 | API_VERSION 36 | E 37 | API Version 38 | 39 | 40 | GET_URLTEMPLATE 41 | ADDITIONAL_PARAMS 42 | E 43 | Additional Parameters 44 | 45 | 46 | GET_URLTEMPLATE 47 | COMPONENT 48 | E 49 | Component ID 50 | 51 | 52 | GET_URLTEMPLATE 53 | OPERATION 54 | E 55 | Operation 56 | 57 | 58 | GET_URLTEMPLATE 59 | URL_TEMPLATE 60 | E 61 | URL Template, if defined 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/zif_peng_aisdk_endpt_provider.intf.abap: -------------------------------------------------------------------------------- 1 | INTERFACE zif_peng_aisdk_endpt_provider 2 | PUBLIC . 3 | 4 | METHODS: 5 | 6 | "!

Initialize the URL provider

7 | "! Initialize the URL provider 8 | "!
9 | "! This method is called by AI SDK core to initialize the URL provider. It passes in a version 10 | "! ID. The version may/maynot play a role in the URL end point, but its there to use. 11 | "! @parameter api_version |

Version ID

12 | "! @parameter additional_params |

Any additional parameters

13 | "! @raising zcx_peng_azoai_sdk_exception |

14 | initialize 15 | IMPORTING 16 | api_version TYPE string OPTIONAL 17 | additional_params TYPE tihttpnvp OPTIONAL 18 | RAISING 19 | zcx_peng_azoai_sdk_exception, 20 | 21 | "!

Gets the URL end point for a specific Component/Operation

22 | "! This method returns the specific end point URL for an operation on an AI engine. 23 | "! @parameter component |

Component ID (eg: model,deployment...etc)

24 | "! @parameter operation |

Operation (eg: create,list..etc)

25 | "! @parameter additional_params |

Any additional parameters

26 | "! @parameter endpoint_template |

The End point URL template

27 | "! @raising zcx_peng_azoai_sdk_exception |

28 | get_endpoint_template 29 | IMPORTING 30 | component TYPE string 31 | operation TYPE string 32 | additional_params TYPE tihttpnvp OPTIONAL 33 | RETURNING 34 | VALUE(endpoint_template) TYPE string 35 | RAISING 36 | zcx_peng_azoai_sdk_exception . 37 | 38 | ENDINTERFACE. 39 | -------------------------------------------------------------------------------- /src/zpengg_ai_openai_main/zpengg_ai_openai_utils/zif_peng_aisdk_endpt_provider.intf.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIF_PENG_AISDK_ENDPT_PROVIDER 7 | E 8 | MSPENG: AISDK - Interface for Access Endpoint Provider 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | GET_ENDPOINT_TEMPLATE 16 | E 17 | Gets the URL end point for a specific Component/Operation 18 | 19 | 20 | INITIALIZE 21 | E 22 | Initialize the URL provider 23 | 24 | 25 | 26 | 27 | GET_ENDPOINT_TEMPLATE 28 | ADDITIONAL_PARAMS 29 | E 30 | Any additional parameters 31 | 32 | 33 | GET_ENDPOINT_TEMPLATE 34 | COMPONENT 35 | E 36 | Component ID (eg: model,deployment...etc) 37 | 38 | 39 | GET_ENDPOINT_TEMPLATE 40 | ENDPOINT_TEMPLATE 41 | E 42 | The End point URL template 43 | 44 | 45 | GET_ENDPOINT_TEMPLATE 46 | OPERATION 47 | E 48 | Operation (eg: create,list..etc) 49 | 50 | 51 | INITIALIZE 52 | ADDITIONAL_PARAMS 53 | E 54 | Any additional parameters 55 | 56 | 57 | INITIALIZE 58 | API_VERSION 59 | E 60 | Version ID 61 | 62 | 63 | 64 | 65 | 66 | --------------------------------------------------------------------------------