OpenAI 提示工程:优化 LLM 结果 - Openclaw Skills

作者:互联网

2026-04-16

AI教程

什么是 OpenAI 提示工程策略?

此技能提供了一个结构化框架,利用提示工程策略通过 OpenAI API 增强大型语言模型的输出。它涵盖了生成精准文本、复杂代码、数学解决方案和结构化 JSON 数据的基本技术。通过将其集成到 Openclaw Skills 中,开发人员可以自动化并改进与模型的交互方式,确保更高质量且更一致的 AI 响应。

该技能专注于将原始输入转化为高度优化的指令,从而最大限度地减少幻觉并提高相关性。它充当了技术文档与实际执行之间的桥梁,允许开发人员直接在代理工作流中实现高级提示模式。

下载入口:https://github.com/openclaw/skills/tree/main/skills/hhhh124hhhh/prompt-engineering-openai-api-f7c24501

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install prompt-engineering-openai-api-f7c24501

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 prompt-engineering-openai-api-f7c24501。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

OpenAI 提示工程策略 应用场景

  • 为自动化内容创作生成高质量的类人散文。
  • 为系统集成自动创建有效的结构化 JSON 数据。
  • 使用特定的 LLM 指令编写和调试复杂代码片段。
  • 通过思维链提示增强数学和逻辑推理任务的准确性。
  • 开发需要细致且具备上下文意识指令的高级 AI 代理。
OpenAI 提示工程策略 工作原理
  1. 定义特定任务或目标(例如:文本生成、数据提取或代码合成)。
  2. 在 Openclaw 环境中选择适当的 OpenAI 模型标识符。
  3. 基于经过验证的工程策略(如提供清晰指令或参考文本)制定提示词。
  4. 使用集成的 Javascript 或 Python 样板代码向 OpenAI Responses API 发送结构化请求。
  5. 获取并处理模型的 output_text 以供下游应用使用。

OpenAI 提示工程策略 配置指南

要使用此技能,请确保您拥有有效的 OpenAI 账号和 API 密钥。使用以下命令安装所需的客户端库:

npm install openai
# 或
pip install openai

设置环境变量以验证您的请求:

export OPENAI_API_KEY='your-api-key-here'

OpenAI 提示工程策略 数据架构与分类体系

该技能通过结构化架构管理交互数据,以确保元数据持久化和质量追踪:

字段 类型 描述
model string 特定的 OpenAI 模型标识符(例如 gpt-4o)。
input string 提供给模型经过设计的提示词或指令集。
output_text string 由 LLM 生成的结果文本或数据。
quality_score number 基于 Clawdbot 元数据分析的推断评分。
source_url string 该策略的原始文档引用。
name: prompt-engineering-openai-api-f7c24501
description: Log in [Sign up](https://platform.openai.com/signup)

# Prompt engineering

Enhance results with prompt engineering strategies.

Copy page

With the OpenAI API, you can use a [large language model](https://platform.openai.com/docs/models) to generate text from a prompt, as you might using [ChatGPT](https://chatgpt.com/). Models can generate almost any kind of text response—like code, mathematical equations, structured JSON data, or human-like prose.

Here's a simple example using the [Responses ...
metadata: {"clawdbot": {"type": "text prompt", "inferred_type": "Text Prompt", "source": "firecrawl", "original_url": "https://platform.openai.com/docs/guides/prompt-engineering", "quality_score": 0}}

Prompt engineering | OpenAI API

描述

Log in Sign up

Prompt engineering

Enhance results with prompt engineering strategies.

Copy page

With the OpenAI API, you can use a large language model to generate text from a prompt, as you might using ChatGPT. Models can generate almost any kind of text response—like code, mathematical equations, structured JSON data, or human-like prose.

Here's a simple example using the [Responses ...

来源

  • 平台: firecrawl
  • 原始链接: https://platform.openai.com/docs/guides/prompt-engineering
  • 类型: Text Prompt
  • 质量分数: 0

Prompt

Log in [Sign up](https://platform.openai.com/signup)

# Prompt engineering

Enhance results with prompt engineering strategies.

Copy page

With the OpenAI API, you can use a [large language model](https://platform.openai.com/docs/models) to generate text from a prompt, as you might using [ChatGPT](https://chatgpt.com/). Models can generate almost any kind of text response—like code, mathematical equations, structured JSON data, or human-like prose.

Here's a simple example using the [Responses API](https://platform.openai.com/docs/api-reference/responses).

Generate text from a simple prompt

javascript

1 2 3 4 5 6 7 8 9 import OpenAI from "openai"; const client = new OpenAI();

const response = await client.responses.create({ model: "gpt-5.2", input: "Write a one-sentence bedtime story about a unicorn." });

console.log(response.output_text);


1 2 3 4 5 6 7 8 9 from openai import OpenAI client = OpenAI()

response = client.responses.create( model="gpt-5.2", ...


---

## 标签
- AI
- Text Prompt
- prompt
- 生成
- clawdbot

---

*Skill generated by Clawdbot*

相关推荐