Skip to content

Commit

Permalink
fix: added example gif to readme (#10)
Browse files Browse the repository at this point in the history
* docs: added example gif to readme

* fix: readme quick fix

* fix: added onInputChange back in docs useChat hook
  • Loading branch information
vucinatim authored Apr 10, 2024
1 parent 7d20b39 commit 0e39f4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Inspired by Vercel's [Generative UI](https://sdk.vercel.ai/docs/concepts/ai-rsc)

Offers a seamless integration of OpenAI's advanced AI capabilities within React Native applications. Library provides components and helpers for building AI-powered streaming text and chat UIs.

![Example Gif](assets/example.gif)

## Features

- React Native (with Expo) type-safe helpers for streaming text responses + components for building chat UIs
Expand Down Expand Up @@ -43,8 +45,8 @@ import { OpenAI, isReactElement, useChat } from 'react-native-gen-ui';

```ts
const openAi = new OpenAI({
apiKey: process.env.EXPO_PUBLIC_OPENAI_API_KEY,
model: process.env.EXPO_PUBLIC_OPENAI_MODEL || 'gpt-4',
apiKey: process.env.EXPO_PUBLIC_OPENAI_API_KEY!,
model: 'gpt-4',
// You can even set a custom basePath of your SSE server
});
```
Expand All @@ -63,7 +65,7 @@ EXPO_PUBLIC_OPENAI_MODEL=model_name_here # Optional, model name from OpenAI (
Initialize the `useChat` hook inside your component. You can optionally pass **initial messages**, **success** and **error handlers**, and any tools the model will have access to.

```ts
const { input, messages, isLoading, handleSubmit } = useChat({
const { input, onInputChange, messages, isLoading, handleSubmit } = useChat({
openAi,
// Optional initial messages
initialMessages: [
Expand Down
Binary file added assets/example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e39f4e

Please sign in to comment.