Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Nov 3, 2023
1 parent 08703d2 commit 755d2ae
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Requires `iOS 15+` and Android `minSdkVersion = 24`.
yarn add react-native-openai
```

## Basic Usage
### Basic Usage

```js
import OpenAI from 'react-native-openai';
Expand All @@ -55,9 +55,7 @@ const openAI = new OpenAI({
organization: 'YOUR_ORGANIZATION',
});

// Alternatively (recommended), you can use your own backend and not hardcode an API key in your app
// pathPrefix is currently not supported on Android, so follow OpenAIs schema for your backend
// i.e. https://my-custom-domain.com/v1/chat/completions
// Alternatively (recommended), you can use your own backend and not hardcode an API key in your app i.e. https://my-custom-domain.com/v1/chat/completions (follow the same API as OpenAI until pathPrefix is fixed on Android)
const openAI = new OpenAI({
host: 'my-custom-host.com',
});
Expand All @@ -84,7 +82,7 @@ openAI.chat.stream({
messages: [
{
role: 'user',
content: question,
content: 'How do I star a repo?',
},
],
model: 'gpt-3.5-turbo',
Expand All @@ -98,7 +96,7 @@ await openAI.chate.create(...)
```js
const result = await openAI.image.create({
prompt: e.nativeEvent.text,
prompt: 'An awesome Candle logo',
n: 3,
size: '512x512',
});
Expand Down

0 comments on commit 755d2ae

Please sign in to comment.