From 6ee0f2de75fa9ae2f5549a8b0d5bb00d47c4b6f2 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Wed, 17 Apr 2024 21:53:20 -0700 Subject: [PATCH] docs: update streaming mode --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b5c5f75..78006c6 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,15 @@ https://r.jina.ai/https://en.wikipedia.org/wiki/Artificial_intelligence ### Streaming Mode -Streaming mode is useful when you find that the standard mode provides an incomplete result. This is because streaming mode will wait a bit longer until the page is fully rendered. - -Use the accept-header to control the streaming behavior: +Streaming mode is useful when you find that the standard mode provides an incomplete result. This is because streaming mode will wait a bit longer until the page is fully rendered. Use the accept-header to toggle the streaming mode: ```bash curl -H "Accept: text/event-stream" https://r.jina.ai/https://en.m.wikipedia.org/wiki/Main_Page ``` -The data comes in a stream; each subsequent chunk contains more complete information. The last chunk should provide the most complete and final result. +The data comes in a stream; each subsequent chunk contains more complete information. **The last chunk should provide the most complete and final result.** -For example, compare these two curl commands below: +For example, compare these two curl commands below. You can see streaming one gives you complete information at last, whereas standard mode does not. This is because the content loading on this particular site is triggered by some js *after* the page is fully loaded, and standard mode returns the page "too soon". ```bash curl -H 'x-no-cache: true' https://access.redhat.com/security/cve/CVE-2023-45853 curl -H "Accept: text/event-stream" -H 'x-no-cache: true' https://r.jina.ai/https://access.redhat.com/security/cve/CVE-2023-45853 @@ -57,7 +55,7 @@ Your LLM: LLM(streamContent1) | | LLM(streamContent3) ``` -Note that in terms of completeness: `... > streamContent3 > streamContent2 > streamContent1`. +Note that in terms of completeness: `... > streamContent3 > streamContent2 > streamContent1`, each subsequent chunk contains more complete information. ### JSON mode