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

Crucial useCompletion Returns are missing from @ai-sdk/svelte #3799

Open
vyconm opened this issue Nov 20, 2024 · 0 comments
Open

Crucial useCompletion Returns are missing from @ai-sdk/svelte #3799

vyconm opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vyconm
Copy link

vyconm commented Nov 20, 2024

Description

When importing and using useCompletion in svelte, multiple Returns like setInput and handleInputChange are missing. TS says the following:

(alias) useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamProtocol, onResponse, onFinish, onError, fetch, }?: UseCompletionOptions): UseCompletionHelpers
import useCompletion

--> this makes the useCompletion hook somewhat unusable

Code example

<script lang="ts">
	import { useCompletion } from '@ai-sdk/svelte';

	const { completion, input, handleSubmit, handleInputChange } = useCompletion({
		api: '/api/openai/completion'
	});
</script>

<form on:submit={handleSubmit}>
	<input name="prompt" bind:value={$input} on:input={handleInputChange} id="input" />
	<button type="submit">Submit</button>
	<div>{$completion}</div>
</form>

AI provider

@ai-sdk/svelte 1.0.1

Additional context

No response

@vyconm vyconm added the bug Something isn't working label Nov 20, 2024
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