OpenAI 学习路线
OpenAI的GPT系列是最广泛使用的AI模型,本文汇总完整的学习资料。
官方文档
1. 核心文档
2. 指南与教程
API 开发
Python SDK
# 安装
pip install openai
# 基础使用
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
高级功能
# Streaming 流式输出
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content, end="")
Prompt Engineering
- 官方 Prompt Engineering 指南
- OpenAI Cookbook - 实用示例集合
技巧总结
- 使用清晰的指令
- 提供示例(Few-shot)
- 使用分隔符明确输入
- 指定输出格式
- 使用思维链(Chain of Thought)
专项功能学习
Assistants API
- Assistants 概述
- Code Interpreter
- File Search
- Function Calling
Fine-tuning 微调
- Fine-tuning 指南
- 数据准备
- 训练监控
- 模型评估
暂无评论。成为第一个评论的人吧!