# @hellobardo/open-ai-sdk

> An Open AI API wrapper built in Typescript

Latest version **1.0.7** (published 2021-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hellobardo/open-ai-sdk
pnpm add @hellobardo/open-ai-sdk
yarn add @hellobardo/open-ai-sdk
bun add @hellobardo/open-ai-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2021-03-05 |
| First published | 2021-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Gustavo Hekel |
| Maintainers | gustavohekel-bardo, nahuelsotelo |
| Keywords | open ai, openai, node |

## Links

- npm: https://www.npmjs.com/package/@hellobardo/open-ai-sdk
- Repository: https://github.com/hellobardo/open-ai-sdk
- Homepage: https://github.com/hellobardo/open-ai-sdk#readme
- Issues: https://github.com/hellobardo/open-ai-sdk/issues
- npm.io page: https://npm.io/package/@hellobardo/open-ai-sdk

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2021-03-05
- 1.0.6 — 2021-03-05
- 1.0.5 — 2021-03-05
- 1.0.4 — 2021-03-05
- 1.0.3 — 2021-03-05
- 1.0.2 — 2021-03-04
- 1.0.1 — 2021-03-04
- 1.0.0 — 2021-03-04

## README

# OPEN-AI-SDK

A library that wraps the Open AI API built in TypeScript

## Installation

`npm i @hellobardo/open-ai-sdk`

## Usage

### Completion

Completion takes 2 parameters

- engine: a string representing the engine to be used
- configuration: an object with the configuration to be sent described here
  -> https://beta.openai.com/docs/api-reference/create-completion

```js
const {OpenAI} = require("@hellobardo/open-ai-sdk");

const oa = new OpenAI('YOUR_API_KEY', 'ORGANIZATION_KEY_IF_ANY')

oa.completion('davinci', {
    prompt    : 'This is a ...',
    max_tokens: 5
})
    .then(response => console.log(response.data))
    .catch(e => console.error(e))
```

### Search

Search takes 2 parameters

- engine: a string representing the engine to be used
- configuration: an object with the search configuration

```js
const {OpenAI} = require("@hellobardo/open-ai-sdk");

const oa = new OpenAI('YOUR_API_KEY', 'ORGANIZATION_KEY_IF_ANY')

oa.search('davinci', {
    documents: [
        "White House",
        "hospital",
        "school"
    ],
    query    : "the president"
})
    .then(response => console.log(response.data))
    .catch(e => console.error(e))
```

### Get Engines

Retrieve all engines

```js
const {OpenAI} = require("@hellobardo/open-ai-sdk");

const oa = new OpenAI('YOUR_API_KEY', 'ORGANIZATION_KEY_IF_ANY')

oa.getEngines()
    .then(response => console.log(response.data))
    .catch(e => console.error(e))
```

### Get Engine

Retrieve a single engine
```js
const {OpenAI} = require("@hellobardo/open-ai-sdk");

const oa = new OpenAI('YOUR_API_KEY', 'ORGANIZATION_KEY_IF_ANY')

oa.getEngine('davinci')
        .then(response => console.log(response.data))
        .catch(e => console.error(e))
```

---
_Source: https://npm.io/package/@hellobardo/open-ai-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
