今日已更新 222 条资讯 | 累计 40667 条内容
关于我们

标签:#Streaming

找到 234 篇相关文章

产品设计

Disney says it’s ‘exploring’ adding a free tier to Disney Plus

Disney is looking into launching a free streaming option. When asked about Disney's plans for free, ad-supported streaming during an earnings call on Wednesday, Disney CEO Josh D'Amaro confirmed the company is "exploring a free product for consumers." D'Amaro added that a free tier will help drive growth and expand the streaming service's reach "to […]

2026-08-05 原文 →
开发者

Ted Lasso returns at an important time for Apple TV

2026 is shaping up to be an excellent year for Apple TV. Apple's streaming service has built out an impressive slate that spans returning favorites like Silo and Sugar to all-new hits including OnlyFans-inspired dramedies, terrifying comedies, and paranoid tech thrillers. But the most important release might be a feel-good sports sitcom. After what seemed […]

2026-08-05 原文 →
AI 资讯

Stop Waiting for the Full AI Response: Stream Tokens in Python

Most AI applications wait for the model to generate the complete answer before showing anything to the user. For short answers, that may be acceptable. For longer responses, it can make the application feel slow—even when the model is already generating tokens. Streaming solves this by displaying each part of the response as soon as it arrives. The non-streaming version A standard OpenAI-compatible request may look like this: import os from openai import OpenAI client = OpenAI ( api_key = os . environ [ " AI_API_KEY " ], base_url = os . environ [ " AI_BASE_URL " ], ) response = client . chat . completions . create ( model = os . environ [ " AI_MODEL " ], messages = [ { " role " : " user " , " content " : " Explain API gateways in three sentences. " , } ], ) print ( response . choices [ 0 ]. message . content ) This works, but nothing is printed until the complete response has arrived. Stream the response Enable streaming by adding stream=True : stream = client . chat . completions . create ( model = os . environ [ " AI_MODEL " ], messages = [ { " role " : " user " , " content " : " Explain API gateways in three sentences. " , } ], stream = True , ) The request now returns a sequence of chunks instead of one completed response. Loop through those chunks and print the available content: for chunk in stream : content = chunk . choices [ 0 ]. delta . content if content : print ( content , end = "" , flush = True ) print () The user can now see the answer while it is being generated. Complete example import os from openai import OpenAI client = OpenAI ( api_key = os . environ [ " AI_API_KEY " ], base_url = os . environ [ " AI_BASE_URL " ], ) stream = client . chat . completions . create ( model = os . environ [ " AI_MODEL " ], messages = [ { " role " : " user " , " content " : " Explain API gateways in three sentences. " , } ], stream = True , ) for chunk in stream : content = chunk . choices [ 0 ]. delta . content if content : print ( content , end = "" , flush = True )

2026-08-03 原文 →
开发者

The OG reading app just got a big update

Hi, friends! Welcome to Installer No. 138, your guide to the best and Verge-iest stuff in the world. (If you're new here, welcome, happy August, and also you can read all the old editions at the Installer homepage.) This week, I've been reading about microwave sounds and Meta glasses and Alex vs. Alix, testing the […]

2026-08-01 原文 →