with AI/ML API and MindStudio?
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
ai_ml_api: {
type: "app",
app: "ai_ml_api",
}
},
async run({steps, $}) {
const data = {
"model": "mistralai/Mistral-7B-v0.1",
"messages": [
{
"role": "system",
"content": "You are an AI assistant who knows everything.",
},
{
"role": "user",
"content": "Tell me, why is the sky blue?"
},
]
}
return await axios($, {
method: "POST",
url: `https://api.aimlapi.com/chat/completions`,
headers: {
Authorization: `Bearer ${this.ai_ml_api.$auth.api_key}`,
},
data,
})
},
})
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
mindstudio: {
type: "app",
app: "mindstudio",
}
},
async run({steps, $}) {
const data = {
"workerId": `${this.mindstudio.$auth.agent_id}`,
"includeBillingCosts": true,
"variables": {
"key1": "value1",
"key2": "value2"
},
"metadata": {
"tags": ["tag1", "tag2"]
},
"workflow": "optional-workflow-name",
"callbackUrl": "https://your-callback-url.com/endpoint"
}
return await axios($, {
method: "post",
url: `https://api.mindstudio.ai/developer/v2/agents/run`,
headers: {
Authorization: `Bearer ${this.mindstudio.$auth.api_key}`,
"content-type": `application/json`,
},
data,
})
},
})