面试题库
共 328 题,当前筛选 1 题。
课程全部30 天从前端工程师到 Agent 工程师5 天提示词工程零基础Claude 高效使用:从对话到 Claude CodeCodex 与 OpenAI Agents SDK 高效使用7 天 MCP:把工具接进任何 Agent7 天 Agent Skills:把经验做成可复用能力5 天上下文工程14 天 RAG:从检索到可信回答14 天用 Agent 搭一条 AI 短剧生产线
Codex 与 OpenAI Agents SDK 高效使用
D3 Responses API 与内置工具:函数调用、web search / file search / computer use、结构化输出
Responses API 和 Chat Completions 的区别是什么?从 Chat Completions 迁移过去最容易踩什么坑?How does the Responses API differ from Chat Completions, and what are the common pitfalls when migrating?
国内高频海外高频基础#responses-api#openai#migration分析过程 · 先想清楚再作答
- 这题考的是你有没有真迁移过,而不是能不能背出字段名。只答「新接口更强」会被判为看过文档没写过代码。
- 拆成三个维度:输入形态(messages 数组变成 input 加顶层 instructions)、输出形态(choices 变成按类型排列的 output items,SDK 给 output_text 助手)、状态管理(无状态变成默认 store 加 previous_response_id)。
- 再说为什么要改:聊天记录模型装不下工具动作;items 让搜索、函数调用、回填各有自己的类型,这是内置工具能接进来的前提。
- 迁移坑给三条:默认 store 为 true 意味着数据会被存下来,合规场景要显式关掉;output 是数组不是单个消息,取文本要用 output_text 或遍历 message item;函数调用的回填从 role 为 tool 的消息变成 function_call_output item,call_id 要对上。
- 可预期的追问:previous_response_id 和自己维护历史怎么选?原型用前者省事,生产多半自己落一份历史做审计与恢复,或两者混用。
How to reason about it · think before answering
- This tests whether you have actually migrated code, not whether you can recite field names.
- Split into three axes: input shape (messages array becomes input plus top-level instructions), output shape (choices becomes typed output items with an output_text helper), and state (stateless becomes store by default plus previous_response_id).
- Explain the motivation: a chat-transcript model cannot hold tool actions; items give search, function calls and their outputs distinct types, which is what makes built-in tools possible.
- Name three pitfalls: store defaults to true so compliance-sensitive apps must disable it; output is an array, so read output_text or walk message items; tool results move from role tool messages to function_call_output items keyed by call_id.
- Expect the follow-up: previous_response_id versus self-managed history? Prototypes take the former; production usually keeps its own history for audit and recovery, or mixes both.
答题要点
- 输入:messages 变 input 加顶层 instructions;输出:choices 变按类型排列的 output items 与 output_text
- 状态:默认 store 为 true,用 previous_response_id 接上一轮,不再每轮重发历史
- 改的动机是给工具动作独立的 item 类型,内置工具由此接入
- 迁移坑:store 默认开、output 是数组、回填要用 function_call_output 且 call_id 对上
Key points
- Input: messages become input plus top-level instructions; output: choices become typed output items plus output_text
- State: store defaults to true and previous_response_id chains turns without resending history
- The motivation is distinct item types for tool actions, enabling built-in tools
- Pitfalls: store on by default, output is an array, tool results go back as function_call_output keyed by call_id