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

useCompletion refactoring. #808

Merged
merged 8 commits into from
Nov 30, 2023

Conversation

lgrammel
Copy link
Collaborator

@lgrammel lgrammel commented Nov 29, 2023

Summary

  • rename callApi to callChatApi
  • introduce callCompletionApi
  • refactor useCompletion implementations to use callCompletionApi

@lgrammel lgrammel self-assigned this Nov 29, 2023
@lgrammel lgrammel changed the title [WIP] useCompletion refactoring useCompletion refactoring. Nov 30, 2023
@lgrammel lgrammel marked this pull request as ready for review November 30, 2023 15:37
@lgrammel lgrammel requested a review from MaxLeiter November 30, 2023 15:37
const newVariable = await readBody(event);
console.log('nw', newVariable);
const { prompt } = newVariable as {
prompt: string;
};
const { prompt } = await readBody(event);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor cleanup.

}),
credentials,
headers: {
'Content-Type': 'application/json',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight change: this is now the default for all frameworks.

onFinish,
onError,
onData: data => {
mutateStreamData(() => [...existingData, ...(data ?? [])]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch from streamData.value = to `mutateStreamData

Copy link
Member

@MaxLeiter MaxLeiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@MaxLeiter MaxLeiter merged commit ba00e37 into vercel:main Nov 30, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants