Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(jina-ai): add AI actions and output schemas (#16011)

Kishan Parmar226fe1952afa
diff --git a/packages/pieces/community/jina-ai/package.json b/packages/pieces/community/jina-ai/package.json
index 0cc20bf0c44..8d09d960f51 100644
--- a/packages/pieces/community/jina-ai/package.json
+++ b/packages/pieces/community/jina-ai/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-jina-ai",
- "version": "0.1.7",
+ "version": "0.2.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/jina-ai/src/index.ts b/packages/pieces/community/jina-ai/src/index.ts
index bf609f658b0..fb141414944 100644
--- a/packages/pieces/community/jina-ai/src/index.ts
+++ b/packages/pieces/community/jina-ai/src/index.ts
@@ -5,9 +5,18 @@ import {
webSearchSummarizationAction,
deepSearchQueryAction,
classifyContentAction,
- trainCustomClassifierAction
+ trainCustomClassifierAction,
+ createEmbeddingsAction,
+ rerankDocumentsAction,
+ createBatchEmbeddingsAction,
+ getBatchAction,
+ listBatchesAction,
+ listModelsAction,
+ getModelAction,
} from './lib/actions';
import { jinaAiAuth } from './lib/auth';
+import { JinaAICommon } from './lib/common';
+import { createCustomApiCallAction } from '@activepieces/pieces-common';
const markdownDescription = `
You can get your API key from [Jina AI](https://jina.ai).
@@ -17,7 +26,7 @@ export const jinaAi = createPiece({
displayName: 'Jina AI',
description: 'AI-powered web content extraction, search, and classification',
auth: jinaAiAuth,
- minimumSupportedRelease: '0.36.1',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/jinaai.jpeg',
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],
authors: ['denieler'],
@@ -27,6 +36,20 @@ export const jinaAi = createPiece({
deepSearchQueryAction,
classifyContentAction,
trainCustomClassifierAction,
+ createEmbeddingsAction,
+ rerankDocumentsAction,
+ createBatchEmbeddingsAction,
+ getBatchAction,
+ listBatchesAction,
+ listModelsAction,
+ getModelAction,
+ createCustomApiCallAction({
+ auth: jinaAiAuth,
+ baseUrl: () => JinaAICommon.baseUrl,
+ authMapping: async (auth) => ({
+ Authorization: `Bearer ${auth.secret_text}`,
+ }),
+ }),
],
triggers: [],
});
\ No newline at end of file
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/create-batch-embeddings.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/create-batch-embeddings.ts
new file mode 100644
index 00000000000..e4ee67f7e6d
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/create-batch-embeddings.ts
@@ -0,0 +1,84 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiCreateBatchEmbeddingsOutputSchema } from '../../output-schemas';
+
+const parseJsonLines = ({ lines }: { lines: string[] }): Record<string, unknown>[] =>
+ lines.map((line, index) => {
+ try {
+ const parsed: unknown = JSON.parse(line);
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
+ throw new Error('not an object');
+ }
+ return Object.fromEntries(Object.entries(parsed));
+ } catch {
+ throw new Error(`Input line ${index + 1} must be a JSON object.`);
+ }
+ });
+
+export const createBatchEmbeddingsAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_create_batch_embeddings',
+ outputSchema: jinaAiCreateBatchEmbeddingsOutputSchema,
+ displayName: 'Create Batch Embeddings',
+ description: 'Start an asynchronous batch embedding job.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Start an asynchronous batch embedding job for large inputs, from inline JSONL lines or an input file URL (provide exactly one); each line must be a JSON object with custom_id and body.input; returns a batch id and status immediately. Not idempotent: each call starts a new job. Poll with Get Batch, which returns the status and the output file URL once the job completes.',
+ idempotent: false,
+ },
+ props: {
+ model: Property.ShortText({
+ displayName: 'Model',
+ description: 'Embedding model id, for example jina-embeddings-v5-text-small or jina-embeddings-v5-text-nano.',
+ required: true,
+ defaultValue: 'jina-embeddings-v5-text-small',
+ }),
+ input: Property.Array({
+ displayName: 'Inline Input Lines',
+ description: 'JSONL lines for small batches, one JSON object per item in the form {"custom_id": "id-1", "body": {"input": "your text"}}. Provide this or an Input URL, not both.',
+ required: false,
+ }),
+ inputUrl: Property.ShortText({
+ displayName: 'Input URL',
+ description: 'URL of a JSONL input file (GCS, S3 or HTTP). Provide this or inline lines, not both.',
+ required: false,
+ }),
+ task: Property.ShortText({
+ displayName: 'Task',
+ description: 'Task optimization: retrieval, text-matching, clustering or classification.',
+ required: false,
+ }),
+ dimensions: Property.Number({
+ displayName: 'Dimensions',
+ description: 'Number of dimensions of each output vector. Leave empty for the model default.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { model, input, inputUrl, task, dimensions } = context.propsValue;
+ const lines = JinaAICommon.toStringList({ values: input, label: 'Input line' });
+ if (lines.length > 0 && inputUrl) {
+ throw new Error('Provide either inline input lines or an Input URL, not both.');
+ }
+ if (lines.length === 0 && !inputUrl) {
+ throw new Error('Provide inline input lines or an Input URL.');
+ }
+ const parsedLines = parseJsonLines({ lines });
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({ path: '/batch/embeddings' }),
+ method: HttpMethod.POST,
+ auth: context.auth.secret_text,
+ body: {
+ model,
+ ...(lines.length > 0 ? { input: parsedLines } : { input_url: inputUrl }),
+ ...(task ? { task } : {}),
+ ...(typeof dimensions === 'number' ? { dimensions } : {}),
+ },
+ });
+ return response;
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/create-embeddings.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/create-embeddings.ts
new file mode 100644
index 00000000000..805756340f7
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/create-embeddings.ts
@@ -0,0 +1,62 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiCreateEmbeddingsOutputSchema } from '../../output-schemas';
+
+export const createEmbeddingsAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_create_embeddings',
+ outputSchema: jinaAiCreateEmbeddingsOutputSchema,
+ displayName: 'Create Embeddings',
+ description: 'Convert text into embedding vectors.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Convert one or more text strings into embedding vectors with a Jina embedding model; use it to prepare text for semantic search, clustering or similarity. Stateless compute with no side effects. For thousands of texts use Create Batch Embeddings instead, and use List Models to see available models.',
+ idempotent: true,
+ },
+ props: {
+ model: Property.ShortText({
+ displayName: 'Model',
+ description: 'Embedding model id, for example jina-embeddings-v5-text-small. List Models returns valid ids.',
+ required: true,
+ defaultValue: 'jina-embeddings-v5-text-small',
+ }),
+ input: Property.Array({
+ displayName: 'Texts',
+ description: 'The texts to embed, one per item.',
+ required: true,
+ }),
+ task: Property.ShortText({
+ displayName: 'Task',
+ description: 'Task optimization, for example retrieval.query, retrieval.passage, text-matching, classification or separation.',
+ required: false,
+ }),
+ dimensions: Property.Number({
+ displayName: 'Dimensions',
+ description: 'Number of dimensions of each output vector. Leave empty for the model default.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { model, input, task, dimensions } = context.propsValue;
+ const texts = JinaAICommon.toStringList({ values: input, label: 'Text' });
+ if (texts.length === 0) {
+ throw new Error('Provide at least one text to embed.');
+ }
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({ path: '/embeddings' }),
+ method: HttpMethod.POST,
+ auth: context.auth.secret_text,
+ body: {
+ model,
+ input: texts,
+ ...(task ? { task } : {}),
+ ...(typeof dimensions === 'number' ? { dimensions } : {}),
+ },
+ });
+ return response;
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/get-batch.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/get-batch.ts
new file mode 100644
index 00000000000..9876262e1cc
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/get-batch.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiGetBatchOutputSchema } from '../../output-schemas';
+
+export const getBatchAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_get_batch',
+ outputSchema: jinaAiGetBatchOutputSchema,
+ displayName: 'Get Batch',
+ description: 'Get the status of a batch embedding job.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read the current status, stats and output file URLs of a batch embedding job by id. Poll this after Create Batch Embeddings until the status is terminal; it never waits.',
+ idempotent: true,
+ },
+ props: {
+ batchId: Property.ShortText({
+ displayName: 'Batch ID',
+ description: 'Id of the batch job, returned by Create Batch Embeddings or List Batches.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({
+ path: `/batch/${encodeURIComponent(context.propsValue.batchId)}`,
+ }),
+ method: HttpMethod.GET,
+ auth: context.auth.secret_text,
+ });
+ return response;
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/get-model.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/get-model.ts
new file mode 100644
index 00000000000..962d64b2d20
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/get-model.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiGetModelOutputSchema } from '../../output-schemas';
+
+export const getModelAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_get_model',
+ outputSchema: jinaAiGetModelOutputSchema,
+ displayName: 'Get Model',
+ description: 'Get details of a Jina model.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Read the details of one Jina model by id, including context length, modalities and pricing. Get the id from List Models.',
+ idempotent: true,
+ },
+ props: {
+ modelId: Property.ShortText({
+ displayName: 'Model ID',
+ description: 'Id of the model, returned by List Models.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({
+ path: `/models/${encodeURIComponent(context.propsValue.modelId)}`,
+ }),
+ method: HttpMethod.GET,
+ auth: context.auth.secret_text,
+ });
+ return response;
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/list-batches.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/list-batches.ts
new file mode 100644
index 00000000000..ede5805f200
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/list-batches.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiListBatchesOutputSchema } from '../../output-schemas';
+
+export const listBatchesAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_list_batches',
+ outputSchema: jinaAiListBatchesOutputSchema,
+ displayName: 'List Batches',
+ description: 'List batch embedding jobs.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List recent batch embedding jobs with their ids and statuses; use it to find a batch id for Get Batch.',
+ idempotent: true,
+ },
+ props: {
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of jobs to return.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { limit } = context.propsValue;
+ const query = typeof limit === 'number' ? `?limit=${Math.floor(limit)}` : '';
+ const batches = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({ path: `/batches${query}` }),
+ method: HttpMethod.GET,
+ auth: context.auth.secret_text,
+ });
+ return { batches, count: Array.isArray(batches) ? batches.length : 0 };
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/list-models.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/list-models.ts
new file mode 100644
index 00000000000..2ebb7249342
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/list-models.ts
@@ -0,0 +1,30 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiListModelsOutputSchema } from '../../output-schemas';
+
+export const listModelsAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_list_models',
+ outputSchema: jinaAiListModelsOutputSchema,
+ displayName: 'List Models',
+ description: 'List available Jina models.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'List the models available on the Jina API with ids, context lengths and pricing; use it to find a valid model id for embeddings, reranking or batch jobs.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({ path: '/models' }),
+ method: HttpMethod.GET,
+ auth: context.auth.secret_text,
+ });
+ const models = Array.isArray(response?.data) ? response.data : [];
+ return { models, count: models.length };
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/ai/rerank-documents.ts b/packages/pieces/community/jina-ai/src/lib/actions/ai/rerank-documents.ts
new file mode 100644
index 00000000000..90577067054
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/actions/ai/rerank-documents.ts
@@ -0,0 +1,69 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { JinaAICommon } from '../../common';
+import { jinaAiAuth } from '../../auth';
+import { jinaAiRerankDocumentsOutputSchema } from '../../output-schemas';
+
+export const rerankDocumentsAction = createAction({
+ auth: jinaAiAuth,
+ name: 'jina_ai_rerank_documents',
+ outputSchema: jinaAiRerankDocumentsOutputSchema,
+ displayName: 'Rerank Documents',
+ description: 'Rank documents by relevance to a query.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Rank a list of text documents by relevance to a query using a Jina reranker model; returns each document index with a relevance score, best first. Use it to reorder search or retrieval results. Stateless compute with no side effects.',
+ idempotent: true,
+ },
+ props: {
+ model: Property.ShortText({
+ displayName: 'Model',
+ description: 'Reranker model id, for example jina-reranker-v3. List Models returns valid ids.',
+ required: true,
+ defaultValue: 'jina-reranker-v3',
+ }),
+ query: Property.LongText({
+ displayName: 'Query',
+ description: 'The query to rank the documents against.',
+ required: true,
+ }),
+ documents: Property.Array({
+ displayName: 'Documents',
+ description: 'The texts to rank, one per item.',
+ required: true,
+ }),
+ topN: Property.Number({
+ displayName: 'Top N',
+ description: 'Number of best results to return. Leave empty to return all documents.',
+ required: false,
+ }),
+ returnDocuments: Property.Checkbox({
+ displayName: 'Return Documents',
+ description: 'Include the document text in each result.',
+ required: false,
+ defaultValue: true,
+ }),
+ },
+ async run(context) {
+ const { model, query, documents, topN, returnDocuments } = context.propsValue;
+ const texts = JinaAICommon.toStringList({ values: documents, label: 'Document' });
+ if (texts.length === 0) {
+ throw new Error('Provide at least one document to rank.');
+ }
+ const response = await JinaAICommon.makeRequest({
+ url: JinaAICommon.apiUrl({ path: '/rerank' }),
+ method: HttpMethod.POST,
+ auth: context.auth.secret_text,
+ body: {
+ model,
+ query,
+ documents: texts,
+ ...(typeof topN === 'number' ? { top_n: topN } : {}),
+ return_documents: returnDocuments ?? true,
+ },
+ });
+ return response;
+ },
+});
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/classify-content.ts b/packages/pieces/community/jina-ai/src/lib/actions/classify-content.ts
index c1e522399bd..0f47574ab8a 100644
--- a/packages/pieces/community/jina-ai/src/lib/actions/classify-content.ts
+++ b/packages/pieces/community/jina-ai/src/lib/actions/classify-content.ts
@@ -2,10 +2,12 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { JinaAICommon } from '../common';
import { jinaAiAuth } from '../auth';
+import { classifyContentOutputSchema } from '../output-schemas';
export const classifyContentAction = createAction({
auth:jinaAiAuth,
name: 'classify_content',
+ outputSchema: classifyContentOutputSchema,
classification: 'READ',
displayName: 'Classify Text or Image',
description:
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/deepsearch-query.ts b/packages/pieces/community/jina-ai/src/lib/actions/deepsearch-query.ts
index 9cc0c66520f..f0c482ac75e 100644
--- a/packages/pieces/community/jina-ai/src/lib/actions/deepsearch-query.ts
+++ b/packages/pieces/community/jina-ai/src/lib/actions/deepsearch-query.ts
@@ -2,10 +2,12 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { JinaAICommon } from '../common';
import { jinaAiAuth } from '../auth';
+import { deepsearchQueryOutputSchema } from '../output-schemas';
export const deepSearchQueryAction = createAction({
auth:jinaAiAuth,
name: 'deepsearch_query',
+ outputSchema: deepsearchQueryOutputSchema,
classification: 'READ',
displayName: 'DeepSearch Query',
description:
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/extract-webpage-content.ts b/packages/pieces/community/jina-ai/src/lib/actions/extract-webpage-content.ts
index 0808171a3c6..0cdc6d51c1f 100644
--- a/packages/pieces/community/jina-ai/src/lib/actions/extract-webpage-content.ts
+++ b/packages/pieces/community/jina-ai/src/lib/actions/extract-webpage-content.ts
@@ -2,10 +2,12 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { JinaAICommon } from '../common';
import { jinaAiAuth } from '../auth';
+import { extractWebpageContentOutputSchema } from '../output-schemas';
export const extractWebpageContentAction = createAction({
auth:jinaAiAuth,
name: 'extract_webpage_content',
+ outputSchema: extractWebpageContentOutputSchema,
classification: 'READ',
displayName: 'Extract Webpage Content',
description:
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/index.ts b/packages/pieces/community/jina-ai/src/lib/actions/index.ts
index beda9c04282..e8224ac6e70 100644
--- a/packages/pieces/community/jina-ai/src/lib/actions/index.ts
+++ b/packages/pieces/community/jina-ai/src/lib/actions/index.ts
@@ -3,3 +3,10 @@ export * from './web-search-summarization';
export * from './deepsearch-query';
export * from './classify-content';
export * from './train-custom-classifier';
+export * from './ai/create-embeddings';
+export * from './ai/rerank-documents';
+export * from './ai/create-batch-embeddings';
+export * from './ai/get-batch';
+export * from './ai/list-batches';
+export * from './ai/list-models';
+export * from './ai/get-model';
diff --git a/packages/pieces/community/jina-ai/src/lib/actions/web-search-summarization.ts b/packages/pieces/community/jina-ai/src/lib/actions/web-search-summarization.ts
index dff65197d4c..123b92d4501 100644
--- a/packages/pieces/community/jina-ai/src/lib/actions/web-search-summarization.ts
+++ b/packages/pieces/community/jina-ai/src/lib/actions/web-search-summarization.ts
@@ -2,10 +2,12 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { JinaAICommon } from '../common';
import { jinaAiAuth } from '../auth';
+import { webSearchSummarizationOutputSchema } from '../output-schemas';
export const webSearchSummarizationAction = createAction({
auth:jinaAiAuth,
name: 'web_search_summarization',
+ outputSchema: webSearchSummarizationOutputSchema,
classification: 'SEARCH',
displayName: 'Web Search Summarization',
description:
diff --git a/packages/pieces/community/jina-ai/src/lib/common/index.ts b/packages/pieces/community/jina-ai/src/lib/common/index.ts
index e820b2c90e2..7fce44232b6 100644
--- a/packages/pieces/community/jina-ai/src/lib/common/index.ts
+++ b/packages/pieces/community/jina-ai/src/lib/common/index.ts
@@ -10,6 +10,22 @@ export const JinaAICommon = {
classifierUrl: 'https://api.jina.ai/v1/classify',
classifierTrainUrl: 'https://api.jina.ai/v1/train',
+ toStringList({ values, label }: { values: unknown; label: string }): string[] {
+ if (!Array.isArray(values)) {
+ return [];
+ }
+ return values.map((value, index) => {
+ if (typeof value !== 'string' || value.trim().length === 0) {
+ throw new Error(`${label} ${index + 1} must be a non-empty text.`);
+ }
+ return value;
+ });
+ },
+
+ apiUrl({ path }: { path: string }): string {
+ return `${JinaAICommon.baseUrl}${path}`;
+ },
+
async makeRequest({
url,
method,
diff --git a/packages/pieces/community/jina-ai/src/lib/output-schemas.ts b/packages/pieces/community/jina-ai/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..54065a3e257
--- /dev/null
+++ b/packages/pieces/community/jina-ai/src/lib/output-schemas.ts
@@ -0,0 +1,273 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+export const jinaAiCreateBatchEmbeddingsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'batch_id', label: 'Batch ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'model', label: 'Model' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+ ],
+};
+
+export const jinaAiGetBatchOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'batch_id', label: 'Batch ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'model', label: 'Model' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'completed_at', label: 'Completed At', format: 'datetime' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+ { key: 'error', label: 'Error' },
+ ],
+};
+
+export const jinaAiListBatchesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'batches',
+ label: 'Batches',
+ labelKey: 'batch_id',
+ listItems: [
+ { key: 'batch_id', label: 'Batch ID' },
+ { key: 'status', label: 'Status' },
+ { key: 'model', label: 'Model' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'completed_at', label: 'Completed At', format: 'datetime' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+ { key: 'error', label: 'Error' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const classifyContentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'label', label: 'Label' },
+ ],
+};
+
+export const deepsearchQueryOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'result', label: 'Result', value: '' },
+ ],
+};
+
+export const jinaAiCreateEmbeddingsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'model', label: 'Model' },
+ { key: 'object', label: 'Object' },
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'total_tokens', label: 'Total Tokens', format: 'number' },
+ ],
+ },
+ {
+ key: 'data',
+ label: 'Embeddings',
+ listItems: [
+ { key: 'object', label: 'Object' },
+ { key: 'index', label: 'Index', format: 'number' },
+ { key: 'embedding', label: 'Embedding Vector' },
+ ],
+ },
+ ],
+};
+
+export const extractWebpageContentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'code', label: 'Code', format: 'number' },
+ { key: 'status', label: 'Status', format: 'number' },
+ {
+ key: 'data',
+ label: 'Data',
+ children: [
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'content', label: 'Content' },
+ { key: 'warning', label: 'Warning' },
+ { key: 'metadata', label: 'Metadata' },
+ { key: 'httpStatus', label: 'Http Status', format: 'number' },
+ { key: 'httpStatusText', label: 'Http Status Text' },
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'outputTokens', label: 'Output Tokens', format: 'number' },
+ { key: 'measuredTokens', label: 'Measured Tokens', format: 'number' },
+ { key: 'scaledTokens', label: 'Scaled Tokens', format: 'number' },
+ { key: 'tokens', label: 'Tokens', format: 'number' },
+ ],
+ },
+ ],
+ },
+ {
+ key: 'meta',
+ label: 'Meta',
+ children: [
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'outputTokens', label: 'Output Tokens', format: 'number' },
+ { key: 'measuredTokens', label: 'Measured Tokens', format: 'number' },
+ { key: 'scaledTokens', label: 'Scaled Tokens', format: 'number' },
+ { key: 'tokens', label: 'Tokens', format: 'number' },
+ ],
+ },
+ ],
+ },
+ ],
+};
+
+export const jinaAiGetModelOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'hugging_face_id', label: 'Hugging Face ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'created', label: 'Created', format: 'number' },
+ { key: 'input_modalities', label: 'Input Modalities' },
+ { key: 'output_modalities', label: 'Output Modalities' },
+ { key: 'quantization', label: 'Quantization' },
+ { key: 'context_length', label: 'Context Length', format: 'number' },
+ { key: 'max_output_length', label: 'Max Output Length', format: 'number' },
+ {
+ key: 'pricing',
+ label: 'Pricing',
+ children: [
+ { key: 'prompt', label: 'Prompt' },
+ { key: 'completion', label: 'Completion' },
+ { key: 'image', label: 'Image' },
+ { key: 'request', label: 'Request' },
+ { key: 'input_cache_read', label: 'Input Cache Read' },
+ { key: 'input_cache_write', label: 'Input Cache Write' },
+ ],
+ },
+ { key: 'supported_sampling_parameters', label: 'Supported Sampling Parameters' },
+ { key: 'supported_features', label: 'Supported Features' },
+ { key: 'description', label: 'Description' },
+ {
+ key: 'datacenters',
+ label: 'Datacenters',
+ listItems: [
+ { key: 'country_code', label: 'Country Code' },
+ ],
+ },
+ ],
+};
+
+export const jinaAiListModelsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'models',
+ label: 'Models',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'hugging_face_id', label: 'Hugging Face ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'created', label: 'Created', format: 'number' },
+ { key: 'input_modalities', label: 'Input Modalities' },
+ { key: 'output_modalities', label: 'Output Modalities' },
+ { key: 'quantization', label: 'Quantization' },
+ { key: 'context_length', label: 'Context Length', format: 'number' },
+ { key: 'max_output_length', label: 'Max Output Length', format: 'number' },
+ {
+ key: 'pricing',
+ label: 'Pricing',
+ children: [
+ { key: 'prompt', label: 'Prompt' },
+ { key: 'completion', label: 'Completion' },
+ { key: 'image', label: 'Image' },
+ { key: 'request', label: 'Request' },
+ { key: 'input_cache_read', label: 'Input Cache Read' },
+ { key: 'input_cache_write', label: 'Input Cache Write' },
+ ],
+ },
+ { key: 'supported_sampling_parameters', label: 'Supported Sampling Parameters' },
+ { key: 'supported_features', label: 'Supported Features' },
+ { key: 'description', label: 'Description' },
+ {
+ key: 'datacenters',
+ label: 'Datacenters',
+ listItems: [
+ { key: 'country_code', label: 'Country Code' },
+ ],
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const jinaAiRerankDocumentsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'model', label: 'Model' },
+ { key: 'object', label: 'Object' },
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'total_tokens', label: 'Total Tokens', format: 'number' },
+ ],
+ },
+ {
+ key: 'results',
+ label: 'Ranked Results',
+ listItems: [
+ { key: 'index', label: 'Index', format: 'number' },
+ { key: 'relevance_score', label: 'Relevance Score', format: 'number' },
+ {
+ key: 'document',
+ label: 'Document',
+ children: [
+ { key: 'text', label: 'Text' },
+ ],
+ },
+ ],
+ },
+ ],
+};
+
+export const webSearchSummarizationOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'code', label: 'Code', format: 'number' },
+ { key: 'status', label: 'Status', format: 'number' },
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'title',
+ listItems: [
+ { key: 'title', label: 'Title' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'description', label: 'Description' },
+ { key: 'content', label: 'Content' },
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'tokens', label: 'Tokens', format: 'number' },
+ ],
+ },
+ { key: 'date', label: 'Date' },
+ ],
+ },
+ {
+ key: 'meta',
+ label: 'Meta',
+ children: [
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ { key: 'tokens', label: 'Tokens', format: 'number' },
+ ],
+ },
+ ],
+ },
+ ],
+};