langchain icon indicating copy to clipboard operation
langchain copied to clipboard

openai: read stream_options

Open ccurme opened this issue 9 months ago • 1 comments

OpenAI recently added a stream_options parameter to its chat completions API (see release notes). When this parameter is set to {"usage": True}, an extra "empty" message is added to the end of a stream containing token usage. Here we check for this parameter and propagate token usage to message.response_metadata.

ccurme avatar May 10 '24 20:05 ccurme

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 2:33pm

vercel[bot] avatar May 10 '24 20:05 vercel[bot]