笔者之前的著作中文字幕 在线av,如故耀眼先容了 DeepSeek 的 API 调用面孔:
在腾讯 HAI 上使用 DeepSeek + RAG 结束 SAP 私东说念主常识库
porn丝袜免费使用 DeepSeek R1 满血版不卡顿,相沿个东说念主常识库
DeepSeek API 的调用行径
之前如故先容过 ABAP 里一些开箱即用的调用 ChatGPT API 的器用和 SDK:
使用 ChatGPT Canvas 援助 ABAP 斥地
在 SAPGUI 里同 ChatGPT 进行聊天
ChatGPT Store 上和 ABAP 相关的那些定制化 GPT 到底好不好用?中文字幕 在线av
同理,在 ABAP 里通过代码的面孔,调用 DeepSeek 的 API 也相等容易。
在 DeepSeek API 适度台上,能看到针对 curl 和其他编程话语调用的示例代码。
把 curl 的代码粘贴下来,径直扔给 ChatGPT,让它翻译成对应的 ABAP 代码。
图片
领导:
请你饰演一个资深的 ABAP 斥地东说念主员,请你把底下这段 curl 蹂躏 API 的操作,翻译成省略开动的 ABAP 代码。
别传 ChatGPT 5 也快出了。现在 o3-mini-high, 应该是手头能用的最强的代码编写器用了吧。
图片
尽然 ChatGPT 生成的代码质地相等高,径直激活通过,一次见效。我只需要把代码里的 <token> 占位符,替换成我方的 API key 就能开动了。
将代码中要问 DeepSeek 的问题,硬编码成 "What is ABAP?".
另存为一个 ABAP 报表,径直开动, 收到 DeepSeek API 的调用效果。
图片
完好的 ABAP 代码如下中文字幕 在线av,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.本站仅提供存储处事,统共骨子均由用户发布,如发现存害或侵权骨子,请点击举报。