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

Errors when transpiling #2667

Open
jensroth-git opened this issue Aug 14, 2024 · 3 comments
Open

Errors when transpiling #2667

jensroth-git opened this issue Aug 14, 2024 · 3 comments
Labels
ai/core bug Something isn't working

Comments

@jensroth-git
Copy link

Description

install the "ai" and the "@ai-sdk/openai" package and build the following example...

node -v
v20.16.0

tsc -v
Version 5.5.4

image

Code example

import { createOpenAI } from '@ai-sdk/openai';
import { generateText } from 'ai';

async function main()
{
    let openai = createOpenAI({
        apiKey: OpenAIKey
    });

    let response = await generateText({
        model: openai("gpt-4o-mini"),
        prompt: "What is the meaning of life?",
    });

    console.log(response);
}

main();

Additional context

No response

@lgrammel lgrammel added bug Something isn't working ai/core labels Aug 14, 2024
@lgrammel
Copy link
Collaborator

TS 5.5.4 upgrade: #2688

@lgrammel
Copy link
Collaborator

lgrammel commented Aug 16, 2024

Thanks for the bug report! There are 3 issues here:

  • fetch self references - fix: fix: use FetchFunction type to prevent self-reference #2690
  • openai import
    • workaround: install openai package as dev dependency
  • JSX import - will be fixed in 4.0, until then the (deprecated) property needs to stay for backwards compat. Workaround: add a dev dependency on "@types/react": "^18"

@lgrammel
Copy link
Collaborator

The fix has landed, with the workarounds you should be able to compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/core bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants