Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.

Repository from Github https://github.comAzure/azure-sdk-for-jsRepository from Github https://github.comAzure/azure-sdk-for-js

[@azure-rest/ai-inference] missing exported/re-exported types

sinedied opened this issue · comments

  • Package Name: @azure-rest/ai-inference
  • Package Version: 1.0.0-beta.5
  • Operating system: MacOS
  • nodejs
    • version: v22.13.1
  • browser
    • name/version:
  • typescript
    • version: 5.8.2
  • Is the bug related to documentation in

Describe the bug
Some types are missing or not (re-)exported, like the ErrorModeltype for the client response or parsed JSON response (Chat completion delta) from the SSE stream. In strongly typed environments that's an issue, again also with linters.

This means that you either have to write your own types (risking breaking changes/builds with updates) and cannot use explicit typing (sometimes inferred types are not enough).

Expected behavior
All used types in the library should be re-exported (like ErrorModeltype), and even if they're not returned/used directly by the client the type for the response objects should be provided, like for the Chat completion delta.

@sinedied The ErrorModel type you're referring to is this one, correct?

Would it be possible to import that type in your application code from "@azure-rest/core-client"?

@jeremymeng Suggestions welcome here.

We often re-export types for customers' convenience. In this case it feels that we should. Maybe code gen can add re-exports of these types? /cc our code generator experts @qiaozha @MaryGao

@glharper The issue is that @azure-rest/core-client is a transitive dependency, importing code from transitive deps is considered a bad practice, and may not even working depending of the package manager used.

Re-exporting the type here would be best for DX, as @jeremymeng mentioned.