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

streamText with pure client implementation without a server in Expo React Native does not work because of bad ReadableStream on init #5074

Open
imWildCat opened this issue Mar 5, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@imWildCat
Copy link

Description

Image
"expo": "~52.0.37",
"react-native": "0.76.7",

Code example

full code: https://github.com/imWildCat-archived/my-ai-app/tree/main

 const handleSubmit = async () => {
    try {
      const model = createOpenAI({
        fetch: expoFetch as unknown as typeof globalThis.fetch,
        apiKey: process.env.EXPO_PUBLIC_OPENAI_API_KEY,
      });
      console.log('model:', model);
      const result = streamText({
        model: model('gpt-4o-mini'),
        prompt: 'hi',
  
      })
  
      console.log(result);
  
      // for await (const chunk of result.textStream) {
      //   console.log(chunk)
      // }
    } catch (e) {
      console.error(e)
    }

AI provider

"ai": "^4.1.51", "@ai-sdk/openai": "^1.2.0",

Additional context

with or without ReadableStream polyfill things are the same

@imWildCat imWildCat added the bug Something isn't working label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant