docs: add Hy3 API quickstart guide and 6 standalone examples (#rhinobird2026) - #203
Open
wonder37-debug wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds bilingual Hy3 OpenAI-compatible API quickstart documentation plus 6 runnable Python examples to help users validate local deployments (vLLM/SGLang) and learn common patterns (streaming, tool calling, retries, reasoning mode).
Changes:
- Added English/Chinese Quickstart guides covering endpoint basics, parameters, and troubleshooting.
- Added 6 standalone
openai-SDK Python scripts demonstrating chat, streaming, latency measurement, tool-calling loops, reasoning mode, and retry/backoff handling. - Included minimal vLLM deployment snippet for local serving.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| quickstart.md | English Hy3 API quickstart guide and troubleshooting. |
| quickstart_CN.md | Chinese Hy3 API quickstart guide and troubleshooting. |
| examples/basic_chat.py | Basic single-turn and multi-turn chat usage. |
| examples/streaming.py | Streaming chunk parsing example. |
| examples/latency_compare.py | Streaming vs non-streaming latency comparison script. |
| examples/tool_calling.py | Tool/function calling definition and multi-turn tool loop. |
| examples/reasoning_mode.py | Reasoning mode (reasoning_effort) usage and output parsing. |
| examples/error_handling_retry.py | Retry/backoff example for 429/timeout/network failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+62
| total += delta.content | ||
| elapsed = time.perf_counter() - t0 | ||
| print(f"[streaming] first_token={ttft:.3f}s, total={elapsed:.3f}s, " | ||
| f"chars={len(total)}") | ||
| return ttft, elapsed |
| return msg.content | ||
|
|
||
| # echo the assistant message (must keep tool_calls) then run each tool | ||
| messages.append(msg) # OpenAI SDK message object is JSON-serializable |
Comment on lines
+49
to
+51
| ra = resp.headers.get("Retry-After") | ||
| if ra and ra.isdigit(): | ||
| retry_after = float(ra) |
Comment on lines
+42
to
+47
| usage = response.usage # prompt_tokens / completion_tokens / total_tokens | ||
|
|
||
| print("=== Single-turn ===") | ||
| print(answer) | ||
| print(f"[finish_reason={finish_reason}] " | ||
| f"[usage: prompt={usage.prompt_tokens}, completion={usage.completion_tokens}]") |
Comment on lines
+67
to
+69
| | `reasoning_effort` | string | `high` | Thinking-mode switch: `no_think` (fast), `low`, `high` (deep chain-of-thought) | | ||
|
|
||
| Thinking mode: `reasoning_effort` accepts `no_think`, `low`, or `high`. The model defaults to slow thinking (`high`); set it to `no_think` explicitly for direct responses. The parameter is passed via `chat_template_kwargs` (use `extra_body` with the Python SDK). When enabled, the chain-of-thought is returned in the `reasoning_content` field. |
Comment on lines
+67
to
+69
| | `reasoning_effort` | string | `high` | 思考模式开关:`no_think`(快思考)、`low`、`high`(深度思维链) | | ||
|
|
||
| 思考模式:`reasoning_effort` 可选 `no_think`、`low`、`high`。模型默认以慢思考(`high`)输出;如需直接回复,请显式设为 `no_think`。该参数通过 `chat_template_kwargs` 透传(Python SDK 使用 `extra_body`)。开启后思维链内容以 `reasoning_content` 字段返回。 |
Comment on lines
+9
to
+10
| The model defaults to slow thinking (high). When thinking is enabled, the | ||
| chain-of-thought is returned in `reasoning_content` (separate from `content`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
新增 Hy3 API Quickstart 双语文档及 6 个独立可运行的 Python 示例代码(针对
#rhinobird2026分支)。主要变更
quickstart.md/quickstart_CN.md:中英双语指南,包含基础配置、参数说明、思考模式配置及常见报错排查。examples/):basic_chat.py:单轮与多轮对话管理。streaming.py:流式响应逐 Chunk 实时解析。latency_compare.py:非流式与流式耗时对比(含 TTFT 首 Token 时延分析)。tool_calling.py:Function Calling 定义与多轮工具循环处理。reasoning_mode.py:思考模式开关(reasoning_effort)与思维链(reasoning_content)解析。error_handling_retry.py:针对 429 限流、超时和网络错误的指数退避重试。