Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Unable to resolve "ai/react" in React Native #498

Closed
timothymiller opened this issue Aug 23, 2023 · 6 comments
Closed

Unable to resolve "ai/react" in React Native #498

timothymiller opened this issue Aug 23, 2023 · 6 comments

Comments

@timothymiller
Copy link

I am trying to use the following code in React Native:

import { useCompletion } from 'ai/react'

const { completion, input, stop, isLoading, handleInputChange, handleSubmit } = useCompletion()

Behavior

It throws this exception when starting the app:

Unable to resolve "ai/react"

Is this package supported in React environments? Or only Next.js?

@Death666Machine
Copy link

Also experiencing this issue.

@karaggeorge
Copy link

karaggeorge commented Aug 24, 2023

Might have to enable https://reactnative.dev/blog/2023/06/21/package-exports-support#enabling-package-exports-beta

/react is a package export field, defined here

@karaggeorge
Copy link

Looking a bit more into it, even if the package resolution is fixed, it doesn't seem to work with React Native yet because this package uses streams, and RN hasn't yet implemented streams for their fetch API

@sebnun
Copy link

sebnun commented Oct 20, 2023

Looks like now there is a fetch implementation that support streams in React Native
https://github.com/react-native-community/fetch

Would it be possible to use this with ai/react ?

@MaxLeiter
Copy link
Member

@sebnun I gave it a quick try and couldn't make it work, but it may be possible.

@MaxLeiter
Copy link
Member

As this isn't really a problem with the ai ibrary, I'm going to convert it to a discussion.

@vercel vercel locked and limited conversation to collaborators Oct 20, 2023
@MaxLeiter MaxLeiter converted this issue into discussion #655 Oct 20, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants