Skip to content

Commit

Permalink
docs(README): usage/example stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed Oct 19, 2023
1 parent 8443551 commit 1b766c2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Booga.js

The simple API Wrapper for the
[**`oobabooga/text-generation-webui`**](https://github.com/oobabooga/text-generation-webui)

## 💡 Usage

### Installation

```bash
npm install booga.js # or yarn/pnpm whatever
```

### Good to see once

You can find all parameters in [here](https://github.com/PleahMaCaka/booga.js/blob/main/src/types/ChatParams.ts)

### Example

You can get easily get API endpoints
use [--public-api](https://github.com/oobabooga/text-generation-webui?tab=readme-ov-file#api) argument

```js
import { Client } from "booga.js"

const client = new Client({
uri: "your uri here"
})

client.getCurrentModel().then(model => {
console.log(model)
})

client.chat("Hello Assistant!").then(res => {
console.log(`User: ${res.input}`)
console.log(`Assistant: ${res.output}`)
})
```
2 changes: 0 additions & 2 deletions src/Example.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Client } from "./Client.js"
import { defaultChatParams } from "./DefaultParams.js"

const client = new Client({
uri: "your uri here", // default by localhost:5000
Expand All @@ -10,7 +9,6 @@ client.getCurrentModel().then(model => {
})

client.chat("Hello Assistant!", {
...defaultChatParams,
character: "Assistant"
}).then(res => {
console.log(`User: ${res.input}`)
Expand Down

0 comments on commit 1b766c2

Please sign in to comment.