Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/pieces/community/microsoft-outlook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-microsoft-outlook",
"version": "0.3.2",
"version": "0.3.3",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/pieces/community/microsoft-outlook/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const microsoftOutlook = createPiece({
displayName: 'Microsoft Outlook',
auth: microsoftOutlookAuth,
minimumSupportedRelease: '0.82.0',
logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-outlook.jpg',
logoUrl: 'https://cdn.activepieces.com/pieces/microsoft-outlook.png',
categories: [PieceCategory.PRODUCTIVITY],
authors: ['lucaslimasouza', 'kishanprmr','sanket-a11y'],
authors: ['lucaslimasouza', 'kishanprmr', 'sanket-a11y'],
actions: [
sendEmailAction,
downloadAttachmentAction,
Expand Down
2 changes: 1 addition & 1 deletion packages/pieces/community/mistral-ai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-mistral-ai",
"version": "0.1.4",
"version": "0.2.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
Expand Down
32 changes: 31 additions & 1 deletion packages/pieces/community/mistral-ai/src/i18n/translation.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
{
"Mistral AI provides state-of-the-art open-weight and hosted language models for text generation, embeddings, and reasoning tasks.": "Mistral AI provides state-of-the-art open-weight and hosted language models for text generation, embeddings, and reasoning tasks.",
"You can obtain your API key from the Mistral AI dashboard. Go to https://console.mistral.ai, generate an API key, and paste it here.": "You can obtain your API key from the Mistral AI dashboard. Go to https://console.mistral.ai, generate an API key, and paste it here.",
"Cloudflare AI Gateway": "Cloudflare AI Gateway",
"Route Mistral calls through your Cloudflare AI Gateway. Provide a Mistral API key (key-in-request mode) or leave it blank if your gateway has Mistral configured as a stored key (BYOK).": "Route Mistral calls through your Cloudflare AI Gateway. Provide a Mistral API key (key-in-request mode) or leave it blank if your gateway has Mistral configured as a stored key (BYOK).",
"Cloudflare Account ID": "Cloudflare Account ID",
"Your Cloudflare account ID (visible on the AI Gateway dashboard).": "Your Cloudflare account ID (visible on the AI Gateway dashboard).",
"Gateway ID": "Gateway ID",
"The slug of your AI Gateway (visible on the gateway settings page).": "The slug of your AI Gateway (visible on the gateway settings page).",
"Gateway Auth Token": "Gateway Auth Token",
"Optional. Required only if your gateway has authentication enabled. Sent as cf-aig-authorization.": "Optional. Required only if your gateway has authentication enabled. Sent as cf-aig-authorization.",
"Mistral API Key": "Mistral API Key",
"Optional. Provide your Mistral key for key-in-request mode. Leave blank if Cloudflare injects the key via stored credentials (BYOK).": "Optional. Provide your Mistral key for key-in-request mode. Leave blank if Cloudflare injects the key via stored credentials (BYOK).",
"Ask Mistral": "Ask Mistral",
"Create Embeddings": "Create Embeddings",
"Upload File": "Upload File",
"Run OCR": "Run OCR",
"Extract text from PDFs and images using mistral-ocr-latest. To OCR a file from a previous step, run Upload File first (with purpose=ocr) and pass the returned id here.": "Extract text from PDFs and images using mistral-ocr-latest. To OCR a file from a previous step, run Upload File first (with purpose=ocr) and pass the returned id here.",
"List Models": "List Models",
"Custom API Call": "Custom API Call",
"Ask Mistral anything you want!": "Ask Mistral anything you want!",
Expand Down Expand Up @@ -36,6 +48,24 @@
"The input text for which to create an embedding.": "The input text for which to create an embedding.",
"The file to upload (max 512MB).For fine tuning purspose provide .jsonl file.": "The file to upload (max 512MB).For fine tuning purspose provide .jsonl file.",
"Purpose of the file.": "Purpose of the file.",
"Document Source": "Document Source",
"Where the document or image to OCR comes from.": "Where the document or image to OCR comes from.",
"URL": "URL",
"Mistral file ID (uploaded earlier with purpose=ocr)": "Mistral file ID (uploaded earlier with purpose=ocr)",
"Document": "Document",
"File ID": "File ID",
"A Mistral file ID returned from a prior Upload File step (purpose=ocr).": "A Mistral file ID returned from a prior Upload File step (purpose=ocr).",
"Document Type": "Document Type",
"Pick \"Image\" for PNG/JPG/WEBP, \"Document\" for PDFs.": "Pick \"Image\" for PNG/JPG/WEBP, \"Document\" for PDFs.",
"Document (PDF)": "Document (PDF)",
"Image": "Image",
"Public URL of the PDF or image to OCR.": "Public URL of the PDF or image to OCR.",
"Pages": "Pages",
"Optional zero-based page indices to process. Leave empty for all pages.": "Optional zero-based page indices to process. Leave empty for all pages.",
"Include Image Base64": "Include Image Base64",
"Return embedded images encoded as base64 alongside the Markdown.": "Return embedded images encoded as base64 alongside the Markdown.",
"mistral-ocr-latest (Recommended)": "mistral-ocr-latest (Recommended)",
"mistral-ocr-2505": "mistral-ocr-2505",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
"fine-tune": "fine-tune",
Expand All @@ -51,4 +81,4 @@
"JSON": "JSON",
"Form Data": "Form Data",
"Raw": "Raw"
}
}
16 changes: 7 additions & 9 deletions packages/pieces/community/mistral-ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { PieceCategory } from "@activepieces/shared";
import { createChatCompletion } from "./lib/actions/create-chat-completion";
import { createEmbeddings } from "./lib/actions/create-embeddings";
import { uploadFile } from "./lib/actions/upload-file";
import { runOcr } from "./lib/actions/run-ocr";
import { listModels } from "./lib/actions/list-models";
import { mistralAuth } from "./lib/common/auth";
import { mistralRequest } from "./lib/common/request";
import { createCustomApiCallAction } from "@activepieces/pieces-common";

export const mistralAi = createPiece({
Expand All @@ -19,17 +21,13 @@ export const mistralAi = createPiece({
createChatCompletion,
createEmbeddings,
uploadFile,
runOcr,
listModels,
createCustomApiCallAction({
auth:mistralAuth,
baseUrl:()=>'https://api.mistral.ai/v1',
authMapping:async (auth)=>{
return{
Authorization:`Bearer ${auth.secret_text}`
}
}
})
auth: mistralAuth,
baseUrl: (auth) => (auth ? mistralRequest.getConfig(auth).baseUrl : 'https://api.mistral.ai/v1'),
authMapping: async (auth) => mistralRequest.getConfig(auth).headers,
}),
],
triggers: [],
});

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient, AuthenticationType } from '@activepieces/pieces-common';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { mistralAuth } from '../common/auth';
import { modelDropdown, parseMistralError } from '../common/props';
import { mistralRequest } from '../common/request';

export const createChatCompletion = createAction({
auth: mistralAuth,
Expand Down Expand Up @@ -34,6 +35,7 @@ export const createChatCompletion = createAction({
},
async run(context) {
const { model, temperature, top_p, max_tokens, random_seed, timeout, prompt } = context.propsValue;
const { baseUrl, headers } = mistralRequest.getConfig(context.auth);

const body: Record<string, any> = {
model,
Expand All @@ -46,18 +48,15 @@ export const createChatCompletion = createAction({
temperature,
top_p,
max_tokens,
random_seed
random_seed,
};
let lastErr;
for (let attempt = 0; attempt <= 3; ++attempt) {
try {
const response = await httpClient.sendRequest<{choices:{message:{content:string}}[]}>({
const response = await httpClient.sendRequest<{ choices: { message: { content: string } }[] }>({
method: HttpMethod.POST,
url: 'https://api.mistral.ai/v1/chat/completions',
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.secret_text,
},
url: `${baseUrl}/chat/completions`,
headers,
body,
timeout: timeout ?? 30000,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient, AuthenticationType } from '@activepieces/pieces-common';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { mistralAuth } from '../common/auth';
import { parseMistralError } from '../common/props';
import { mistralRequest } from '../common/request';

export const createEmbeddings = createAction({
auth: mistralAuth,
Expand All @@ -18,6 +19,7 @@ export const createEmbeddings = createAction({
},
async run(context) {
const { input, timeout } = context.propsValue;
const { baseUrl, headers } = mistralRequest.getConfig(context.auth);
let inputArr: string[] = [];
try {
if (typeof input === 'string') {
Expand All @@ -40,11 +42,8 @@ export const createEmbeddings = createAction({
try {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: 'https://api.mistral.ai/v1/embeddings',
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.secret_text,
},
url: `${baseUrl}/embeddings`,
headers,
body,
timeout: timeout ?? 30000,
});
Expand Down
39 changes: 19 additions & 20 deletions packages/pieces/community/mistral-ai/src/lib/actions/list-models.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import { createAction } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient, AuthenticationType } from '@activepieces/pieces-common';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { mistralAuth } from '../common/auth';
import { parseMistralError } from '../common/props';
import { mistralRequest } from '../common/request';

export const listModels = createAction({
auth: mistralAuth,
name: 'list_models',
auth: mistralAuth,
name: 'list_models',
displayName: 'List Models',
description: 'Retrieves a list of available Mistral AI models.',
props: {},
async run({ auth }) {
try {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: 'https://api.mistral.ai/v1/models',
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: auth.secret_text,
},
});

return response.body;
} catch (e: any) {
throw new Error(parseMistralError(e));
}
},
props: {},
async run({ auth }) {
try {
const { baseUrl, headers } = mistralRequest.getConfig(auth);
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${baseUrl}/models`,
headers,
});

return response.body;
} catch (e: any) {
throw new Error(parseMistralError(e));
}
},
});
Loading
Loading