LSPlatform
  1. 提示工程模板
LSPlatform
  • 【在线调试-使用说明】
  • 大模型接口
    • 标准API
      • 模型对话调用(Completions)
      • 向量计算调用(Embedding)
      • 决策调用(Makes)
    • 提示工程模板
      • Prompt渲染
        POST
    • 知识库
      • 创建知识库
      • 添加文档
      • 文档分片预览
      • 知识库问答对话
      • 获取知识库列表
      • 获取文档列表
      • 获取文档详情
      • 删除文档
      • 删除知识库
  • TTS合成
    • 合成TTS初始化
      POST
    • 流式推送tts文本
      PUT
  1. 提示工程模板

Prompt渲染

POST
/v1/prompt-template/{{api_id}}/render
模板id获取方式:在提示工程模块点击对应的模板,点击复制模板ID
image.png
该API为纯渲染API,后续请求需要将prompt字段的内容进行后续的大模型基础接口调用

request#

response#

示例Sample#

我们以应用部署与分享的Sample为例,将项目中的Prompt模板进行替换,并通过调用提示工程模板的ID进行实时更新。
下载地址(基于nodejs):prompt_template_v1.zip

核心代码示例#

image.png

请求参数

Header 参数
Authorization
string 
可选
示例值:
Bearer {{token}}
Content-Type
string 
可选
示例值:
application/json
Body 参数application/json
title
string 
模版标题
必需
arg
string 
模版参数测试
必需
示例
{
  "title": "模版标题",
  "arg": "模版参数测试"
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'https://api.listenai.com/v1/prompt-template/{{api_id}}/render' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "模版标题",
  "arg": "模版参数测试"
}'

返回响应

🟢200成功
application/json
Body
template_id
integer 
必需
prompt
string 
必需
示例
{
  "template_id": 1,
  "prompt": "this is a template prompt 模版标题, use this argument 模版参数测试 for render"
}
修改于 2023-09-05 11:46:38
上一页
决策调用(Makes)
下一页
创建知识库
Built with