Skip to content

Commit

Permalink
Commit from m3o/m3o action
Browse files Browse the repository at this point in the history
  • Loading branch information
m3o-actions committed Jul 17, 2023
1 parent e29eee3 commit 22af10b
Show file tree
Hide file tree
Showing 29 changed files with 1,115 additions and 1,115 deletions.
68 changes: 34 additions & 34 deletions examples/ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Ai/api](https:

Endpoints:

## Chat

Make a request to ChatGPT


[https://m3o.com/ai/api#Chat](https://m3o.com/ai/api#Chat)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Make a request to ChatGPT
async function chatWithChatGpt() {
const rsp = await aiService.chat({
"context": [
{
"prompt": "who is leonardo davinci",
"reply": "Leonardo da Vinci was an Italian polymath during the Renaissance period. He was born in 1452 in Vinci, Italy, and is renowned for his contributions to various fields such as science, engineering, art, and anatomy. Da Vinci's most famous works include the Mona Lisa and The Last Supper. He is often considered one of the greatest artists and thinkers of all time."
},
{
"prompt": "where is he from?",
"reply": "Leonardo da Vinci was from Vinci, a town in Tuscany, Italy."
}
],
"model": "gpt-3.5-turbo",
"prompt": "when did he die?"
})
console.log(rsp)

}

chatWithChatGpt()
```
## Complete

Make a request to the AI
Expand Down Expand Up @@ -96,37 +130,3 @@ async function moderateHateSpeech() {

moderateHateSpeech()
```
## Chat

Make a request to ChatGPT


[https://m3o.com/ai/api#Chat](https://m3o.com/ai/api#Chat)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Make a request to ChatGPT
async function chatWithChatGpt() {
const rsp = await aiService.chat({
"context": [
{
"prompt": "who is leonardo davinci",
"reply": "Leonardo da Vinci was an Italian polymath during the Renaissance period. He was born in 1452 in Vinci, Italy, and is renowned for his contributions to various fields such as science, engineering, art, and anatomy. Da Vinci's most famous works include the Mona Lisa and The Last Supper. He is often considered one of the greatest artists and thinkers of all time."
},
{
"prompt": "where is he from?",
"reply": "Leonardo da Vinci was from Vinci, a town in Tuscany, Italy."
}
],
"model": "gpt-3.5-turbo",
"prompt": "when did he die?"
})
console.log(rsp)

}

chatWithChatGpt()
```
136 changes: 68 additions & 68 deletions examples/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,75 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https

Endpoints:

## Get
## Logs

Get an app by name
Get the logs for an app


[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)
[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get an app by name
async function getAnApp() {
const rsp = await appService.get({
// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
})
console.log(rsp)

}

getAnApp()
retrieveBuildLogsForAnApp()
```
## Reserve

Reserve app names


[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
console.log(rsp)

}

reserveAppName()
```
## Status

Get the status of an app


[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
"name": "helloworld"
})
console.log(rsp)

}

getTheStatusOfAnApp()
```
## Run

Expand Down Expand Up @@ -54,28 +101,26 @@ async function runAnApp() {

runAnApp()
```
## Status
## Regions

Get the status of an app
Return the support regions


[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)
[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
"name": "helloworld"
})
// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
console.log(rsp)

}

getTheStatusOfAnApp()
listRegions()
```
## Resolve

Expand Down Expand Up @@ -146,52 +191,28 @@ async function deleteAnApp() {

deleteAnApp()
```
## Logs

Get the logs for an app


[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
})
console.log(rsp)

}

retrieveBuildLogsForAnApp()
```
## Reserve
## Get

Reserve app names
Get an app by name


[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)
[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
// Get an app by name
async function getAnApp() {
const rsp = await appService.get({
"name": "helloworld"
})
console.log(rsp)

}

reserveAppName()
getAnApp()
```
## List

Expand All @@ -214,24 +235,3 @@ async function listTheApps() {

listTheApps()
```
## Regions

Return the support regions


[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
console.log(rsp)

}

listRegions()
```
Loading

0 comments on commit 22af10b

Please sign in to comment.