• 裸舞 合集 1 分钟极速接入:ABAP 系统若何调用 DeepSeek

  • 发布日期:2025-07-05 11:14    点击次数:65

    裸舞 合集 1 分钟极速接入:ABAP 系统若何调用 DeepSeek

    笔者之前的著述裸舞 合集,还是详备先容了 DeepSeek 的 API 调用步地:

    在腾讯 HAI 上使用 DeepSeek + RAG 罢了 SAP 私东说念主常识库

    免费使用 DeepSeek R1 满血版不卡顿,因循个东说念主常识库

    DeepSeek API 的调用门径

    之前还是先容过 ABAP 里一些开箱即用的调用 ChatGPT API 的器具和 SDK:

    使用 ChatGPT Canvas 缓助 ABAP 建树

    在 SAPGUI 里同 ChatGPT 进行聊天

    ChatGPT Store 上和 ABAP 联系的那些定制化 GPT 到底好不好用?裸舞 合集

    同理,在 ABAP 里通过代码的步地,调用 DeepSeek 的 API 也尽头容易。

    在 DeepSeek API 拆除台上,能看到针对 curl 和其他编程说话调用的示例代码。

    vpswindows在线播放

    把 curl 的代码粘贴下来,径直扔给 ChatGPT,让它翻译成对应的 ABAP 代码。

    图片

    教唆:

    请你演出一个资深的 ABAP 建树东说念主员,请你把底下这段 curl 忽地 API 的操作,翻译成大概驱动的 ABAP 代码。

    传闻 ChatGPT 5 也快出了。当今 o3-mini-high, 应该是手头能用的最强的代码编写器具了吧。

    图片

    确实 ChatGPT 生成的代码质地尽头高,另类视频区第1页径直激活通过,一次成效。我只需要把代码里的 <token> 占位符,替换成我方的 API key 就能驱动了。

    将代码中要问 DeepSeek 的问题,硬编码成 "What is ABAP?".

    另存为一个 ABAP 报表,径直驱动, 收到 DeepSeek API 的调用效力。

    图片

    完好的 ABAP 代码如下裸舞 合集,100% 由 ChatGPT 生成:

    REPORT z.DATA: lo_http_client TYPE REF TO if_http_client,      lv_url         TYPE string VALUE 'https://api.siliconflow.cn/v1/chat/completions',      lv_token       TYPE string VALUE '<此处替换成你我方的 API key>',      lv_json_payload TYPE string,      lv_response    TYPE string.lv_json_payload = `{` &&  `"model": "deepseek-ai/DeepSeek-V3",` &&  `"messages": [` &&     `{` &&      `"role": "user",` &&      `"content": "What is ABAP?"` &&    `}` &&  `],` &&  `"stream": false,` &&  `"max_tokens": 512,` &&  `"stop": [` &&    `"null"` &&  `],` &&  `"temperature": 0.7,` &&  `"top_p": 0.7,` &&  `"top_k": 50,` &&  `"frequency_penalty": 0.5,` &&  `"n": 1,` &&  `"response_format": {` &&    `"type": "text"` &&  `},` &&  `"tools": [` &&    `{` &&      `"type": "function",` &&      `"function": {` &&        `"description": "<string>",` &&        `"name": "<string>",` &&        `"parameters": {},` &&        `"strict": false` &&      `}` &&    `}` &&  `]` &&`}`.TRY.    cl_http_client=>create_by_url(      EXPORTING        url    = lv_url        ssl_id = 'ANONYM'      IMPORTING        client = lo_http_client    ).    lo_http_client->request->set_method( if_http_request=>co_request_method_post ).    lo_http_client->request->set_header_field(      name  = 'Authorization'      value = |Bearer { lv_token }|    ).    lo_http_client->request->set_header_field(      name  = 'Content-Type'      value = 'application/json'    ).    lo_http_client->request->set_cdata( lv_json_payload ).    lo_http_client->send( ).    lo_http_client->receive( ).    lv_response = lo_http_client->response->get_cdata( ).    WRITE: / 'Response:', lv_response.  CATCH cx_root INTO DATA(lx_root).    WRITE: / 'Error:', lx_root->get_text( ).ENDTRY.
    本站仅提供存储工作,总共实质均由用户发布,如发现存害或侵权实质,请点击举报。