Repository navigation
Conversation
The xaiProvider factory narrows the return type to Provider<"openai-responses">, but createProvider's generic was widened back to Api because api was a single ProviderStreams value rather than a literal-keyed map. Without the explicit generic, tsgo rejected the call after xAI models were routed through the Responses API in #8124, breaking ai package builds. Pass the literal generic explicitly so createProvider returns Provider<"openai-responses"> and matches the factory's declared signature.
Contributor
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues daily. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After #8124 routed the built-in xAI catalog through the OpenAI Responses API, the ai workspace stopped building:
```
src/providers/xai.ts(8,2): error TS2322: Type 'Provider<"openai-completions" | "openai-responses">' is not assignable to type 'Provider<"openai-responses">'.
```
`xaiProvider()` declares its return type as `Provider<"openai-responses">` and passes `api: openAIResponsesApi()`. `createProvider`'s generic widens back to `Api` because the `api` field is a single `ProviderStreams` value rather than a literal-keyed `Partial<Record<TApi, ProviderStreams>>` map, so TS infers `Provider` instead of `Provider<"openai-responses">`.
Pass the literal generic explicitly so the call matches the declared signature.
Repro (on v0.84.3 tag)
```
$ cd packages/ai && npm run build:offline
...
src/providers/xai.ts(8,2): error TS2322: ...
```
Verification
After this patch:
Diff
```diff
--- a/packages/ai/src/providers/xai.ts
+++ b/packages/ai/src/providers/xai.ts
@@
export function xaiProvider(): Provider<"openai-responses"> {