Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LanguageModelChatResponse incorrect documentation for streaming. #213634

Closed
dbaeumer opened this issue May 28, 2024 · 2 comments
Closed

LanguageModelChatResponse incorrect documentation for streaming. #213634

dbaeumer opened this issue May 28, 2024 · 2 comments
Assignees
Labels
api chat info-needed Issue requires more information from poster
Milestone

Comments

@dbaeumer
Copy link
Member

Testing #213514

I think the code example should be:

try {
   // consume stream
   for await (const chunk of response.text) {
    console.log(chunk);
   }
 } catch(e) {
   // stream ended with an error
   console.error(e);
 }

e.g. reponse.stream -> response.text

@jrieken jrieken added this to the May 2024 milestone May 28, 2024
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug api chat labels May 29, 2024
@jrieken
Copy link
Member

jrieken commented May 29, 2024

@dbaeumer Unsure which vscode.d.ts you have been using but the one in main uses a correct sample

vscode/src/vscode-dts/vscode.d.ts

Lines 19005 to 19020 in 92cc429

* the stream should handle the errors accordingly.
*
* @example
* ```ts
* try {
* // consume stream
* for await (const chunk of response.text) {
* console.log(chunk);
* }
*
* } catch(e) {
* // stream ended with an error
* console.error(e);
* }
* ```
*

@jrieken jrieken added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug labels May 29, 2024
@jrieken jrieken closed this as completed May 29, 2024
@dbaeumer
Copy link
Member Author

I used goto definition which actually brought me to a local copy of it in the samples :-). Hope that the difference was not too big.

@microsoft microsoft locked and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api chat info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants