Skip to content

Commit

Permalink
Add answer prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Dec 19, 2023
1 parent 3fcdfe6 commit f450ce6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Mirage API NodeJS wrapper. Access AI inference services.

Copyright 2023 Crisp IM SAS. See LICENSE for copying information.

* **📝 Implements**: [API Reference (V1)](https://docs.mirage-ai.com/references/api/v1/) at revision: 09/10/2023
* **📝 Implements**: [API Reference (V1)](https://docs.mirage-ai.com/references/api/v1/) at revision: 19/12/2023
* **😘 Maintainer**: [@valeriansaliou](https://github.com/valeriansaliou)

## Usage
Expand Down Expand Up @@ -119,6 +119,31 @@ client.Task.TranscribeSpeech(
{"start": 5.0, "end": 9.0, "text": " I'm just speaking some seconds to see if the translation is correct"}
```

#### ➡️ Answer Prompt

* **Method:** `client.Task.AnswerPrompt(data, { trace? })`
* **Reference:** [Answer Prompt](https://docs.mirage-ai.com/references/api/v1/#answer-prompt)

* **Request:**

```javascript
client.Task.AnswerPrompt({
"prompt": "Generate an article about Alpacas"
});
```

* **Response:**

```json
{
"reason": "processed",

"data": {
"answer": "The alpaca (Lama pacos) is a species of South American camelid mammal. It is similar to, and often confused with, the llama. However, alpacas are often noticeably smaller than llamas. The two animals are closely related and can successfully crossbreed. Both species are believed to have been domesticated from their wild relatives, the vicuña and guanaco. There are two breeds of alpaca: the Suri alpaca and the Huacaya alpaca."
}
}
```

#### ➡️ Answer Question

* **Method:** `client.Task.AnswerQuestion(data, { trace?, stream? })`
Expand Down
12 changes: 12 additions & 0 deletions lib/resources/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ Task.prototype.TranscribeSpeech = function(data, options) {
};


/**
* Task.prototype.AnswerPrompt
* @public
* @param {object} data
* @param {object} [options]
* @return {object} Promise object
*/
Task.prototype.AnswerPrompt = function(data, options) {
return this.parent._post("/task/answer/prompt", data, options);
};


/**
* Task.prototype.AnswerQuestion
* @public
Expand Down

0 comments on commit f450ce6

Please sign in to comment.