with One AI and MQTT?
Find clusters with a similar meaning of a given text. See the documentation
One AI API enables users to leverage advanced language AI to analyze and process text. On Pipedream, you can integrate One AI into serverless workflows to automate tasks like content summarization, emotion detection, or keyword extraction. By tapping into One AI's capabilities via Pipedream, you can enrich data, glean insights, and streamline content-centric operations with ease and efficiency.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
one_ai: {
type: "app",
app: "one_ai",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.oneai.com/api/v0/org/info`,
headers: {
"api-key": `${this.one_ai.$auth.api_key}`,
"Accept": `application/json`,
},
})
},
})
import mqtt from "mqtt";
export default defineComponent({
props: {
mqtt: {
type: "app",
app: "mqtt",
}
},
async run({ steps, $ }) {
const url = `${this.mqtt.$auth.protocol}://${this.mqtt.$auth.host}:${this.mqtt.$auth.port}`;
const options = {
clientId: this.mqtt.$auth.client_id ?? `pipedream-client-${Date.now()}`,
connectTimeout: 5000,
username: this.mqtt.$auth.username,
password: this.mqtt.$auth.password,
};
const client = mqtt.connect(url, options);
await new Promise((resolve) => {
client.on("connect", () => {
client.publish("pipedream/test", 'Welcome MQTT + Pipedream users! ' + new Date().toISOString(), () => {
client.end();
console.log("Message sent");
resolve();
});
});
});
return {
mqttClientIsConnected: client.connected,
};
},
})