了解大语言模型 API 的基础知识,包括架构模式、认证方式、请求响应格式等核心概念
{ "model": "gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello, how are you?"} ], "temperature": 0.7, "max_tokens": 1000, "response_format": { "type": "json_schema", "json_schema": { "name": "response", "schema": { "type": "object", "properties": { "answer": {"type": "string"}, "confidence": {"type": "number"} } } } } }
{ "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-4o-mini", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "{\"answer\": \"I'm doing well, thank you!\", \"confidence\": 0.95}" }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 20, "completion_tokens": 15, "total_tokens": 35 } }