Skip to content

Commit 906686b

Browse files
committed
docs(kitex): add link to Kitex v0.13.1 release notes
docs: create generic streaming documentation in Chinese version (#1326) docs: 明确NewOpenTelemetryProvider的重复调用规范(关联Issue #1327) (#1328) 修复milvus的indexer文档,缺乏”document配置必须搭配fields配置“这一信息,导致容易误用问题 (#1331) chore: upgrade typos (#1332) feat: update merge register & with eager execution (#1333) chore: update getting-started docs (#1334) feat: update host multi-agent docs (#1335) docs: add doc for hertz v0.10.0 (#1337) Co-authored-by: Kyle Xiao <xiaoguoqiao@bytedance.com> fix(eino): remove error prompt directory (#1338) docs(kitex): improve transport protocol documentation with clearer explanations docs: improve transport protocol documentation to clarify Kitex's support for Thrift and Protobuf with gRPC transport
1 parent 7192e0d commit 906686b

File tree

58 files changed

+769
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+769
-89
lines changed

.github/workflows/push-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- uses: actions/checkout@v4
1010

1111
- name: typos-action
12-
uses: crate-ci/typos@v1.14.3
12+
uses: crate-ci/typos@v1.32.0

_typos.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
[files]
44
extend-exclude = ["*.json", "*.js", "static/*", "layouts/*", "assets/*", "i18n/*"]
55

6+
[default]
7+
extend-ignore-re = [
8+
"mmaping files"
9+
]
10+
611
[default.extend-words]
712
datas = "datas"
813
mmaped = "mmaped"
914
exten = "exten"
10-
invokable = "invokable"
15+
invokable = "invokable"
16+
typ = "typ"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "Hertz Release v0.10.0"
3+
linkTitle: "Release v0.10.0"
4+
projects: ["Hertz"]
5+
date: 2025-05-21
6+
description: >
7+
---
8+
9+
The Hertz v0.10.0 release adds two features and some fixes.
10+
11+
1. Integrate SSE functionality. Refer to [SSE](/docs/hertz/tutorials/basic-feature/sse) for usage.
12+
2. Added http.Handler adaptor, extending Hertz using the official net/http ecosystem. Refer to [Adaptor](/docs/hertz/tutorials/basic-feature/http-adaptor) for usage.
13+
14+
## Feature
15+
1. [[#1327](https://github.com/cloudwego/hertz/pull/1327)] feat(adaptor): new HertzHandler for http.Handler
16+
2. [[#1349](https://github.com/cloudwego/hertz/pull/1349)] feat(sse): SetLastEventID
17+
3. [[#1343](https://github.com/cloudwego/hertz/pull/1343)] feat(sse): reader supports cancel stream
18+
4. [[#1341](https://github.com/cloudwego/hertz/pull/1341)] feat(server): detect request race
19+
5. [[#1339](https://github.com/cloudwego/hertz/pull/1339)] feat(sse): add LastEventID helpers
20+
6. [[#1335](https://github.com/cloudwego/hertz/pull/1335)] feat(protocol): new sse pkg
21+
7. [[#1322](https://github.com/cloudwego/hertz/pull/1322)] feat: std transport sense client connection close
22+
23+
## Fix
24+
1. [[#1340](https://github.com/cloudwego/hertz/pull/1340)] fix: only use netpoll & sonic on amd64/arm64 linux/darwin
25+
2. [[#1333](https://github.com/cloudwego/hertz/pull/1333)] fix(protocol): unexpected set resp.bodyStream
26+
3. [[#1329](https://github.com/cloudwego/hertz/pull/1329)] fix(client): stream body for sse instead of timeout
27+
4. [[#1332](https://github.com/cloudwego/hertz/pull/1332)] fix(server): Shutdown checks ExitWaitTimeout
28+
5. [[#1316](https://github.com/cloudwego/hertz/pull/1316)] fix: prioritize custom validator
29+
30+
## Tests
31+
1. [[#1336](https://github.com/cloudwego/hertz/pull/1336)] test(protocol): fix hardcoded listen addr
32+
33+
## Chore
34+
1. [[#1353](https://github.com/cloudwego/hertz/pull/1353)] chore: update netpoll dependency
35+
2. [[#1337](https://github.com/cloudwego/hertz/pull/1337)] chore(hz): update hz tool v0.9.7
36+
3. [[#1328](https://github.com/cloudwego/hertz/pull/1328)] ci: disable codecov annotations

content/en/blog/releases/Kitex/release-v043.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ description: >
1818
### **Optimization**
1919

2020
1. **Frugal Performance Optimization** : Support frugal precompile (pretouch) when new client or server, which is to reduce the impact of dynamic compilation on latency.
21-
2. **Connpool Optimiztion** : Refactor connection pool to improve the idle connections cleanup.
21+
2. **Connpool Optimization** : Refactor connection pool to improve the idle connections cleanup.
2222

2323
---
2424

content/en/blog/releases/Kitex/release-v0_13_0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ description: >
9393

9494
[[#1725](https://github.com/cloudwego/kitex/pull/1725)] fix: code gen import issue for streamx mode, stream call judgement bug and set ttheader streaming as default
9595

96-
[[#1727](https://github.com/cloudwego/kitex/pull/1727)] fix(tool): fix tool UseStdLib remains unexcepted lib issue
96+
[[#1727](https://github.com/cloudwego/kitex/pull/1727)] fix(tool): fix tool UseStdLib remains unexpected lib issue
9797

9898
### Refactor
9999
[[#1658](https://github.com/cloudwego/kitex/pull/1658)] refactor: streamx api to adapt both grpc and ttheader streaming protocol and provide more user-friendly interface

content/en/cooperation/shumei.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Kitex 提供了一个很好的机制,叫**重试熔断**的机制,其中有
250250

251251
**Thrift** **(C++)/ Fbthrift 服务的过载保护**
252252

253-
> 基础服务层大多是计算密集型服务,CPU 利用率等不完全反应程序的负载,服务过载可能是 GPU 负载过高。 使用请求在队列中的平均等待时间(“queue time”)来计算服务的负载。之所以不选择请求的平均处理时间(“procss time”),是为了去除下游服务调用的影响。有时 process time 的增加并不代表当前服务过载了,而是请求依赖的下游服务过载。另一方面,请求的 process time 增加到一定程度,当前服务的资源也会逐渐耗尽,最终反应在 queue time 的增加上。
253+
> 基础服务层大多是计算密集型服务,CPU 利用率等不完全反应程序的负载,服务过载可能是 GPU 负载过高。 使用请求在队列中的平均等待时间(“queue time”)来计算服务的负载。之所以不选择请求的平均处理时间(“process time”),是为了去除下游服务调用的影响。有时 process time 的增加并不代表当前服务过载了,而是请求依赖的下游服务过载。另一方面,请求的 process time 增加到一定程度,当前服务的资源也会逐渐耗尽,最终反应在 queue time 的增加上。
254254
255255
我们可以看下图,当我们整个 CPU 或者是 GPU 整体的负载较高的时候,它的排队时间就会去无限长。所以这里给我们一种启发的机制,也就是说我们设置一个最长的队列等待时间。因为刚才也说了,在整个微服务的框架下,我们一定要干的一件事情就是一定要有超时的机制,因为没有超时的机制最终可能导致整个系统都被焊住。所以我们这里针对于这个 Queue Time 设置一个 Timeout 的话,那就可以去保证我们这些计算密集能服务在它的排队时间,等到一定时间的时候我们就立即丢弃请求。
256256

content/en/docs/eino/core_modules/chain_and_graph_orchestration/orchestration_design_principles.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ graph.AddLambdaNode("your_node_key", compose.InvokableLambda(func(ctx context.Co
359359
}), compose.WithOutputKey("your_output_key"))
360360
```
361361

362+
You can also register custom merge method to support any type:
363+
364+
```go
365+
// eino/compose/values_merge.go
366+
func RegisterValuesMergeFunc[T any](fn func([]T) (T, error))
367+
```
368+
362369
Workflow can map the output fields of multiple predecessor nodes to different input fields of the successor node. Eino converts the Struct output from each predecessor to a Map before any merge process, still conforming to the above rules.
363370

364371
### **Streaming Processing**
@@ -464,4 +471,9 @@ When `NodeTriggerMode == AllPredecessor`, the graph executes using the dag engin
464471
- Support Branch. At runtime, mark the unselected nodes of Branch as skipped, which does not affect the semantics of AllPredecessor.
465472
- No need for manual SuperStep alignment.
466473

474+
> 💡
475+
> When NodeTriggerMode is set to AllPredecessor, the node will execute after all predecessors are ready, but it will not execute immediately. Instead, it still follows the SuperStep - running new runnable nodes after a batch of nodes have completed execution.
476+
>
477+
> If compose.WithEagerExecution() is passed in Compile, the ready nodes will run immediately.
478+
467479
In summary, the pregel mode is flexible and powerful but comes with additional mental overhead, while the dag mode is clear and simple but limited in application scenarios. In the Eino framework, Chain uses the pregel mode, Workflow uses the dag mode, and Graph supports both; users can choose between pregel and dag.

content/en/docs/eino/core_modules/flow_integration_components/multi_agent_hosting.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,77 @@ HandOff to answer_with_journal with argument {"reason":"To find out the user's m
343343
Answer:
344344
You got up at 7:00 in the morning.
345345
```
346+
347+
## FAQ
348+
349+
### Host direct answer does not have streaming effect
350+
351+
Host Multi-Agent provides a configuration for `StreamToolCallChecker` to determine whether the Host outputs directly.
352+
353+
Different models may output tool calls in different ways in streaming mode: some models (e.g., OpenAI) output tool calls directly; some models (e.g., Claude) output text first and then output tool calls. Therefore, different methods are needed for the determination. This field is used to specify a function for determining whether the model's streaming output contains tool calls.
354+
355+
It is optional. If not filled, the determination of whether the "non-empty package" contains tool calls is used:
356+
357+
```go
358+
func firstChunkStreamToolCallChecker(_ context.Context, sr *schema.StreamReader[*schema.Message]) (bool, error) {
359+
defer sr.Close()
360+
361+
for {
362+
msg, err := sr.Recv()
363+
if err == io.EOF {
364+
return false, nil
365+
}
366+
if err != nil {
367+
return false, err
368+
}
369+
370+
if len(msg.ToolCalls) > 0 {
371+
return true, nil
372+
}
373+
374+
if len(msg.Content) == 0 { // skip empty chunks at the front
375+
continue
376+
}
377+
378+
return false, nil
379+
}
380+
}
381+
```
382+
383+
The above default implementation is applicable when the Tool Call Message output by the model contains only Tool Calls.
384+
385+
The default implementation is not applicable when there is a non-empty content chunk before outputting the Tool Call. In this case, a custom tool call checker is required as follows:
386+
387+
```go
388+
toolCallChecker := func(ctx context.Context, sr *schema.StreamReader[*schema.Message]) (bool, error) {
389+
defer sr.Close()
390+
for {
391+
msg, err := sr.Recv()
392+
if err != nil {
393+
if errors.Is(err, io.EOF) {
394+
// finish
395+
break
396+
}
397+
398+
return false, err
399+
}
400+
401+
if len(msg.ToolCalls) > 0 {
402+
return true, nil
403+
}
404+
}
405+
return false, nil
406+
}
407+
```
408+
409+
This custom `StreamToolCallChecker` may need to check **all packages** for the presence of ToolCalls in extreme cases, resulting in the loss of the "streaming judgment" effect. If you want to maintain the "streaming judgment" effect as much as possible, the suggested solution is:
410+
411+
Try to add a prompt to constrain the model not to output additional text when making tool calls, for example: "If you need to call a tool, output the tool directly without outputting text."
412+
413+
Different models may be affected by the prompt differently. You need to adjust the prompt and verify the effect in actual use.
414+
415+
### Host picks multiple Specialists simultaneously
416+
417+
The Host provides the selection of Specialists in the form of Tool Calls, so it may select multiple Specialists simultaneously in the form of a Tool Call list. At this time, the Host Multi-Agent will route the request to these multiple Specialists at the same time. After the multiple Specialists complete their tasks, the Summarizer node will summarize multiple Messages into one Message as the final output of the Host Multi-Agent.
418+
419+
Users can customize the behavior of the Summarizer by configuring the Summarizer, specifying a ChatModel and a SystemPrompt. If not specified, the Host Multi-Agent will concatenate the output Message Contents of multiple Specialists and return the result.

content/en/docs/eino/ecosystem_integration/indexer/indexer_milvus.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ type IndexerConfig struct {
116116
// Default Collection config
117117
// Collection is the collection name in milvus database
118118
// Optional, and the default value is "eino_collection"
119+
// If you want to use this configuration, you must include the Fields configuration
119120
Collection string
120121
// Description is the description for collection
121122
// Optional, and the default value is "the collection for eino"

content/en/docs/eino/ecosystem_integration/prompt/prompt_mcp.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

content/en/docs/eino/quick_start/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ In this example, we will use a react agent to build an agent that can interact w
4545

4646
- Understand the core modules and concepts of Eino: [Eino: Core Modules](/docs/eino/core_modules), which is crucial information for mastering the use of Eino for application development.
4747
- Eino maintains an open ecosystem stance and provides a large number of ecosystem integration components: [Eino: ecosystem](/docs/eino/ecosystem). You can use these components to quickly build your own business applications.
48+
49+
50+
If you find this project is good and helpful, please give [Eino](https://github.com/cloudwego/eino) a star! Your support will be our greatest encouragement!
51+
If you have any questions or suggestions, feel free to leave a message in [GitHub Issues](https://github.com/cloudwego/eino/issues).

content/en/docs/hertz/getting-started/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,6 @@ hz update -idl hello.thrift
186186
## More examples
187187

188188
Please refer:[Example code](/docs/hertz/tutorials/example/)
189+
190+
If you think this project is good and helpful, please give [Hertz](https://github.com/cloudwego/hertz) a star! This will be the greatest encouragement and support for us!
191+
If you have any questions or suggestions, feel free to leave a message in [GitHub Issues](https://github.com/cloudwego/hertz/issues) according to the issue template.

content/en/docs/hertz/tutorials/basic-feature/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ keywords:
2323
"Constants",
2424
"Render",
2525
"JSON Marshal Library",
26+
"SSE",
27+
"http.Handler adaptor",
2628
]
2729
description: "Basic feature of Hertz."
2830
---

content/en/docs/hertz/tutorials/basic-feature/context/response.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ Use RequestContext.Response.Header to obtain the ResponseHeader object, this obj
375375
| `func (h *ResponseHeader) DelClientCookieBytes(key []byte)` | Remove the cookie from the client |
376376
| `func (h *ResponseHeader) SetConnectionClose(close bool)` | Set the `Connection: close` flag in the response header |
377377
| `func (h *ResponseHeader) ConnectionClose() bool` | Determine if Connection: close is included |
378-
| `func (h *ResponseHeader) ContentEncoding() []byte` | Obtion Content-Encoding |
378+
| `func (h *ResponseHeader) ContentEncoding() []byte` | Option Content-Encoding |
379379
| `func (h *ResponseHeader) SetContentEncoding(contentEncoding string)` | Set Content-Encoding |
380380
| `func (h *ResponseHeader) SetContentEncodingBytes(contentEncoding []byte)` | Set Content-Encoding |
381381
| `func (h *ResponseHeader) SetCanonical(key, value []byte)` | Set the Header key value, assuming that the key is in canonical form |
382382
| `func (h *ResponseHeader) Server() []byte` | Return the value with key `Server` in the header |
383383
| `func (h *ResponseHeader) SetServerBytes(server []byte)` | Set the key in the header to the value of Server |
384384
| `func (h *ResponseHeader) MustSkipContentLength() bool` | Determine if there is a response body (according to the HTTP/1.1 protocol, there is no response body when the response status codes are 1xx, 204, or 304) |
385-
| `func (h *ResponseHeader) StatusCode() int` | Obtion StatusCode |
385+
| `func (h *ResponseHeader) StatusCode() int` | Option StatusCode |
386386
| `func (h *ResponseHeader) SetStatusCode(statusCode int)` | Set StatusCode |
387387
| `func (h *ResponseHeader) Len() int` | Return the number of headers |
388388
| `func (h *ResponseHeader) DisableNormalizing()` | Disable the normalization of header name (capitalize the first letter and the first letter after the Em dash) |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "http.Handler adaptor"
3+
date: 2025-05-21
4+
weight: 20
5+
keywords: ["adaptor"]
6+
description: ""
7+
---
8+
9+
## Background
10+
11+
- Phasing out the poorly maintained hertz app.FS implementation
12+
- Providing a compatible and performant fs implementation through the official net/http ecosystem
13+
- Extending hertz functionality through the official net/http ecosystem to reduce custom implementations
14+
15+
## What is adaptor.HertzHandler
16+
17+
- Allows you to convert existing http.HandlerFunc methods directly to HertzHandler
18+
- Enables direct use of standard library methods like http.FileServer and embed.FS
19+
- Even allows direct use of github.com/gorilla/websocket in Hertz
20+
21+
## Example
22+
23+
```go
24+
package main
25+
26+
import (
27+
"embed"
28+
"net/http"
29+
30+
"github.com/cloudwego/hertz/pkg/app/server"
31+
"github.com/cloudwego/hertz/pkg/common/adaptor"
32+
)
33+
34+
//go:embed static/*
35+
var staticFiles embed.FS
36+
37+
func main() {
38+
h := server.Default()
39+
40+
helloHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
41+
w.Write([]byte("Hello hertz!"))
42+
})
43+
h.GET("/hello", adaptor.HertzHandler(helloHandler))
44+
45+
staticFS := adaptor.HertzHandler(http.FileServer(http.FS(staticFiles)))
46+
h.GET("/static/*filepath", staticFS)
47+
h.HEAD("/static/*filepath", staticFS)
48+
h.Spin()
49+
}
50+
```

0 commit comments

Comments
 (0)