Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Aug 27, 2023
1 parent 163e151 commit 1411cb8
Showing 1 changed file with 35 additions and 9 deletions.
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
# @candlefinance/react-native-openai
<div align="center">
<img margin="auto" width="1000px" src="https://github.com/candlefinance/react-native-openai/assets/12258850/cba19df9-1083-4d43-a291-ffdcd5cf6c7c" alt="Candle / OpenAI">
</div>

OpenAI API for React Native
<br/>

<div align="center">
<img alt="npm downloads" src="https://img.shields.io/npm/dw/@candlefinance/react-native-openai?logo=npm&label=NPM%20downloads&cacheSeconds=3600"/>
<img alt="discord users online" src="https://discord.gg/qnAgjxhg6n"
target="_blank"
/>
</div>

<br/>

<h1 align="center">
Lightweight OpenAI API for React Native (iOS only)
</h1>

## Installation

```sh
npm install @candlefinance/react-native-openai
yarn add @candlefinance/react-native-openai
```

## Usage

```js
import { multiply } from '@candlefinance/react-native-openai';

// ...
const openAI = new OpenAI('API_KEY', 'ORG_ID');

const [result, setResult] = React.useState('');

React.useEffect(() => {
openAI.addListener('onMessageReceived', (event) => {
setResult((message) => message + event.payload.message);
});

const result = await multiply(3, 7);
return () => {
openAI.removeListener('onMessageReceived');
};
}, []);

// Create a new completion
openAI.stream(e.nativeEvent.text);
```

## Contributing

Join our [Discord](https://discord.gg/qnAgjxhg6n) in #dev channel to chat and ask questions!

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

0 comments on commit 1411cb8

Please sign in to comment.