generated from ryansonshine/typescript-npm-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create first version of poll function and README
- Loading branch information
Showing
5 changed files
with
485 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,89 @@ | ||
# typescript-npm-package-template | ||
[<p align="center"><img width="150" src="https://tmlc.pl/logo.jpg" alt="Tiny Machine Learning Company"></p>](https://tmlc.pl) | ||
|
||
> Template to kickstart creating a Node.js module using TypeScript and VSCode | ||
# OpenAI Polling | ||
|
||
Inspired by [node-module-boilerplate](https://github.com/sindresorhus/node-module-boilerplate) | ||
A library that [fills the gaps in OpenAI Threads API](https://platform.openai.com/docs/assistants/how-it-works/polling-for-updates) | ||
|
||
## Features | ||
|
||
- [Semantic Release](https://github.com/semantic-release/semantic-release) | ||
- [Issue Templates](https://github.com/ryansonshine/typescript-npm-package-template/tree/main/.github/ISSUE_TEMPLATE) | ||
- [GitHub Actions](https://github.com/ryansonshine/typescript-npm-package-template/tree/main/.github/workflows) | ||
- [Codecov](https://about.codecov.io/) | ||
- [VSCode Launch Configurations](https://github.com/ryansonshine/typescript-npm-package-template/blob/main/.vscode/launch.json) | ||
- [TypeScript](https://www.typescriptlang.org/) | ||
- [Husky](https://github.com/typicode/husky) | ||
- [Lint Staged](https://github.com/okonet/lint-staged) | ||
- [Commitizen](https://github.com/search?q=commitizen) | ||
- [Jest](https://jestjs.io/) | ||
- [ESLint](https://eslint.org/) | ||
- [Prettier](https://prettier.io/) | ||
|
||
## Getting started | ||
|
||
### Set up your repository | ||
|
||
**Click the "Use this template" button.** | ||
|
||
Alternatively, create a new directory and then run: | ||
|
||
```bash | ||
curl -fsSL https://github.com/ryansonshine/typescript-npm-package-template/archive/main.tar.gz | tar -xz --strip-components=1 | ||
``` | ||
|
||
Replace `FULL_NAME`, `GITHUB_USER`, and `REPO_NAME` in the script below with your own details to personalize your new package: | ||
|
||
```bash | ||
FULL_NAME="John Smith" | ||
GITHUB_USER="johnsmith" | ||
REPO_NAME="my-cool-package" | ||
sed -i.mybak "s/\([\/\"]\)(ryansonshine)/$GITHUB_USER/g; s/typescript-npm-package-template\|my-package-name/$REPO_NAME/g; s/Ryan Sonshine/$FULL_NAME/g" package.json package-lock.json README.md | ||
rm *.mybak | ||
``` | ||
|
||
### Add NPM Token | ||
[![npm package][npm-img]][npm-url] | ||
|
||
Add your npm token to your GitHub repository secrets as `NPM_TOKEN`. | ||
<!-- [![Build Status][build-img]][build-url] | ||
[![Downloads][downloads-img]][downloads-url] | ||
[![Issues][issues-img]][issues-url] | ||
[![Code Coverage][codecov-img]][codecov-url] | ||
[![Commitizen Friendly][commitizen-img]][commitizen-url] | ||
[![Semantic Release][semantic-release-img]][semantic-release-url] --> | ||
|
||
### Add Codecov integration | ||
> **OpenAI docs**: In order to keep the status of your run up to date, you will have to **periodically retrieve the Run object**. You can check the status of the run each time you retrieve the object **to determine what your application should do next**. We plan to add support for streaming to make this simpler in the near future. | ||
Enable the Codecov GitHub App [here](https://github.com/apps/codecov). | ||
It's not there yet and I bet you want to use Threads API anyways. All you need is to import this library and call the `poll` function | ||
|
||
**Remove everything from here and above** | ||
## 🌸 TMLC says: "Just upload your data and get an AI model" | ||
|
||
--- | ||
`<shameless plug>` | ||
|
||
# my-package-name | ||
We are building an [Automated Machine Learning platform](https://automl.tmlc.pl) and we believe it will give you an edge over others | ||
|
||
[![npm package][npm-img]][npm-url] | ||
[![Build Status][build-img]][build-url] | ||
[![Downloads][downloads-img]][downloads-url] | ||
[![Issues][issues-img]][issues-url] | ||
[![Code Coverage][codecov-img]][codecov-url] | ||
[![Commitizen Friendly][commitizen-img]][commitizen-url] | ||
[![Semantic Release][semantic-release-img]][semantic-release-url] | ||
[Click here to sign up on a priority waitlist and get an early access to our platform!](https://mailchi.mp/1f414e9e32d1/t06qvxkc5z) | ||
|
||
> My awesome module | ||
`</shameless plug>` | ||
|
||
## Install | ||
|
||
```bash | ||
npm install my-package-name | ||
npm install @tmlc/openai-polling | ||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
import { myPackage } from 'my-package-name'; | ||
import { poll } from '@tmlc/openai-polling'; | ||
|
||
myPackage('hello'); | ||
//=> 'hello from my package' | ||
await poll(openai, thread, run); | ||
``` | ||
|
||
## API | ||
|
||
### myPackage(input, options?) | ||
### poll(openai: OpenAI, thread: OpenAI.Beta.Threads.Thread, runId: OpenAI.Beta.Threads.Runs.Run): Promise<OpenAI.Beta.Threads.Runs.Run> | ||
|
||
#### input | ||
#### openai | ||
|
||
Type: `string` | ||
Type: `OpenAI` | ||
|
||
Lorem ipsum. | ||
#### threadId | ||
|
||
#### options | ||
Type: `OpenAI.Beta.Threads.Thread` | ||
|
||
Type: `object` | ||
##### runId | ||
|
||
##### postfix | ||
Type: `OpenAI.Beta.Threads.Runs.Run` | ||
|
||
Type: `string` | ||
Default: `rainbows` | ||
#### returns | ||
|
||
Lorem ipsum. | ||
Type: `Promise<OpenAI.Beta.Threads.Runs.Run>` | ||
|
||
[build-img]:https://github.com/ryansonshine/typescript-npm-package-template/actions/workflows/release.yml/badge.svg | ||
## License | ||
|
||
MIT License | ||
|
||
## Author | ||
|
||
[Jędrzej Maczan](https://maczan.pl) from [Tiny Machine Learning Company](https://tmlc.pl), [Gdynia](https://en.wikipedia.org/wiki/Gdynia), [Poland](https://en.wikipedia.org/wiki/Poland), 2024 | ||
|
||
[Click here to sign up on a priority waitlist and get an early access to our AutoML platform first](https://mailchi.mp/1f414e9e32d1/t06qvxkc5z) | ||
|
||
<!-- [build-img]:https://github.com/ryansonshine/typescript-npm-package-template/actions/workflows/release.yml/badge.svg | ||
[build-url]:https://github.com/ryansonshine/typescript-npm-package-template/actions/workflows/release.yml | ||
[downloads-img]:https://img.shields.io/npm/dt/typescript-npm-package-template | ||
[downloads-url]:https://www.npmtrends.com/typescript-npm-package-template | ||
[npm-img]:https://img.shields.io/npm/v/typescript-npm-package-template | ||
[npm-url]:https://www.npmjs.com/package/typescript-npm-package-template | ||
[issues-img]:https://img.shields.io/github/issues/ryansonshine/typescript-npm-package-template | ||
[npm-img]:https://img.shields.io/npm/v/typescript-npm-package-template --> | ||
|
||
[npm-url]: https://www.npmjs.com/package/@tmlc/openai-polling | ||
|
||
<!-- [issues-img]:https://img.shields.io/github/issues/ryansonshine/typescript-npm-package-template | ||
[issues-url]:https://github.com/ryansonshine/typescript-npm-package-template/issues | ||
[codecov-img]:https://codecov.io/gh/ryansonshine/typescript-npm-package-template/branch/main/graph/badge.svg | ||
[codecov-url]:https://codecov.io/gh/ryansonshine/typescript-npm-package-template | ||
[semantic-release-img]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg | ||
[semantic-release-url]:https://github.com/semantic-release/semantic-release | ||
[commitizen-img]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg | ||
[commitizen-url]:http://commitizen.github.io/cz-cli/ | ||
[commitizen-url]:http://commitizen.github.io/cz-cli/ --> |
Oops, something went wrong.