Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": ["../../../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-grok-xai
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-grok-xai` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-grok-xai",
|
||||
"version": "0.0.7",
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "pieces-grok-xai",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/grok-xai/src",
|
||||
"projectType": "library",
|
||||
"release": {
|
||||
"version": {
|
||||
"manifestRootsToUpdate": [
|
||||
"dist/{projectRoot}"
|
||||
],
|
||||
"currentVersionResolver": "git-tag",
|
||||
"fallbackCurrentVersionResolver": "disk"
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/grok-xai",
|
||||
"tsConfig": "packages/pieces/community/grok-xai/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/grok-xai/package.json",
|
||||
"main": "packages/pieces/community/grok-xai/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/grok-xai/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/grok-xai/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"nx-release-publish": {
|
||||
"options": {
|
||||
"packageRoot": "dist/{projectRoot}"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/grok-xai",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "KI Chatbot von xAI, der Fragen beantwortet, Text generiert, Daten extrahiert und Einblicke in Echtzeit bietet.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Groke fragen",
|
||||
"Extract Data From Text": "Daten aus Text extrahieren",
|
||||
"Categorize Text": "Text kategorisieren",
|
||||
"Generate Image": "Bild generieren",
|
||||
"Custom API Call": "Eigener API-Aufruf",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Senden Sie Eingabeaufforderungen an Grok mit Echtzeit-Suche, Tools und strukturierten Ausgängen.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extrahieren Sie strukturierte Datenfelder aus unstrukturiertem Text (z.B. Namen, Adressen, Datum).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Zuweisen von Kategorien auf der Basis benutzerdefinierter oder vordefinierter Beschriftungen.",
|
||||
"Create images from text prompts using Grok's image generation.": "Erstellen Sie Bilder aus Text-Eingabeaufforderungen mit Groks Bildgeneration.",
|
||||
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
|
||||
"Model": "Modell",
|
||||
"Messages": "Nachrichten",
|
||||
"Quick Prompt (Alternative)": "Schnelle Anfrage (Alternative)",
|
||||
"System Instructions": "Systeminstruktionen",
|
||||
"Image URL (Optional)": "Bild-URL (optional)",
|
||||
"Temperature": "Temperatur",
|
||||
"Max Completion Tokens": "Max. Abschluss-Token",
|
||||
"Response Format": "Antwortformat",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Real-Time-Suche aktivieren",
|
||||
"Search Mode": "Suchmodus",
|
||||
"Max Search Results": "Max. Suchergebnisse",
|
||||
"Search Sources": "Suchquellen",
|
||||
"Tools/Functions": "Tools/Funktionen",
|
||||
"Tool Choice": "Werkzeugauswahl",
|
||||
"Parallel Tool Calls": "Parallele Werkzeugaufrufe",
|
||||
"Reasoning Effort": "Grund dafür",
|
||||
"Memory Key": "Speicherschlüssel",
|
||||
"Text to Extract From": "Zu extrahierender Text",
|
||||
"Extraction Instructions": "Anweisungen zur Extraktion",
|
||||
"Fields to Extract": "Zu extrahierende Felder",
|
||||
"Enable Context Search": "Kontext-Suche aktivieren",
|
||||
"Strict Extraction": "Strenge Extraktion",
|
||||
"Include Confidence Scores": "Vertrauenspunkte einbeziehen",
|
||||
"Text to Categorize": "Zu kategorisierender Text",
|
||||
"Categories": "Kategorien",
|
||||
"Allow Multiple Categories": "Mehrere Kategorien erlauben",
|
||||
"Custom Instructions": "Eigene Anweisungen",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Bild Modell",
|
||||
"Number of Images": "Anzahl der Bilder",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopfzeilen",
|
||||
"Query Parameters": "Abfrageparameter",
|
||||
"Body": "Körper",
|
||||
"Response is Binary ?": "Antwort ist binär?",
|
||||
"No Error on Failure": "Kein Fehler bei Fehler",
|
||||
"Timeout (in seconds)": "Timeout (in Sekunden)",
|
||||
"Grok model to use for generating the response.": "Grok Modell zum Generieren der Antwort.",
|
||||
"Conversation messages for multi-turn conversations.": "Konversationsnachrichten für mehrwendige Gespräche.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Einfache Text-Abfrage für Einzelgespräche. Ignoriert wenn Nachrichten bereitgestellt werden.",
|
||||
"System message to set behavior and context.": "Systemmeldung, um Verhalten und Kontext festzulegen.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "Bild-URL für Vision-Modelle. Funktioniert mit Schnellabfragemodus.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Kontrolliert Zufallsreichtum (0-2): 0 = deterministisch, 1 = ausgeglichen, 2 = kreativ.",
|
||||
"Maximum tokens for the response.": "Maximale Anzahl an Token für die Antwort.",
|
||||
"Output format for the response.": "Ausgabeformat für die Antwort.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON-Schema für strukturierte Ausgabe (wenn Antwortformat json_schema ist).",
|
||||
"Allow Grok to search the web and X for current information.": "Grok erlaubt das Durchsuchen von Web und X nach aktuellen Informationen.",
|
||||
"How to handle real-time data search.": "Wie man mit der Echtzeit-Datensuche umgeht.",
|
||||
"Maximum number of search results to use (1-30).": "Maximale Anzahl der zu verwendenden Suchergebnisse (1-30).",
|
||||
"Sources to search in.": "Zu suchende Quellen.",
|
||||
"Functions the model can call.": "Funktionen, die das Modell aufrufen kann.",
|
||||
"How the model should use tools.": "Wie das Modell Werkzeuge verwenden soll.",
|
||||
"Allow model to call multiple tools simultaneously.": "Modell erlauben, mehrere Werkzeuge gleichzeitig aufzurufen.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Wie schwer argumentierende Modelle sollten denken (nicht für Grok-4).",
|
||||
"Keep conversation history across runs.": "Unterhaltungshistorie auf allen Läufen behalten.",
|
||||
"Grok model to use for data extraction.": "Grok Modell für die Datenextrahierung.",
|
||||
"Text to extract data from.": "Text aus dem Daten extrahiert werden.",
|
||||
"How to extract the data.": "Wie man die Daten extrahiert.",
|
||||
"Define the structured fields to extract from the text.": "Definieren Sie die strukturierten Felder, die aus dem Text extrahiert werden sollen.",
|
||||
"Search for additional context to improve extraction.": "Suche nach zusätzlichem Kontext, um die Extraktion zu verbessern.",
|
||||
"Only extract explicitly present information.": "Extrahieren Sie nur explizit vorhandene Informationen.",
|
||||
"How thoroughly to analyze the text.": "Wie gründlich zu analysieren, den Text.",
|
||||
"Include confidence scores for extracted fields.": "Fügen Sie Vertrauenspunkte für extrahierte Felder ein.",
|
||||
"Grok model to use for text categorization.": "Grok-Modell für Textkategorisierung.",
|
||||
"Text content to categorize.": "Textinhalt zu kategorisieren.",
|
||||
"Define the categories for classification.": "Definieren Sie die Kategorien für die Klassifizierung.",
|
||||
"Text can be assigned to multiple categories.": "Text kann mehreren Kategorien zugewiesen werden.",
|
||||
"Include confidence scores for each category.": "Fügen Sie Konfidenzwerte für jede Kategorie ein.",
|
||||
"Additional instructions for categorization.": "Zusätzliche Anweisungen zur Kategorisierung.",
|
||||
"Search for additional context to improve categorization.": "Suche nach zusätzlichem Kontext, um die Kategorisierung zu verbessern.",
|
||||
"Detailed description of the image you want to generate.": "Detaillierte Beschreibung des Bildes, das Sie generieren möchten.",
|
||||
"Image generation model to use.": "Zu verwendendes Bildgenerierungsmodell.",
|
||||
"Number of images to generate (1-10).": "Anzahl der zu generierenden Bilder (1-10).",
|
||||
"Format of the generated images.": "Format der generierten Bilder.",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
|
||||
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
|
||||
"Text": "Text",
|
||||
"JSON Object": "JSON-Objekt",
|
||||
"Auto (Model decides)": "Auto (Modell entscheidet)",
|
||||
"Always Search": "Immer suchen",
|
||||
"Never Search": "Niemals suchen",
|
||||
"None (No tools)": "Keine (keine Werkzeuge)",
|
||||
"Required (Must use tool)": "Benötigt (Must use tool)",
|
||||
"Default": "Standard",
|
||||
"Low (Fewer tokens)": "Niedrig (weniger Tokens)",
|
||||
"High (More tokens)": "Hoch (mehr Token)",
|
||||
"Low (Quick extraction)": "Niedrig (Schnellextrahierung)",
|
||||
"High (Deep analysis)": "Hoch (Tiefe Analyse)",
|
||||
"Low (Quick analysis)": "Niedrig (Schnellanalyse)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "ERHALTEN",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "LÖSCHEN",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot de xAI que responde a preguntas, genera texto, extrae datos y proporciona información en tiempo real.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Preguntar Grok",
|
||||
"Extract Data From Text": "Extraer datos desde texto",
|
||||
"Categorize Text": "Categorizar texto",
|
||||
"Generate Image": "Generar imagen",
|
||||
"Custom API Call": "Llamada API personalizada",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Enviar peticiones a Grok con búsqueda, herramientas y salidas estructuradas en tiempo real.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extraer campos de datos estructurados del texto no estructurado (por ejemplo, nombres, direcciones, fechas).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Asignar categorías para introducir texto basado en etiquetas personalizadas o predefinidas.",
|
||||
"Create images from text prompts using Grok's image generation.": "Crea imágenes a partir de instrucciones de texto usando la generación de imágenes de Grok.",
|
||||
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
|
||||
"Model": "Modelo",
|
||||
"Messages": "Mensajes",
|
||||
"Quick Prompt (Alternative)": "Asunto rápido (Alternativo)",
|
||||
"System Instructions": "Instrucciones del sistema",
|
||||
"Image URL (Optional)": "URL de la imagen (opcional)",
|
||||
"Temperature": "Temperatura",
|
||||
"Max Completion Tokens": "Máximas fichas de finalización",
|
||||
"Response Format": "Formato de respuesta",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Activar búsqueda en tiempo real",
|
||||
"Search Mode": "Modo de búsqueda",
|
||||
"Max Search Results": "Máximo de resultados de búsqueda",
|
||||
"Search Sources": "Buscar fuentes",
|
||||
"Tools/Functions": "Herramientas/Funciones",
|
||||
"Tool Choice": "Elección de herramienta",
|
||||
"Parallel Tool Calls": "Llamadas de Herramientas Paralelas",
|
||||
"Reasoning Effort": "Razonando Effort",
|
||||
"Memory Key": "Clave de memoria",
|
||||
"Text to Extract From": "Texto del que extraer",
|
||||
"Extraction Instructions": "Instrucciones de extracción",
|
||||
"Fields to Extract": "Campos a extraer",
|
||||
"Enable Context Search": "Habilitar búsqueda contextual",
|
||||
"Strict Extraction": "Extracción estricta",
|
||||
"Include Confidence Scores": "Incluye puntajes de confianza",
|
||||
"Text to Categorize": "Texto a categorizar",
|
||||
"Categories": "Categorías",
|
||||
"Allow Multiple Categories": "Permitir múltiples categorías",
|
||||
"Custom Instructions": "Instrucciones personalizadas",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Modelo de imagen",
|
||||
"Number of Images": "Número de imágenes",
|
||||
"Method": "Método",
|
||||
"Headers": "Encabezados",
|
||||
"Query Parameters": "Parámetros de consulta",
|
||||
"Body": "Cuerpo",
|
||||
"Response is Binary ?": "¿Respuesta es binaria?",
|
||||
"No Error on Failure": "No hay ningún error en fallo",
|
||||
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
|
||||
"Grok model to use for generating the response.": "Modelo Grok a usar para generar la respuesta.",
|
||||
"Conversation messages for multi-turn conversations.": "Mensajes de conversación para conversaciones multiturnas.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Sugerencia de texto simple para conversaciones de un solo giro. Ignorado si se proporcionan mensajes.",
|
||||
"System message to set behavior and context.": "Mensaje del sistema para establecer el comportamiento y el contexto.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "URL de imagen para modelos de visión. Funciona con el modo de prompt rápido.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Controles al azar (0-2): 0 = determinístico, 1 = equilibrado, 2 = creativo.",
|
||||
"Maximum tokens for the response.": "Máximas fichas para la respuesta.",
|
||||
"Output format for the response.": "Formato de salida para la respuesta.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "Esquema JSON para salida estructurada (cuando el formato de respuesta es json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Permite a Grok buscar en la web y X la información actual.",
|
||||
"How to handle real-time data search.": "Cómo manejar la búsqueda de datos en tiempo real.",
|
||||
"Maximum number of search results to use (1-30).": "Número máximo de resultados de búsqueda a usar (1-30).",
|
||||
"Sources to search in.": "Fuentes en las que buscar.",
|
||||
"Functions the model can call.": "Funciones que el modelo puede llamar.",
|
||||
"How the model should use tools.": "Cómo el modelo debe usar herramientas.",
|
||||
"Allow model to call multiple tools simultaneously.": "Permitir al modelo llamar varias herramientas simultáneamente.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Cuán difíciles deberían pensar los modelos de razonamiento (no para grok-4).",
|
||||
"Keep conversation history across runs.": "Mantener historial de conversaciones a través de ejecuciones.",
|
||||
"Grok model to use for data extraction.": "Modelo Grok a usar para la extracción de datos.",
|
||||
"Text to extract data from.": "Texto del que extraer datos.",
|
||||
"How to extract the data.": "Cómo extraer los datos.",
|
||||
"Define the structured fields to extract from the text.": "Definir los campos estructurados para extraer del texto.",
|
||||
"Search for additional context to improve extraction.": "Buscar contexto adicional para mejorar la extracción.",
|
||||
"Only extract explicitly present information.": "Sólo extraer información explícitamente presente.",
|
||||
"How thoroughly to analyze the text.": "Qué tan minucioso analizar el texto.",
|
||||
"Include confidence scores for extracted fields.": "Incluye puntos de confianza para los campos extraídos.",
|
||||
"Grok model to use for text categorization.": "Modelo Grok a usar para la categorización de texto.",
|
||||
"Text content to categorize.": "Contenido de texto a categorizar.",
|
||||
"Define the categories for classification.": "Definir las categorías para la clasificación.",
|
||||
"Text can be assigned to multiple categories.": "El texto puede ser asignado a múltiples categorías.",
|
||||
"Include confidence scores for each category.": "Incluye puntajes de confianza para cada categoría.",
|
||||
"Additional instructions for categorization.": "Instrucciones adicionales para la categorización.",
|
||||
"Search for additional context to improve categorization.": "Buscar contexto adicional para mejorar la categorización.",
|
||||
"Detailed description of the image you want to generate.": "Descripción detallada de la imagen que desea generar.",
|
||||
"Image generation model to use.": "Modelo de generación de imágenes a utilizar.",
|
||||
"Number of images to generate (1-10).": "Número de imágenes a generar (1-10).",
|
||||
"Format of the generated images.": "Formato de las imágenes generadas.",
|
||||
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
|
||||
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
|
||||
"Text": "Texto",
|
||||
"JSON Object": "Objeto JSON",
|
||||
"Auto (Model decides)": "Auto (Modelo decides)",
|
||||
"Always Search": "Buscar siempre",
|
||||
"Never Search": "Nunca buscar",
|
||||
"None (No tools)": "Ninguno (Sin herramientas)",
|
||||
"Required (Must use tool)": "Requerido (Debe usar herramienta)",
|
||||
"Default": "Por defecto",
|
||||
"Low (Fewer tokens)": "Baja (tokens)",
|
||||
"High (More tokens)": "Alto (Más fichas)",
|
||||
"Low (Quick extraction)": "Bajo (extracción rápida)",
|
||||
"High (Deep analysis)": "Alto (Análisis profundo)",
|
||||
"Low (Quick analysis)": "Bajo (Análisis rápido)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "JSON Base64",
|
||||
"GET": "RECOGER",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "BORRAR",
|
||||
"HEAD": "LIMPIO"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot par xAI qui répond aux questions, génère du texte, extrait des données et fournit des aperçus en temps réel.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Demander à Grok",
|
||||
"Extract Data From Text": "Extraire les données du texte",
|
||||
"Categorize Text": "Catégoriser le texte",
|
||||
"Generate Image": "Générer une image",
|
||||
"Custom API Call": "Appel API personnalisé",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Envoyez des messages à Grok avec des résultats de recherche en temps réel, des outils et des sorties structurées.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extraire les champs de données structurés du texte non structuré (par exemple, noms, adresses, dates).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Assigner des catégories au texte en entrée en fonction de libellés personnalisés ou prédéfinis.",
|
||||
"Create images from text prompts using Grok's image generation.": "Créez des images à partir des invites de texte en utilisant la génération d'image de Grok.",
|
||||
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
|
||||
"Model": "Modélisation",
|
||||
"Messages": "Messages",
|
||||
"Quick Prompt (Alternative)": "Invitation Rapide (Alternative)",
|
||||
"System Instructions": "Instructions système",
|
||||
"Image URL (Optional)": "URL de l'image (facultatif)",
|
||||
"Temperature": "Température",
|
||||
"Max Completion Tokens": "Maximum de jetons d'achèvement",
|
||||
"Response Format": "Format de réponse",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Activer la recherche en temps réel",
|
||||
"Search Mode": "Mode de recherche",
|
||||
"Max Search Results": "Nombre maximum de résultats de recherche",
|
||||
"Search Sources": "Rechercher des sources",
|
||||
"Tools/Functions": "Outils/Fonctions",
|
||||
"Tool Choice": "Choix des outils",
|
||||
"Parallel Tool Calls": "Appels de l'outil parallèle",
|
||||
"Reasoning Effort": "Effort de Raison",
|
||||
"Memory Key": "Clé de mémoire",
|
||||
"Text to Extract From": "Texte à extraire de",
|
||||
"Extraction Instructions": "Instructions d'extraction",
|
||||
"Fields to Extract": "Champs à extraire",
|
||||
"Enable Context Search": "Activer la recherche de contexte",
|
||||
"Strict Extraction": "Extraction stricte",
|
||||
"Include Confidence Scores": "Inclure les notes de confiance",
|
||||
"Text to Categorize": "Texte à catégoriser",
|
||||
"Categories": "Catégories",
|
||||
"Allow Multiple Categories": "Autoriser plusieurs catégories",
|
||||
"Custom Instructions": "Instructions personnalisées",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Modèle d'image",
|
||||
"Number of Images": "Nombre d'images",
|
||||
"Method": "Méthode",
|
||||
"Headers": "En-têtes",
|
||||
"Query Parameters": "Paramètres de requête",
|
||||
"Body": "Corps",
|
||||
"Response is Binary ?": "La réponse est Binaire ?",
|
||||
"No Error on Failure": "Aucune erreur en cas d'échec",
|
||||
"Timeout (in seconds)": "Délai d'attente (en secondes)",
|
||||
"Grok model to use for generating the response.": "Modèle Grok à utiliser pour générer la réponse.",
|
||||
"Conversation messages for multi-turn conversations.": "Messages de conversation pour les conversations multi-virages.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Demandes de texte simples pour les conversations en mode mono-virage. Ignorées si des messages sont fournis.",
|
||||
"System message to set behavior and context.": "Message système pour définir le comportement et le contexte.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "URL de l'image pour les modèles de vision. Fonctionne avec le mode rapide d'affichage.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Contrôle aléatoires (0-2): 0 = déterministe, 1 = équilibré, 2 = créatif.",
|
||||
"Maximum tokens for the response.": "Nombre maximum de jetons pour la réponse.",
|
||||
"Output format for the response.": "Format de sortie pour la réponse.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "Schéma JSON pour la sortie structurée (lorsque le format de réponse est json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Autoriser Grok à rechercher des informations courantes sur le web et X.",
|
||||
"How to handle real-time data search.": "Comment gérer la recherche de données en temps réel.",
|
||||
"Maximum number of search results to use (1-30).": "Nombre maximum de résultats de recherche à utiliser (1-30).",
|
||||
"Sources to search in.": "Sources de recherche.",
|
||||
"Functions the model can call.": "Fonctions que le modèle peut appeler.",
|
||||
"How the model should use tools.": "Comment le modèle doit utiliser des outils.",
|
||||
"Allow model to call multiple tools simultaneously.": "Autoriser le modèle à appeler plusieurs outils simultanément.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Comment les modèles de raisonnement difficile devraient penser (pas pour grok-4).",
|
||||
"Keep conversation history across runs.": "Conserver l'historique des conversations pendant les exécutions.",
|
||||
"Grok model to use for data extraction.": "Modèle Grok à utiliser pour l'extraction de données.",
|
||||
"Text to extract data from.": "Texte à partir duquel extraire les données.",
|
||||
"How to extract the data.": "Comment extraire les données.",
|
||||
"Define the structured fields to extract from the text.": "Définit les champs structurés à extraire du texte.",
|
||||
"Search for additional context to improve extraction.": "Rechercher un contexte supplémentaire pour améliorer l'extraction.",
|
||||
"Only extract explicitly present information.": "Extraire uniquement les informations présentes explicitement.",
|
||||
"How thoroughly to analyze the text.": "Comment analyser le texte en profondeur.",
|
||||
"Include confidence scores for extracted fields.": "Inclure les scores de confiance pour les champs extraits.",
|
||||
"Grok model to use for text categorization.": "Modèle Grok à utiliser pour la catégorisation du texte.",
|
||||
"Text content to categorize.": "Contenu du texte à catégoriser.",
|
||||
"Define the categories for classification.": "Définir les catégories pour la classification.",
|
||||
"Text can be assigned to multiple categories.": "Le texte peut être assigné à plusieurs catégories.",
|
||||
"Include confidence scores for each category.": "Inclure les scores de confiance pour chaque catégorie.",
|
||||
"Additional instructions for categorization.": "Instructions supplémentaires pour la catégorisation.",
|
||||
"Search for additional context to improve categorization.": "Rechercher un contexte supplémentaire pour améliorer la catégorisation.",
|
||||
"Detailed description of the image you want to generate.": "Description détaillée de l'image que vous voulez générer.",
|
||||
"Image generation model to use.": "Modèle de génération d'image à utiliser.",
|
||||
"Number of images to generate (1-10).": "Nombre d'images à générer (1-10).",
|
||||
"Format of the generated images.": "Format des images générées.",
|
||||
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
|
||||
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
|
||||
"Text": "Texte du texte",
|
||||
"JSON Object": "Objet JSON",
|
||||
"Auto (Model decides)": "Auto (le modèle décide)",
|
||||
"Always Search": "Toujours rechercher",
|
||||
"Never Search": "Ne jamais rechercher",
|
||||
"None (No tools)": "Aucun (aucun outil)",
|
||||
"Required (Must use tool)": "Requis (utiliser un outil)",
|
||||
"Default": "Par défaut",
|
||||
"Low (Fewer tokens)": "Bas (Moins de jetons)",
|
||||
"High (More tokens)": "Haut (Plus de jetons)",
|
||||
"Low (Quick extraction)": "Faible (extraction rapide)",
|
||||
"High (Deep analysis)": "Haute (analyse profonde)",
|
||||
"Low (Quick analysis)": "Faible (analyse rapide)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "JSON Base64",
|
||||
"GET": "OBTENIR",
|
||||
"POST": "POSTER",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "EFFACER",
|
||||
"DELETE": "SUPPRIMER",
|
||||
"HEAD": "TÊTE"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "xAIによるAIチャットボットは、質問に答え、テキストを生成し、データを抽出し、リアルタイムのインサイトを提供します。",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Grokに聞く",
|
||||
"Extract Data From Text": "テキストからデータを抽出",
|
||||
"Categorize Text": "テキストをカテゴリ化",
|
||||
"Generate Image": "画像を生成する",
|
||||
"Custom API Call": "カスタムAPI通話",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "リアルタイムの検索、ツール、構造化された出力でGrokにプロンプトを送信します。",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "構造化されていないテキスト(名前、アドレス、日付など)から構造化されたデータフィールドを抽出します。",
|
||||
"Assign categories to input text based on custom or predefined labels.": "カスタムまたは定義済みのラベルに基づいて入力テキストにカテゴリを割り当てます。",
|
||||
"Create images from text prompts using Grok's image generation.": "Grokの画像生成を使用してテキストプロンプトから画像を作成します。",
|
||||
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
|
||||
"Model": "モデル",
|
||||
"Messages": "メッセージ",
|
||||
"Quick Prompt (Alternative)": "クイックプロンプト(代替)",
|
||||
"System Instructions": "システムの説明",
|
||||
"Image URL (Optional)": "画像のURL(オプション)",
|
||||
"Temperature": "温度",
|
||||
"Max Completion Tokens": "最大完了トークン",
|
||||
"Response Format": "応答形式",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "リアルタイム検索を有効にする",
|
||||
"Search Mode": "検索モード",
|
||||
"Max Search Results": "最大検索結果",
|
||||
"Search Sources": "ソースを検索",
|
||||
"Tools/Functions": "ツール/関数",
|
||||
"Tool Choice": "ツールの選択",
|
||||
"Parallel Tool Calls": "並列ツール通話",
|
||||
"Reasoning Effort": "Reasoning Workfort",
|
||||
"Memory Key": "メモリーキー",
|
||||
"Text to Extract From": "抽出するテキスト",
|
||||
"Extraction Instructions": "抽出の手順",
|
||||
"Fields to Extract": "抽出するフィールド",
|
||||
"Enable Context Search": "コンテキスト検索を有効にする",
|
||||
"Strict Extraction": "厳密な抽出",
|
||||
"Include Confidence Scores": "信頼度の得点を含める",
|
||||
"Text to Categorize": "分類するテキスト",
|
||||
"Categories": "カテゴリ",
|
||||
"Allow Multiple Categories": "複数のカテゴリを許可する",
|
||||
"Custom Instructions": "カスタム説明",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "画像モデル",
|
||||
"Number of Images": "画像の数",
|
||||
"Method": "方法",
|
||||
"Headers": "ヘッダー",
|
||||
"Query Parameters": "クエリパラメータ",
|
||||
"Body": "本文",
|
||||
"Response is Binary ?": "応答はバイナリですか?",
|
||||
"No Error on Failure": "失敗時にエラーはありません",
|
||||
"Timeout (in seconds)": "タイムアウト(秒)",
|
||||
"Grok model to use for generating the response.": "応答の生成に使用するGrokモデル。",
|
||||
"Conversation messages for multi-turn conversations.": "マルチターン会話の会話メッセージ。",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "単純なテキストメッセージを表示します。メッセージが指定されている場合は無視されます。",
|
||||
"System message to set behavior and context.": "動作とコンテキストを設定するためのシステムメッセージ。",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "画像モデルのURLです。クイックプロンプトモードで動作します。",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "randomness (0-2): 0 = 確定, 1 = 平衡, 2 = クリエイティブ.",
|
||||
"Maximum tokens for the response.": "レスポンスの最大トークンです。",
|
||||
"Output format for the response.": "レスポンスの出力形式です。",
|
||||
"JSON schema for structured output (when response format is json_schema).": "構造化出力用 JSON スキーマ(レスポンスフォーマットが json_schema の場合)。",
|
||||
"Allow Grok to search the web and X for current information.": "Grokに現在の情報の検索を許可します。",
|
||||
"How to handle real-time data search.": "リアルタイムのデータ検索を処理する方法。",
|
||||
"Maximum number of search results to use (1-30).": "使用する検索結果の最大数(1-30)",
|
||||
"Sources to search in.": "検索するソース。",
|
||||
"Functions the model can call.": "モデルが呼び出せる関数。",
|
||||
"How the model should use tools.": "モデルがツールをどのように使うべきか。",
|
||||
"Allow model to call multiple tools simultaneously.": "モデルが複数のツールを同時に呼び出すことを許可します。",
|
||||
"How hard reasoning models should think (not for grok-4).": "考えるべき難しい推論モデル(grok-4ではありません)。",
|
||||
"Keep conversation history across runs.": "会話の履歴を実行中に保持します。",
|
||||
"Grok model to use for data extraction.": "データ抽出に使用するGrokモデル。",
|
||||
"Text to extract data from.": "データを抽出するテキスト。",
|
||||
"How to extract the data.": "データを抽出する方法。",
|
||||
"Define the structured fields to extract from the text.": "テキストから抽出する構造化フィールドを定義します。",
|
||||
"Search for additional context to improve extraction.": "抽出を改善するために追加のコンテキストを検索します。",
|
||||
"Only extract explicitly present information.": "明示的に存在する情報のみを抽出します。",
|
||||
"How thoroughly to analyze the text.": "どのように徹底的にテキストを分析する。",
|
||||
"Include confidence scores for extracted fields.": "抽出されたフィールドに信頼度のスコアを含めます。",
|
||||
"Grok model to use for text categorization.": "テキスト分類に使用するGrokモデル。",
|
||||
"Text content to categorize.": "分類するテキストコンテンツ。",
|
||||
"Define the categories for classification.": "分類のカテゴリを定義します。",
|
||||
"Text can be assigned to multiple categories.": "テキストは複数のカテゴリに割り当てることができます。",
|
||||
"Include confidence scores for each category.": "各カテゴリに信頼度を含めます。",
|
||||
"Additional instructions for categorization.": "分類のための追加の手順.",
|
||||
"Search for additional context to improve categorization.": "分類を改善するために追加のコンテキストを検索します。",
|
||||
"Detailed description of the image you want to generate.": "生成したい画像の詳細な説明。",
|
||||
"Image generation model to use.": "使用する画像生成モデル。",
|
||||
"Number of images to generate (1-10).": "生成する画像の数 (1-10)。",
|
||||
"Format of the generated images.": "生成された画像の書式。",
|
||||
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
|
||||
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
|
||||
"Text": "テキスト",
|
||||
"JSON Object": "JSON オブジェクト",
|
||||
"Auto (Model decides)": "自動 (モデル決定)",
|
||||
"Always Search": "常に検索",
|
||||
"Never Search": "検索しない",
|
||||
"None (No tools)": "なし (ツールなし)",
|
||||
"Required (Must use tool)": "必須(必須ツール)",
|
||||
"Default": "デフォルト",
|
||||
"Low (Fewer tokens)": "低い(少ない)",
|
||||
"High (More tokens)": "High (More tokens)",
|
||||
"Low (Quick extraction)": "低い (クイック抽出)",
|
||||
"High (Deep analysis)": "High (Deep analysis)",
|
||||
"Low (Quick analysis)": "Low (Quick analysis)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "取得",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "削除",
|
||||
"HEAD": "頭"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot door xAI die vragen beantwoordt, tekst genereert, gegevens extraheert en realtime inzichten biedt.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Ontvang je xAI API Key**\n\n1. Meld je aan bij [xAI](https://x.ai)\n2. Ga naar uw [API dashboard](https://console.x.ai)\n3. Genereer een nieuwe API-sleutel\n4. Kopieer en plak de sleutel hier\n\nUw API-sleutel moet beginnen met `xai-`\n ",
|
||||
"Ask Grok": "Vraag Grok",
|
||||
"Extract Data From Text": "Data uit tekst halen",
|
||||
"Categorize Text": "Tekst categoriseren",
|
||||
"Generate Image": "Afbeelding genereren",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Stuur aanwijzingen naar Grok met real-time zoeken, gereedschappen en gestructureerde uitvoer.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Verwijder gestructureerde gegevensvelden uit ongestructureerde tekst (bijv. namen, adressen, datum).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Wijs categorieën toe aan invoertekst op basis van aangepaste of vooraf gedefinieerde labels.",
|
||||
"Create images from text prompts using Grok's image generation.": "Maak afbeeldingen van tekst prompts met behulp van Grok afbeelding generatie.",
|
||||
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
|
||||
"Model": "Model",
|
||||
"Messages": "berichten",
|
||||
"Quick Prompt (Alternative)": "Snelle vraag (Alternatief)",
|
||||
"System Instructions": "Systeem instructies",
|
||||
"Image URL (Optional)": "Afbeelding URL (optioneel)",
|
||||
"Temperature": "Temperatuur",
|
||||
"Max Completion Tokens": "Max voltooiingstokens",
|
||||
"Response Format": "Antwoord formaat",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Real-time zoeken inschakelen",
|
||||
"Search Mode": "Zoek modus",
|
||||
"Max Search Results": "Max. zoekresultaten",
|
||||
"Search Sources": "Bronnen zoeken",
|
||||
"Tools/Functions": "Gereedschappen/functies",
|
||||
"Tool Choice": "Gereedschap Keuze",
|
||||
"Parallel Tool Calls": "Parallelle Gereedschapsoproepen",
|
||||
"Reasoning Effort": "Redenen inspanning",
|
||||
"Memory Key": "Geheugen Sleutel",
|
||||
"Text to Extract From": "Tekst om uit te pakken",
|
||||
"Extraction Instructions": "Extractie instructies",
|
||||
"Fields to Extract": "Velden om uit te pakken",
|
||||
"Enable Context Search": "Context zoeken inschakelen",
|
||||
"Strict Extraction": "Strikte Extractie",
|
||||
"Include Confidence Scores": "Inclusief Vertrouwen Scores",
|
||||
"Text to Categorize": "Tekst te categoriseren",
|
||||
"Categories": "Categoriechar@@0n",
|
||||
"Allow Multiple Categories": "Meerdere categorieën toestaan",
|
||||
"Custom Instructions": "Aangepaste instructies",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Model afbeelding",
|
||||
"Number of Images": "Aantal afbeeldingen",
|
||||
"Method": "Methode",
|
||||
"Headers": "Kopteksten",
|
||||
"Query Parameters": "Query parameters",
|
||||
"Body": "Lichaam",
|
||||
"Response is Binary ?": "Antwoord is binair?",
|
||||
"No Error on Failure": "Geen fout bij fout",
|
||||
"Timeout (in seconds)": "Time-out (in seconden)",
|
||||
"Grok model to use for generating the response.": "Grok model om te gebruiken voor het genereren van het antwoord.",
|
||||
"Conversation messages for multi-turn conversations.": "Gesprek berichten voor multi-turn gesprekken.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Eenvoudige tekst prompt voor conversaties met een single turn . Genegeerd als berichten worden verstrekt.",
|
||||
"System message to set behavior and context.": "Systeembericht om gedrag en context in te stellen.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "Afbeeldings-URL voor visiemodellen. Werkt met de snelle prompt-modus.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Bepaalt willekeurigheid (0-2): 0 = deterministisch, 1 = evenwichtig, 2 = creatief.",
|
||||
"Maximum tokens for the response.": "Maximum tokens voor het antwoord.",
|
||||
"Output format for the response.": "Output formaat voor het antwoord.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON schema voor gestructureerde uitvoer (wanneer response formaat json_schema is).",
|
||||
"Allow Grok to search the web and X for current information.": "Grok toestaan om het web en X te zoeken naar huidige informatie.",
|
||||
"How to handle real-time data search.": "Hoe om te gaan met real-time data zoekopdracht.",
|
||||
"Maximum number of search results to use (1-30).": "Maximaal aantal te gebruiken zoekresultaten (1-30).",
|
||||
"Sources to search in.": "Bronnen om in te zoeken.",
|
||||
"Functions the model can call.": "Functies die het model kan aanroepen.",
|
||||
"How the model should use tools.": "Hoe het model moet worden gebruikt.",
|
||||
"Allow model to call multiple tools simultaneously.": "Laat model meerdere tools tegelijkertijd aanroepen.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Hoe hard modellen van redeneren moeten denken (niet voor grok-4).",
|
||||
"Keep conversation history across runs.": "Gespreksgeschiedenis doorlopend houden.",
|
||||
"Grok model to use for data extraction.": "Grok model om te gebruiken voor data-extractie.",
|
||||
"Text to extract data from.": "Tekst om gegevens uit te pakken.",
|
||||
"How to extract the data.": "Hoe de gegevens uit te pakken.",
|
||||
"Define the structured fields to extract from the text.": "Definieer de gestructureerde velden om uit de tekst te halen.",
|
||||
"Search for additional context to improve extraction.": "Zoek naar extra context om extractie te verbeteren.",
|
||||
"Only extract explicitly present information.": "Alleen expliciet aanwezige informatie extraheren.",
|
||||
"How thoroughly to analyze the text.": "Hoe grondig om de tekst te analyseren.",
|
||||
"Include confidence scores for extracted fields.": "Voeg vertrouwensscores toe voor extracted velden.",
|
||||
"Grok model to use for text categorization.": "Grok model om te gebruiken voor tekstcategorie.",
|
||||
"Text content to categorize.": "Tekstinhoud te categoriseren.",
|
||||
"Define the categories for classification.": "Definieer de categorieën voor classificatie.",
|
||||
"Text can be assigned to multiple categories.": "Tekst kan worden toegewezen aan meerdere categorieën.",
|
||||
"Include confidence scores for each category.": "Voeg voor elke categorie vertrouwensscores toe.",
|
||||
"Additional instructions for categorization.": "Extra instructies voor categorisering.",
|
||||
"Search for additional context to improve categorization.": "Zoek naar extra context om de categorisering te verbeteren.",
|
||||
"Detailed description of the image you want to generate.": "Gedetailleerde beschrijving van de afbeelding die u wilt genereren.",
|
||||
"Image generation model to use.": "Te gebruiken model voor genereren afbeeldingen.",
|
||||
"Number of images to generate (1-10).": "Aantal te genereren afbeeldingen (1-10).",
|
||||
"Format of the generated images.": "Formaat van de gegenereerde afbeeldingen.",
|
||||
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
|
||||
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
|
||||
"Text": "Tekstveld",
|
||||
"JSON Object": "JSON object",
|
||||
"Auto (Model decides)": "Automatisch (decimalen model)",
|
||||
"Always Search": "Altijd zoeken",
|
||||
"Never Search": "Nooit zoeken",
|
||||
"None (No tools)": "Geen (geen tools)",
|
||||
"Required (Must use tool)": "Vereiste (gereedschap voor gebruik)",
|
||||
"Default": "Standaard",
|
||||
"Low (Fewer tokens)": "Laag (Node tokens)",
|
||||
"High (More tokens)": "Hoog (Meer tokens)",
|
||||
"Low (Quick extraction)": "Laag (Snelle extractie)",
|
||||
"High (Deep analysis)": "Hoog (Diepe analyse)",
|
||||
"Low (Quick analysis)": "Laag (Snelle analyse)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "KRIJG",
|
||||
"POST": "POSTE",
|
||||
"PATCH": "BEKIJK",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "VERWIJDEREN",
|
||||
"HEAD": "HOOFD"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI ChatBot por xAI que responde a perguntas, gera texto, extrai dados e fornece informações em tempo real.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Perguntar ao Grok",
|
||||
"Extract Data From Text": "Extrair dados de texto",
|
||||
"Categorize Text": "Categorizar Texto",
|
||||
"Generate Image": "Gerar Imagem",
|
||||
"Custom API Call": "Chamada de API personalizada",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Enviar prompts para Grok com pesquisa, ferramentas e saídas estruturadas em tempo real.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extrair campos de dados estruturados de texto não estruturado (por exemplo, nomes, endereços, datas).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Atribuir categorias à entrada de texto com base em campos personalizados ou predefinidos.",
|
||||
"Create images from text prompts using Grok's image generation.": "Crie imagens a partir de instruções de texto usando a geração de imagem de Grok.",
|
||||
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
|
||||
"Model": "Modelo",
|
||||
"Messages": "mensagens",
|
||||
"Quick Prompt (Alternative)": "Prompt Rápido (Alternativo)",
|
||||
"System Instructions": "Instruções do Sistema",
|
||||
"Image URL (Optional)": "URL da Imagem (Opcional)",
|
||||
"Temperature": "Temperatura",
|
||||
"Max Completion Tokens": "Max Tokens de Conclusão",
|
||||
"Response Format": "Formato de Resposta",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Habilitar pesquisa em tempo real",
|
||||
"Search Mode": "Modo de Busca",
|
||||
"Max Search Results": "Resultados máximos da pesquisa",
|
||||
"Search Sources": "Pesquisar Fontes",
|
||||
"Tools/Functions": "Ferramentas/Funções",
|
||||
"Tool Choice": "Escolha da Ferramenta",
|
||||
"Parallel Tool Calls": "Chamadas de ferramenta paralela",
|
||||
"Reasoning Effort": "Esforço Justo",
|
||||
"Memory Key": "Chave de memória",
|
||||
"Text to Extract From": "Texto a extrair de",
|
||||
"Extraction Instructions": "Instruções de extração",
|
||||
"Fields to Extract": "Campos para Extrair",
|
||||
"Enable Context Search": "Habilitar Busca de Contexto",
|
||||
"Strict Extraction": "Extração rigorosa",
|
||||
"Include Confidence Scores": "Incluir Pontos de Confiança",
|
||||
"Text to Categorize": "Texto para Categorizar",
|
||||
"Categories": "categorias",
|
||||
"Allow Multiple Categories": "Permitir Várias Categorias",
|
||||
"Custom Instructions": "Instruções personalizadas",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Modelo de imagem",
|
||||
"Number of Images": "Número de imagens",
|
||||
"Method": "Método",
|
||||
"Headers": "Cabeçalhos",
|
||||
"Query Parameters": "Parâmetros da consulta",
|
||||
"Body": "Conteúdo",
|
||||
"Response is Binary ?": "A resposta é binária ?",
|
||||
"No Error on Failure": "Nenhum erro no Failure",
|
||||
"Timeout (in seconds)": "Tempo limite (em segundos)",
|
||||
"Grok model to use for generating the response.": "Modelo Grok a ser usado para gerar a resposta.",
|
||||
"Conversation messages for multi-turn conversations.": "Mensagens de conversas para conversas multireversas.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Solicitação de texto simples para conversas de virar único. Ignorado se as mensagens são fornecidas.",
|
||||
"System message to set behavior and context.": "Mensagem do sistema para definir comportamento e contexto.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "URL da imagem para modelos de visão. Funciona com modo de prompt rápido.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Controla aleatoriamente (0-2): 0 = determinística, 1 = balanceado, 2 = criativo.",
|
||||
"Maximum tokens for the response.": "Máximo de tokens para resposta.",
|
||||
"Output format for the response.": "Formato de saída para resposta.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "Esquema JSON para saída estruturada (quando o formato de resposta é json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Permitir que Grok pesquise na web e X para informações atuais.",
|
||||
"How to handle real-time data search.": "Como lidar com pesquisa de dados em tempo real.",
|
||||
"Maximum number of search results to use (1-30).": "Número máximo de resultados de pesquisa a serem usados (1-30).",
|
||||
"Sources to search in.": "Fontes para pesquisar.",
|
||||
"Functions the model can call.": "Funções que o modelo pode chamar.",
|
||||
"How the model should use tools.": "Como o modelo deve usar as ferramentas.",
|
||||
"Allow model to call multiple tools simultaneously.": "Permitir que o modelo chame várias ferramentas simultaneamente.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Quão difíceis modelos de raciocínio devem pensar (não para grok-4).",
|
||||
"Keep conversation history across runs.": "Mantenha o histórico de conversas entre os executados.",
|
||||
"Grok model to use for data extraction.": "Modelo de Grok a ser usado para extração de dados.",
|
||||
"Text to extract data from.": "Texto para extrair dados de",
|
||||
"How to extract the data.": "Como extrair os dados.",
|
||||
"Define the structured fields to extract from the text.": "Define os campos estruturados para extrair do texto.",
|
||||
"Search for additional context to improve extraction.": "Procurar contexto adicional para melhorar a extração.",
|
||||
"Only extract explicitly present information.": "Extrair apenas informação explicitamente apresentada.",
|
||||
"How thoroughly to analyze the text.": "Como analisar o texto em profundidade.",
|
||||
"Include confidence scores for extracted fields.": "Incluir pontuação de confiança para campos extraídos.",
|
||||
"Grok model to use for text categorization.": "Modelo de rego a ser usado para categorização de texto.",
|
||||
"Text content to categorize.": "Conteúdo do texto para categorizar.",
|
||||
"Define the categories for classification.": "Defina as categorias para classificação.",
|
||||
"Text can be assigned to multiple categories.": "O texto pode ser atribuído a várias categorias.",
|
||||
"Include confidence scores for each category.": "Incluir pontuação de confiança para cada categoria.",
|
||||
"Additional instructions for categorization.": "Instruções adicionais para a categoria.",
|
||||
"Search for additional context to improve categorization.": "Procure um contexto adicional para melhorar a categoria.",
|
||||
"Detailed description of the image you want to generate.": "Descrição detalhada da imagem que você deseja gerar.",
|
||||
"Image generation model to use.": "Modelo de geração de imagem para usar.",
|
||||
"Number of images to generate (1-10).": "Número de imagens a gerar (1-10).",
|
||||
"Format of the generated images.": "Formato das imagens geradas.",
|
||||
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
|
||||
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
|
||||
"Text": "texto",
|
||||
"JSON Object": "Objeto JSON",
|
||||
"Auto (Model decides)": "Auto (Model decide)",
|
||||
"Always Search": "Sempre procurar",
|
||||
"Never Search": "Nunca Pesquisar",
|
||||
"None (No tools)": "Nenhum (Sem ferramentas)",
|
||||
"Required (Must use tool)": "Necessário (Ferramenta de uso)",
|
||||
"Default": "Padrão",
|
||||
"Low (Fewer tokens)": "Baixo (Menos tokens)",
|
||||
"High (More tokens)": "Alto (Mais tokens)",
|
||||
"Low (Quick extraction)": "Baixa (Extração Rápida)",
|
||||
"High (Deep analysis)": "Alto (análise profunda)",
|
||||
"Low (Quick analysis)": "Baixa (Análise rápida)",
|
||||
"URL": "URL:",
|
||||
"Base64 JSON": "JSON Base64",
|
||||
"GET": "OBTER",
|
||||
"POST": "POSTAR",
|
||||
"PATCH": "COMPRAR",
|
||||
"PUT": "COLOCAR",
|
||||
"DELETE": "EXCLUIR",
|
||||
"HEAD": "CABEÇA"
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"Grok by xAI": "Grok по xAI",
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot от xAI, который отвечает на вопросы, генерирует текст, извлекает данные и обеспечивает понимание в реальном времени.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Получить xAI API ключ**\n\n1. Зарегистрироваться на [xAI](https://x.ai)\n2. Перейдите на вашу [API dashboard](https://console.x.ai)\n3. Сгенерируйте новый ключ API\n4. Скопируйте и вставьте ключ здесь\n\nВаш ключ API должен начинаться с `xai-`\n ",
|
||||
"Ask Grok": "Спросить Grok",
|
||||
"Extract Data From Text": "Извлечь данные из текста",
|
||||
"Categorize Text": "Классифицировать текст",
|
||||
"Generate Image": "Сгенерировать изображение",
|
||||
"Custom API Call": "Пользовательский вызов API",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Отправлять подсказки в Grok с помощью поиска в реальном времени, инструментов и структурированных выходов.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Извлечь структурированные поля данных из неструктурированного текста (например, имена, адреса, даты).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Назначить категории входному тексту на основе пользовательских или предопределенных меток.",
|
||||
"Create images from text prompts using Grok's image generation.": "Создавайте изображения из текстовых подсказок с помощью генерации изображений Grok.",
|
||||
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
|
||||
"Model": "Модель",
|
||||
"Messages": "Сообщения",
|
||||
"Quick Prompt (Alternative)": "Быстрая подсказка (альтернативная)",
|
||||
"System Instructions": "Системные инструкции",
|
||||
"Image URL (Optional)": "URL изображения (необязательно)",
|
||||
"Temperature": "Температура",
|
||||
"Max Completion Tokens": "Макс. токены завершения",
|
||||
"Response Format": "Формат ответа",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Включить поиск в реальном времени",
|
||||
"Search Mode": "Режим поиска",
|
||||
"Max Search Results": "Макс. результатов поиска",
|
||||
"Search Sources": "Источники поиска",
|
||||
"Tools/Functions": "Инструменты/Функции",
|
||||
"Tool Choice": "Выбор инструмента",
|
||||
"Parallel Tool Calls": "Параллельные вызовы инструментов",
|
||||
"Reasoning Effort": "Разумный Усилий",
|
||||
"Memory Key": "Ключ памяти",
|
||||
"Text to Extract From": "Текст для извлечения из",
|
||||
"Extraction Instructions": "Инструкции по извлечению",
|
||||
"Fields to Extract": "Поля для извлечения",
|
||||
"Enable Context Search": "Включить поиск контекста",
|
||||
"Strict Extraction": "Строгое извлечение",
|
||||
"Include Confidence Scores": "Включить баллы доверия",
|
||||
"Text to Categorize": "Текст для классификации",
|
||||
"Categories": "Категории",
|
||||
"Allow Multiple Categories": "Разрешить несколько категорий",
|
||||
"Custom Instructions": "Пользовательские инструкции",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Модель изображения",
|
||||
"Number of Images": "Количество изображений",
|
||||
"Method": "Метод",
|
||||
"Headers": "Заголовки",
|
||||
"Query Parameters": "Параметры запроса",
|
||||
"Body": "Тело",
|
||||
"No Error on Failure": "Нет ошибок при ошибке",
|
||||
"Timeout (in seconds)": "Таймаут (в секундах)",
|
||||
"Grok model to use for generating the response.": "Grok модель для использования для генерации ответа.",
|
||||
"Conversation messages for multi-turn conversations.": "Сообщения в диалоге для многократных разговоров.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Простая текстовая подсказка для разговоров с одним поворотом. Игнорируется, если сообщения предоставлены.",
|
||||
"System message to set behavior and context.": "Системное сообщение для задания поведения и контекста.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "URL изображения для видовых моделей. Работает с быстрыми запросами.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Контролирует случайность (0-2): 0 = детерминист, 1 = сбалансированный, 2 = креативный.",
|
||||
"Maximum tokens for the response.": "Максимальное количество токенов для ответа.",
|
||||
"Output format for the response.": "Формат вывода для ответа.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON схема структурированного вывода (когда формат ответа json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Разрешить Grok искать в Интернете и X для текущей информации.",
|
||||
"How to handle real-time data search.": "Как справиться с поиском данных в реальном времени.",
|
||||
"Maximum number of search results to use (1-30).": "Максимальное количество используемых результатов поиска (1-30).",
|
||||
"Sources to search in.": "Источники для поиска.",
|
||||
"Functions the model can call.": "Функции, которые модель может вызывать.",
|
||||
"How the model should use tools.": "Как модель должна использовать инструменты.",
|
||||
"Allow model to call multiple tools simultaneously.": "Модель вызова нескольких инструментов одновременно.",
|
||||
"How hard reasoning models should think (not for grok-4).": "Насколько трудно рассуждать модели должны думать (не для грок-4).",
|
||||
"Keep conversation history across runs.": "Хранить историю разговоров во время запуска.",
|
||||
"Grok model to use for data extraction.": "Модель Grok, используемая для извлечения данных.",
|
||||
"Text to extract data from.": "Текст для извлечения данных.",
|
||||
"How to extract the data.": "Как извлечь данные.",
|
||||
"Define the structured fields to extract from the text.": "Определить структурированные поля для извлечения из текста.",
|
||||
"Search for additional context to improve extraction.": "Поиск дополнительных контекстов для улучшения извлечения.",
|
||||
"Only extract explicitly present information.": "Только извлечь явно представленную информацию.",
|
||||
"How thoroughly to analyze the text.": "Как тщательно анализировать текст.",
|
||||
"Include confidence scores for extracted fields.": "Включает оценки доверия для извлеченных полей.",
|
||||
"Grok model to use for text categorization.": "Модель Grok для текстовой категоризации.",
|
||||
"Text content to categorize.": "Текстовый контент для категоризации.",
|
||||
"Define the categories for classification.": "Определить категории для классификации.",
|
||||
"Text can be assigned to multiple categories.": "Текст может быть привязан к нескольким категориям.",
|
||||
"Include confidence scores for each category.": "Включает оценки доверия для каждой категории.",
|
||||
"Additional instructions for categorization.": "Дополнительные инструкции по категоризации.",
|
||||
"Search for additional context to improve categorization.": "Поиск дополнительных контекстов для улучшения категоризации.",
|
||||
"Detailed description of the image you want to generate.": "Подробное описание изображения, которое вы хотите создать.",
|
||||
"Image generation model to use.": "Используемая модель генерации изображения.",
|
||||
"Number of images to generate (1-10).": "Количество изображений для генерации (1-10).",
|
||||
"Format of the generated images.": "Формат генерируемых изображений.",
|
||||
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
|
||||
"Text": "Текст",
|
||||
"JSON Object": "Объект JSON",
|
||||
"Auto (Model decides)": "Автоматически (Модель принимает решения)",
|
||||
"Always Search": "Всегда искать",
|
||||
"Never Search": "Никогда не искать",
|
||||
"None (No tools)": "Нет (Нет инструментов)",
|
||||
"Required (Must use tool)": "Требуется (Необходимо использовать инструмент)",
|
||||
"Default": "По умолчанию",
|
||||
"Low (Fewer tokens)": "Низкий (меньше токенов)",
|
||||
"High (More tokens)": "Высокий (Больше токенов)",
|
||||
"Low (Quick extraction)": "Низкий (быстрое извлечение)",
|
||||
"High (Deep analysis)": "Высокий (Дип-анализ)",
|
||||
"Low (Quick analysis)": "Низкий (быстрый анализ)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "JSON Base64",
|
||||
"GET": "ПОЛУЧИТЬ",
|
||||
"POST": "ПОСТ",
|
||||
"PATCH": "ПАТЧ",
|
||||
"PUT": "ПОКУПИТЬ",
|
||||
"DELETE": "УДАЛИТЬ",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Ask Grok",
|
||||
"Extract Data From Text": "Extract Data From Text",
|
||||
"Categorize Text": "Categorize Text",
|
||||
"Generate Image": "Generate Image",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Send prompts to Grok with real-time search, tools, and structured outputs.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extract structured data fields from unstructured text (e.g., names, addresses, dates).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Assign categories to input text based on custom or predefined labels.",
|
||||
"Create images from text prompts using Grok's image generation.": "Create images from text prompts using Grok's image generation.",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Model": "Model",
|
||||
"Messages": "Messages",
|
||||
"Quick Prompt (Alternative)": "Quick Prompt (Alternative)",
|
||||
"System Instructions": "System Instructions",
|
||||
"Image URL (Optional)": "Image URL (Optional)",
|
||||
"Temperature": "Temperature",
|
||||
"Max Completion Tokens": "Max Completion Tokens",
|
||||
"Response Format": "Response Format",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Enable Real-Time Search",
|
||||
"Search Mode": "Search Mode",
|
||||
"Max Search Results": "Max Search Results",
|
||||
"Search Sources": "Search Sources",
|
||||
"Tools/Functions": "Tools/Functions",
|
||||
"Tool Choice": "Tool Choice",
|
||||
"Parallel Tool Calls": "Parallel Tool Calls",
|
||||
"Reasoning Effort": "Reasoning Effort",
|
||||
"Memory Key": "Memory Key",
|
||||
"Text to Extract From": "Text to Extract From",
|
||||
"Extraction Instructions": "Extraction Instructions",
|
||||
"Fields to Extract": "Fields to Extract",
|
||||
"Enable Context Search": "Enable Context Search",
|
||||
"Strict Extraction": "Strict Extraction",
|
||||
"Include Confidence Scores": "Include Confidence Scores",
|
||||
"Text to Categorize": "Text to Categorize",
|
||||
"Categories": "Categories",
|
||||
"Allow Multiple Categories": "Allow Multiple Categories",
|
||||
"Custom Instructions": "Custom Instructions",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Image Model",
|
||||
"Number of Images": "Number of Images",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"Grok model to use for generating the response.": "Grok model to use for generating the response.",
|
||||
"Conversation messages for multi-turn conversations.": "Conversation messages for multi-turn conversations.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Simple text prompt for single-turn conversations. Ignored if Messages is provided.",
|
||||
"System message to set behavior and context.": "System message to set behavior and context.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "Image URL for vision models. Works with quick prompt mode.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.",
|
||||
"Maximum tokens for the response.": "Maximum tokens for the response.",
|
||||
"Output format for the response.": "Output format for the response.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON schema for structured output (when response format is json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Allow Grok to search the web and X for current information.",
|
||||
"How to handle real-time data search.": "How to handle real-time data search.",
|
||||
"Maximum number of search results to use (1-30).": "Maximum number of search results to use (1-30).",
|
||||
"Sources to search in.": "Sources to search in.",
|
||||
"Functions the model can call.": "Functions the model can call.",
|
||||
"How the model should use tools.": "How the model should use tools.",
|
||||
"Allow model to call multiple tools simultaneously.": "Allow model to call multiple tools simultaneously.",
|
||||
"How hard reasoning models should think (not for grok-4).": "How hard reasoning models should think (not for grok-4).",
|
||||
"Keep conversation history across runs.": "Keep conversation history across runs.",
|
||||
"Grok model to use for data extraction.": "Grok model to use for data extraction.",
|
||||
"Text to extract data from.": "Text to extract data from.",
|
||||
"How to extract the data.": "How to extract the data.",
|
||||
"Define the structured fields to extract from the text.": "Define the structured fields to extract from the text.",
|
||||
"Search for additional context to improve extraction.": "Search for additional context to improve extraction.",
|
||||
"Only extract explicitly present information.": "Only extract explicitly present information.",
|
||||
"How thoroughly to analyze the text.": "How thoroughly to analyze the text.",
|
||||
"Include confidence scores for extracted fields.": "Include confidence scores for extracted fields.",
|
||||
"Grok model to use for text categorization.": "Grok model to use for text categorization.",
|
||||
"Text content to categorize.": "Text content to categorize.",
|
||||
"Define the categories for classification.": "Define the categories for classification.",
|
||||
"Text can be assigned to multiple categories.": "Text can be assigned to multiple categories.",
|
||||
"Include confidence scores for each category.": "Include confidence scores for each category.",
|
||||
"Additional instructions for categorization.": "Additional instructions for categorization.",
|
||||
"Search for additional context to improve categorization.": "Search for additional context to improve categorization.",
|
||||
"Detailed description of the image you want to generate.": "Detailed description of the image you want to generate.",
|
||||
"Image generation model to use.": "Image generation model to use.",
|
||||
"Number of images to generate (1-10).": "Number of images to generate (1-10).",
|
||||
"Format of the generated images.": "Format of the generated images.",
|
||||
"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..",
|
||||
"Text": "Text",
|
||||
"JSON Object": "JSON Object",
|
||||
"Auto (Model decides)": "Auto (Model decides)",
|
||||
"Always Search": "Always Search",
|
||||
"Never Search": "Never Search",
|
||||
"None (No tools)": "None (No tools)",
|
||||
"Required (Must use tool)": "Required (Must use tool)",
|
||||
"Default": "Default",
|
||||
"Low (Fewer tokens)": "Low (Fewer tokens)",
|
||||
"High (More tokens)": "High (More tokens)",
|
||||
"Low (Quick extraction)": "Low (Quick extraction)",
|
||||
"High (Deep analysis)": "High (Deep analysis)",
|
||||
"Low (Quick analysis)": "Low (Quick analysis)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"Grok by xAI": "Grok by xAI",
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Ask Grok",
|
||||
"Extract Data From Text": "Extract Data From Text",
|
||||
"Categorize Text": "Categorize Text",
|
||||
"Generate Image": "Generate Image",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Send prompts to Grok with real-time search, tools, and structured outputs.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extract structured data fields from unstructured text (e.g., names, addresses, dates).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Assign categories to input text based on custom or predefined labels.",
|
||||
"Create images from text prompts using Grok's image generation.": "Create images from text prompts using Grok's image generation.",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Model": "Model",
|
||||
"Messages": "Messages",
|
||||
"Quick Prompt (Alternative)": "Quick Prompt (Alternative)",
|
||||
"System Instructions": "System Instructions",
|
||||
"Image URL (Optional)": "Image URL (Optional)",
|
||||
"Temperature": "Temperature",
|
||||
"Max Completion Tokens": "Max Completion Tokens",
|
||||
"Response Format": "Response Format",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Enable Real-Time Search",
|
||||
"Search Mode": "Search Mode",
|
||||
"Max Search Results": "Max Search Results",
|
||||
"Search Sources": "Search Sources",
|
||||
"Tools/Functions": "Tools/Functions",
|
||||
"Tool Choice": "Tool Choice",
|
||||
"Parallel Tool Calls": "Parallel Tool Calls",
|
||||
"Reasoning Effort": "Reasoning Effort",
|
||||
"Memory Key": "Memory Key",
|
||||
"Text to Extract From": "Text to Extract From",
|
||||
"Extraction Instructions": "Extraction Instructions",
|
||||
"Fields to Extract": "Fields to Extract",
|
||||
"Enable Context Search": "Enable Context Search",
|
||||
"Strict Extraction": "Strict Extraction",
|
||||
"Include Confidence Scores": "Include Confidence Scores",
|
||||
"Text to Categorize": "Text to Categorize",
|
||||
"Categories": "Categories",
|
||||
"Allow Multiple Categories": "Allow Multiple Categories",
|
||||
"Custom Instructions": "Custom Instructions",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Image Model",
|
||||
"Number of Images": "Number of Images",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"Grok model to use for generating the response.": "Grok model to use for generating the response.",
|
||||
"Conversation messages for multi-turn conversations.": "Conversation messages for multi-turn conversations.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Simple text prompt for single-turn conversations. Ignored if Messages is provided.",
|
||||
"System message to set behavior and context.": "System message to set behavior and context.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "Image URL for vision models. Works with quick prompt mode.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.",
|
||||
"Maximum tokens for the response.": "Maximum tokens for the response.",
|
||||
"Output format for the response.": "Output format for the response.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON schema for structured output (when response format is json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Allow Grok to search the web and X for current information.",
|
||||
"How to handle real-time data search.": "How to handle real-time data search.",
|
||||
"Maximum number of search results to use (1-30).": "Maximum number of search results to use (1-30).",
|
||||
"Sources to search in.": "Sources to search in.",
|
||||
"Functions the model can call.": "Functions the model can call.",
|
||||
"How the model should use tools.": "How the model should use tools.",
|
||||
"Allow model to call multiple tools simultaneously.": "Allow model to call multiple tools simultaneously.",
|
||||
"How hard reasoning models should think (not for grok-4).": "How hard reasoning models should think (not for grok-4).",
|
||||
"Keep conversation history across runs.": "Keep conversation history across runs.",
|
||||
"Grok model to use for data extraction.": "Grok model to use for data extraction.",
|
||||
"Text to extract data from.": "Text to extract data from.",
|
||||
"How to extract the data.": "How to extract the data.",
|
||||
"Define the structured fields to extract from the text.": "Define the structured fields to extract from the text.",
|
||||
"Search for additional context to improve extraction.": "Search for additional context to improve extraction.",
|
||||
"Only extract explicitly present information.": "Only extract explicitly present information.",
|
||||
"How thoroughly to analyze the text.": "How thoroughly to analyze the text.",
|
||||
"Include confidence scores for extracted fields.": "Include confidence scores for extracted fields.",
|
||||
"Grok model to use for text categorization.": "Grok model to use for text categorization.",
|
||||
"Text content to categorize.": "Text content to categorize.",
|
||||
"Define the categories for classification.": "Define the categories for classification.",
|
||||
"Text can be assigned to multiple categories.": "Text can be assigned to multiple categories.",
|
||||
"Include confidence scores for each category.": "Include confidence scores for each category.",
|
||||
"Additional instructions for categorization.": "Additional instructions for categorization.",
|
||||
"Search for additional context to improve categorization.": "Search for additional context to improve categorization.",
|
||||
"Detailed description of the image you want to generate.": "Detailed description of the image you want to generate.",
|
||||
"Image generation model to use.": "Image generation model to use.",
|
||||
"Number of images to generate (1-10).": "Number of images to generate (1-10).",
|
||||
"Format of the generated images.": "Format of the generated images.",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Text": "Text",
|
||||
"JSON Object": "JSON Object",
|
||||
"Auto (Model decides)": "Auto (Model decides)",
|
||||
"Always Search": "Always Search",
|
||||
"Never Search": "Never Search",
|
||||
"None (No tools)": "None (No tools)",
|
||||
"Required (Must use tool)": "Required (Must use tool)",
|
||||
"Default": "Default",
|
||||
"Low (Fewer tokens)": "Low (Fewer tokens)",
|
||||
"High (More tokens)": "High (More tokens)",
|
||||
"Low (Quick extraction)": "Low (Quick extraction)",
|
||||
"High (Deep analysis)": "High (Deep analysis)",
|
||||
"Low (Quick analysis)": "Low (Quick analysis)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD"
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.": "AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.",
|
||||
"\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ": "\n**Get your xAI API Key**\n\n1. Sign up at [xAI](https://x.ai)\n2. Go to your [API dashboard](https://console.x.ai)\n3. Generate a new API key\n4. Copy and paste the key here\n\nYour API key should start with `xai-`\n ",
|
||||
"Ask Grok": "Ask Grok",
|
||||
"Extract Data From Text": "Extract Data From Text",
|
||||
"Categorize Text": "Categorize Text",
|
||||
"Generate Image": "Generate Image",
|
||||
"Custom API Call": "自定义 API 呼叫",
|
||||
"Send prompts to Grok with real-time search, tools, and structured outputs.": "Send prompts to Grok with real-time search, tools, and structured outputs.",
|
||||
"Extract structured data fields from unstructured text (e.g., names, addresses, dates).": "Extract structured data fields from unstructured text (e.g., names, addresses, dates).",
|
||||
"Assign categories to input text based on custom or predefined labels.": "Assign categories to input text based on custom or predefined labels.",
|
||||
"Create images from text prompts using Grok's image generation.": "Create images from text prompts using Grok's image generation.",
|
||||
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
|
||||
"Model": "Model",
|
||||
"Messages": "Messages",
|
||||
"Quick Prompt (Alternative)": "Quick Prompt (Alternative)",
|
||||
"System Instructions": "System Instructions",
|
||||
"Image URL (Optional)": "Image URL (Optional)",
|
||||
"Temperature": "Temperature",
|
||||
"Max Completion Tokens": "Max Completion Tokens",
|
||||
"Response Format": "Response Format",
|
||||
"JSON Schema": "JSON Schema",
|
||||
"Enable Real-Time Search": "Enable Real-Time Search",
|
||||
"Search Mode": "Search Mode",
|
||||
"Max Search Results": "Max Search Results",
|
||||
"Search Sources": "Search Sources",
|
||||
"Tools/Functions": "Tools/Functions",
|
||||
"Tool Choice": "Tool Choice",
|
||||
"Parallel Tool Calls": "Parallel Tool Calls",
|
||||
"Reasoning Effort": "Reasoning Effort",
|
||||
"Memory Key": "内存键",
|
||||
"Text to Extract From": "Text to Extract From",
|
||||
"Extraction Instructions": "Extraction Instructions",
|
||||
"Fields to Extract": "Fields to Extract",
|
||||
"Enable Context Search": "Enable Context Search",
|
||||
"Strict Extraction": "Strict Extraction",
|
||||
"Include Confidence Scores": "Include Confidence Scores",
|
||||
"Text to Categorize": "Text to Categorize",
|
||||
"Categories": "Categories",
|
||||
"Allow Multiple Categories": "Allow Multiple Categories",
|
||||
"Custom Instructions": "Custom Instructions",
|
||||
"Image Prompt": "Image Prompt",
|
||||
"Image Model": "Image Model",
|
||||
"Number of Images": "Number of Images",
|
||||
"Method": "方法",
|
||||
"Headers": "信头",
|
||||
"Query Parameters": "查询参数",
|
||||
"Body": "正文内容",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "失败时没有错误",
|
||||
"Timeout (in seconds)": "超时(秒)",
|
||||
"Grok model to use for generating the response.": "Grok model to use for generating the response.",
|
||||
"Conversation messages for multi-turn conversations.": "Conversation messages for multi-turn conversations.",
|
||||
"Simple text prompt for single-turn conversations. Ignored if Messages is provided.": "Simple text prompt for single-turn conversations. Ignored if Messages is provided.",
|
||||
"System message to set behavior and context.": "System message to set behavior and context.",
|
||||
"Image URL for vision models. Works with quick prompt mode.": "Image URL for vision models. Works with quick prompt mode.",
|
||||
"Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.": "Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.",
|
||||
"Maximum tokens for the response.": "Maximum tokens for the response.",
|
||||
"Output format for the response.": "Output format for the response.",
|
||||
"JSON schema for structured output (when response format is json_schema).": "JSON schema for structured output (when response format is json_schema).",
|
||||
"Allow Grok to search the web and X for current information.": "Allow Grok to search the web and X for current information.",
|
||||
"How to handle real-time data search.": "How to handle real-time data search.",
|
||||
"Maximum number of search results to use (1-30).": "Maximum number of search results to use (1-30).",
|
||||
"Sources to search in.": "Sources to search in.",
|
||||
"Functions the model can call.": "Functions the model can call.",
|
||||
"How the model should use tools.": "How the model should use tools.",
|
||||
"Allow model to call multiple tools simultaneously.": "Allow model to call multiple tools simultaneously.",
|
||||
"How hard reasoning models should think (not for grok-4).": "How hard reasoning models should think (not for grok-4).",
|
||||
"Keep conversation history across runs.": "Keep conversation history across runs.",
|
||||
"Grok model to use for data extraction.": "Grok model to use for data extraction.",
|
||||
"Text to extract data from.": "Text to extract data from.",
|
||||
"How to extract the data.": "How to extract the data.",
|
||||
"Define the structured fields to extract from the text.": "Define the structured fields to extract from the text.",
|
||||
"Search for additional context to improve extraction.": "Search for additional context to improve extraction.",
|
||||
"Only extract explicitly present information.": "Only extract explicitly present information.",
|
||||
"How thoroughly to analyze the text.": "How thoroughly to analyze the text.",
|
||||
"Include confidence scores for extracted fields.": "Include confidence scores for extracted fields.",
|
||||
"Grok model to use for text categorization.": "Grok model to use for text categorization.",
|
||||
"Text content to categorize.": "Text content to categorize.",
|
||||
"Define the categories for classification.": "Define the categories for classification.",
|
||||
"Text can be assigned to multiple categories.": "Text can be assigned to multiple categories.",
|
||||
"Include confidence scores for each category.": "Include confidence scores for each category.",
|
||||
"Additional instructions for categorization.": "Additional instructions for categorization.",
|
||||
"Search for additional context to improve categorization.": "Search for additional context to improve categorization.",
|
||||
"Detailed description of the image you want to generate.": "Detailed description of the image you want to generate.",
|
||||
"Image generation model to use.": "Image generation model to use.",
|
||||
"Number of images to generate (1-10).": "Number of images to generate (1-10).",
|
||||
"Format of the generated images.": "Format of the generated images.",
|
||||
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"Text": "文本",
|
||||
"JSON Object": "JSON Object",
|
||||
"Auto (Model decides)": "Auto (Model decides)",
|
||||
"Always Search": "Always Search",
|
||||
"Never Search": "Never Search",
|
||||
"None (No tools)": "None (No tools)",
|
||||
"Required (Must use tool)": "Required (Must use tool)",
|
||||
"Default": "Default",
|
||||
"Low (Fewer tokens)": "Low (Fewer tokens)",
|
||||
"High (More tokens)": "High (More tokens)",
|
||||
"Low (Quick extraction)": "Low (Quick extraction)",
|
||||
"High (Deep analysis)": "High (Deep analysis)",
|
||||
"Low (Quick analysis)": "Low (Quick analysis)",
|
||||
"URL": "URL",
|
||||
"Base64 JSON": "Base64 JSON",
|
||||
"GET": "获取",
|
||||
"POST": "帖子",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "弹出",
|
||||
"DELETE": "删除",
|
||||
"HEAD": "黑色"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { grokAuth } from './lib/common/auth';
|
||||
import { askGrok } from './lib/actions/ask-grok';
|
||||
import { extractDataFromText } from './lib/actions/extract-data';
|
||||
import { categorizeText } from './lib/actions/categorize-text';
|
||||
import { generateImage } from './lib/actions/generate-image';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { XAI_BASE_URL } from './lib/common/constants';
|
||||
|
||||
export const grokXai = createPiece({
|
||||
displayName: 'Grok by xAI',
|
||||
description: 'AI chatbot by xAI that answers questions, generates text, extracts data, and provides real-time insights.',
|
||||
auth: grokAuth,
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/grok-xai.png',
|
||||
categories: [
|
||||
PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
||||
authors: ['sparkybug'],
|
||||
actions: [
|
||||
askGrok,
|
||||
extractDataFromText,
|
||||
categorizeText,
|
||||
generateImage,
|
||||
createCustomApiCallAction({
|
||||
auth: grokAuth,
|
||||
baseUrl: () => XAI_BASE_URL,
|
||||
authMapping: async (auth) => ({
|
||||
Authorization: `Bearer ${auth}`,
|
||||
}),
|
||||
}),
|
||||
],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,424 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
StoreScope,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { grokAuth } from '../common/auth';
|
||||
import {
|
||||
createModelProperty,
|
||||
createTemperatureProperty,
|
||||
createTokenProperty,
|
||||
makeXaiRequest,
|
||||
validateResponse,
|
||||
XaiResponse,
|
||||
AskGrokResult
|
||||
} from '../common/utils';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const askGrok = createAction({
|
||||
auth: grokAuth,
|
||||
name: 'ask_grok',
|
||||
displayName: 'Ask Grok',
|
||||
description: 'Send prompts to Grok with real-time search, tools, and structured outputs.',
|
||||
props: {
|
||||
model: createModelProperty({
|
||||
displayName: 'Model',
|
||||
description: 'Grok model to use for generating the response.',
|
||||
defaultValue: 'grok-3-beta'
|
||||
}),
|
||||
messages: Property.Array({
|
||||
displayName: 'Messages',
|
||||
required: true,
|
||||
description: 'Conversation messages for multi-turn conversations.',
|
||||
properties: {
|
||||
role: Property.StaticDropdown({
|
||||
displayName: 'Role',
|
||||
required: true,
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'System', value: 'system' },
|
||||
{ label: 'User', value: 'user' },
|
||||
{ label: 'Assistant', value: 'assistant' },
|
||||
{ label: 'Tool', value: 'tool' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
content: Property.LongText({
|
||||
displayName: 'Content',
|
||||
required: true,
|
||||
description: 'Message content (text, image URL, or JSON for multimodal).',
|
||||
}),
|
||||
name: Property.ShortText({
|
||||
displayName: 'Name (Optional)',
|
||||
required: false,
|
||||
description: 'Unique identifier for the user.',
|
||||
}),
|
||||
tool_call_id: Property.ShortText({
|
||||
displayName: 'Tool Call ID (for tool role)',
|
||||
required: false,
|
||||
description: 'Required when role is "tool" - ID from the tool call.',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
quickPrompt: Property.LongText({
|
||||
displayName: 'Quick Prompt (Alternative)',
|
||||
required: false,
|
||||
description: 'Simple text prompt for single-turn conversations. Ignored if Messages is provided.',
|
||||
}),
|
||||
systemMessage: Property.LongText({
|
||||
displayName: 'System Instructions',
|
||||
required: false,
|
||||
description: 'System message to set behavior and context.',
|
||||
defaultValue: 'You are Grok, a helpful and witty AI assistant that provides accurate, truthful answers.',
|
||||
}),
|
||||
imageUrl: Property.ShortText({
|
||||
displayName: 'Image URL (Optional)',
|
||||
required: false,
|
||||
description: 'Image URL for vision models. Works with quick prompt mode.',
|
||||
}),
|
||||
temperature: createTemperatureProperty(1.0),
|
||||
maxCompletionTokens: createTokenProperty(),
|
||||
responseFormat: Property.StaticDropdown({
|
||||
displayName: 'Response Format',
|
||||
required: false,
|
||||
defaultValue: 'text',
|
||||
description: 'Output format for the response.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Text', value: 'text' },
|
||||
{ label: 'JSON Object', value: 'json_object' },
|
||||
{ label: 'JSON Schema', value: 'json_schema' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
jsonSchema: Property.LongText({
|
||||
displayName: 'JSON Schema',
|
||||
required: false,
|
||||
description: 'JSON schema for structured output (when response format is json_schema).',
|
||||
}),
|
||||
enableRealTimeSearch: Property.Checkbox({
|
||||
displayName: 'Enable Real-Time Search',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Allow Grok to search the web and X for current information.',
|
||||
}),
|
||||
searchMode: Property.StaticDropdown({
|
||||
displayName: 'Search Mode',
|
||||
required: false,
|
||||
defaultValue: 'auto',
|
||||
description: 'How to handle real-time data search.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Auto (Model decides)', value: 'auto' },
|
||||
{ label: 'Always Search', value: 'on' },
|
||||
{ label: 'Never Search', value: 'off' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
maxSearchResults: Property.Number({
|
||||
displayName: 'Max Search Results',
|
||||
required: false,
|
||||
defaultValue: 15,
|
||||
description: 'Maximum number of search results to use (1-30).',
|
||||
}),
|
||||
searchSources: Property.MultiSelectDropdown({
|
||||
displayName: 'Search Sources',
|
||||
auth: grokAuth,
|
||||
required: false,
|
||||
description: 'Sources to search in.',
|
||||
refreshers: [],
|
||||
options: async () => ({
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Web', value: 'web' },
|
||||
{ label: 'News', value: 'news' },
|
||||
{ label: 'X (Twitter)', value: 'x' },
|
||||
],
|
||||
}),
|
||||
}),
|
||||
tools: Property.Array({
|
||||
displayName: 'Tools/Functions',
|
||||
required: false,
|
||||
description: 'Functions the model can call.',
|
||||
properties: {
|
||||
name: Property.ShortText({
|
||||
displayName: 'Function Name',
|
||||
required: true,
|
||||
description: 'Name of the function.',
|
||||
}),
|
||||
description: Property.LongText({
|
||||
displayName: 'Description',
|
||||
required: false,
|
||||
description: 'What the function does.',
|
||||
}),
|
||||
parameters: Property.LongText({
|
||||
displayName: 'Parameters Schema',
|
||||
required: true,
|
||||
description: 'JSON schema defining function parameters.',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
toolChoice: Property.StaticDropdown({
|
||||
displayName: 'Tool Choice',
|
||||
required: false,
|
||||
defaultValue: 'auto',
|
||||
description: 'How the model should use tools.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Auto (Model decides)', value: 'auto' },
|
||||
{ label: 'None (No tools)', value: 'none' },
|
||||
{ label: 'Required (Must use tool)', value: 'required' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
parallelToolCalls: Property.Checkbox({
|
||||
displayName: 'Parallel Tool Calls',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
description: 'Allow model to call multiple tools simultaneously.',
|
||||
}),
|
||||
reasoningEffort: Property.StaticDropdown({
|
||||
displayName: 'Reasoning Effort',
|
||||
required: false,
|
||||
description: 'How hard reasoning models should think (not for grok-4).',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Default', value: '' },
|
||||
{ label: 'Low (Fewer tokens)', value: 'low' },
|
||||
{ label: 'High (More tokens)', value: 'high' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
memoryKey: Property.ShortText({
|
||||
displayName: 'Memory Key',
|
||||
description: 'Keep conversation history across runs.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue, store }) {
|
||||
await propsValidation.validateZod(propsValue, {
|
||||
temperature: z.number().min(0).max(2).optional(),
|
||||
maxCompletionTokens: z.number().min(1).optional(),
|
||||
maxSearchResults: z.number().min(1).max(30).optional(),
|
||||
memoryKey: z.string().max(128).optional(),
|
||||
});
|
||||
|
||||
const {
|
||||
model,
|
||||
messages,
|
||||
quickPrompt,
|
||||
systemMessage,
|
||||
imageUrl,
|
||||
temperature,
|
||||
maxCompletionTokens,
|
||||
responseFormat,
|
||||
jsonSchema,
|
||||
enableRealTimeSearch,
|
||||
searchMode,
|
||||
maxSearchResults,
|
||||
searchSources,
|
||||
tools,
|
||||
toolChoice,
|
||||
parallelToolCalls,
|
||||
reasoningEffort,
|
||||
memoryKey,
|
||||
} = propsValue;
|
||||
|
||||
let conversationMessages: any[] = [];
|
||||
|
||||
if (messages && Array.isArray(messages) && messages.length > 0) {
|
||||
conversationMessages = messages.map((msg: any) => {
|
||||
const message: any = {
|
||||
role: msg.role,
|
||||
content: msg.content,
|
||||
};
|
||||
if (msg.name) message.name = msg.name;
|
||||
if (msg.tool_call_id && msg.role === 'tool') message.tool_call_id = msg.tool_call_id;
|
||||
return message;
|
||||
});
|
||||
} else if (quickPrompt) {
|
||||
if (systemMessage) {
|
||||
conversationMessages.push({
|
||||
role: 'system',
|
||||
content: systemMessage,
|
||||
});
|
||||
}
|
||||
|
||||
if (imageUrl) {
|
||||
conversationMessages.push({
|
||||
role: 'user',
|
||||
content: [
|
||||
{ type: 'text', text: quickPrompt },
|
||||
{ type: 'image_url', image_url: { url: imageUrl } },
|
||||
],
|
||||
});
|
||||
} else {
|
||||
conversationMessages.push({
|
||||
role: 'user',
|
||||
content: quickPrompt,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
throw new Error('Either provide Messages array or Quick Prompt');
|
||||
}
|
||||
|
||||
let messageHistory: any[] = [];
|
||||
if (memoryKey) {
|
||||
messageHistory = (await store.get(memoryKey, StoreScope.PROJECT)) ?? [];
|
||||
if (messageHistory.length > 0) {
|
||||
conversationMessages = [...messageHistory, ...conversationMessages];
|
||||
}
|
||||
}
|
||||
|
||||
const requestBody: any = {
|
||||
model,
|
||||
messages: conversationMessages,
|
||||
};
|
||||
|
||||
if (temperature !== undefined) requestBody.temperature = temperature;
|
||||
if (maxCompletionTokens !== undefined) requestBody.max_completion_tokens = maxCompletionTokens;
|
||||
|
||||
if (responseFormat && responseFormat !== 'text') {
|
||||
if (responseFormat === 'json_object') {
|
||||
requestBody.response_format = { type: 'json_object' };
|
||||
} else if (responseFormat === 'json_schema' && jsonSchema) {
|
||||
try {
|
||||
const schema = JSON.parse(jsonSchema);
|
||||
requestBody.response_format = {
|
||||
type: 'json_schema',
|
||||
json_schema: schema,
|
||||
};
|
||||
} catch (error) {
|
||||
throw new Error('Invalid JSON schema provided');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enableRealTimeSearch) {
|
||||
const searchParams: any = {
|
||||
mode: searchMode || 'auto',
|
||||
max_search_results: maxSearchResults || 15,
|
||||
return_citations: true,
|
||||
};
|
||||
|
||||
if (searchSources && Array.isArray(searchSources) && searchSources.length > 0) {
|
||||
searchParams.sources = searchSources.map((source: string) => ({ type: source }));
|
||||
}
|
||||
|
||||
requestBody.search_parameters = searchParams;
|
||||
}
|
||||
|
||||
if (tools && Array.isArray(tools) && tools.length > 0) {
|
||||
requestBody.tools = tools.map((tool: any) => ({
|
||||
type: 'function',
|
||||
function: {
|
||||
name: tool.name,
|
||||
description: tool.description || '',
|
||||
parameters: JSON.parse(tool.parameters),
|
||||
},
|
||||
}));
|
||||
|
||||
if (toolChoice && toolChoice !== 'auto') {
|
||||
requestBody.tool_choice = toolChoice;
|
||||
}
|
||||
|
||||
if (parallelToolCalls !== undefined) {
|
||||
requestBody.parallel_tool_calls = parallelToolCalls;
|
||||
}
|
||||
}
|
||||
|
||||
if (reasoningEffort && !model.includes('grok-4')) {
|
||||
requestBody.reasoning_effort = reasoningEffort;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await makeXaiRequest(auth, requestBody, 180000, 'Ask Grok');
|
||||
const choice = response.body.choices[0];
|
||||
const assistantMessage = choice.message;
|
||||
|
||||
if (memoryKey) {
|
||||
const newHistory = [
|
||||
...messageHistory,
|
||||
...conversationMessages.slice(messageHistory.length),
|
||||
assistantMessage,
|
||||
];
|
||||
const trimmedHistory = newHistory.slice(-30);
|
||||
await store.put(memoryKey, trimmedHistory, StoreScope.PROJECT);
|
||||
}
|
||||
|
||||
const result = {
|
||||
content: assistantMessage.content,
|
||||
reasoning_content: assistantMessage.reasoning_content,
|
||||
refusal: assistantMessage.refusal,
|
||||
role: assistantMessage.role,
|
||||
finish_reason: choice.finish_reason,
|
||||
index: choice.index,
|
||||
model: response.body.model,
|
||||
id: response.body.id,
|
||||
created: response.body.created,
|
||||
object: response.body.object,
|
||||
system_fingerprint: response.body.system_fingerprint,
|
||||
};
|
||||
|
||||
if (assistantMessage.tool_calls) {
|
||||
(result as any).tool_calls = assistantMessage.tool_calls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (response.body.usage) {
|
||||
(result as any).usage = response.body.usage;
|
||||
}
|
||||
|
||||
if (response.body.citations) {
|
||||
(result as any).citations = response.body.citations;
|
||||
}
|
||||
|
||||
if (response.body.debug_output) {
|
||||
(result as any).debug_output = response.body.debug_output;
|
||||
}
|
||||
|
||||
return result as AskGrokResult;
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 400) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Bad request';
|
||||
throw new Error(`Chat completion failed: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 422) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Validation error';
|
||||
throw new Error(`Invalid parameters: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 500) {
|
||||
throw new Error('Chat service temporarily unavailable. Please try again.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new Error('Invalid API key. Please check your xAI API key.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error('Access denied. Please check your API key permissions.');
|
||||
}
|
||||
|
||||
if (error.message?.includes('timeout')) {
|
||||
throw new Error('Request timed out. Try reducing context length or search results.');
|
||||
}
|
||||
|
||||
throw new Error(`Chat completion failed: ${error.message || 'Unknown error occurred'}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,307 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { grokAuth } from '../common/auth';
|
||||
import {
|
||||
createModelProperty,
|
||||
createTemperatureProperty,
|
||||
createTokenProperty,
|
||||
makeXaiRequest,
|
||||
validateResponse,
|
||||
parseJsonResponse,
|
||||
XaiResponse,
|
||||
CategorizationResult
|
||||
} from '../common/utils';
|
||||
import { z } from 'zod';
|
||||
|
||||
interface Category {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const categorizeText = createAction({
|
||||
auth: grokAuth,
|
||||
name: 'categorize_text',
|
||||
displayName: 'Categorize Text',
|
||||
description: 'Assign categories to input text based on custom or predefined labels.',
|
||||
props: {
|
||||
model: createModelProperty({
|
||||
displayName: 'Model',
|
||||
description: 'Grok model to use for text categorization.',
|
||||
defaultValue: 'grok-3-beta'
|
||||
}),
|
||||
text: Property.LongText({
|
||||
displayName: 'Text to Categorize',
|
||||
required: true,
|
||||
description: 'Text content to categorize.',
|
||||
}),
|
||||
categories: Property.Array({
|
||||
displayName: 'Categories',
|
||||
required: true,
|
||||
description: 'Define the categories for classification.',
|
||||
properties: {
|
||||
name: Property.ShortText({
|
||||
displayName: 'Category Name',
|
||||
required: true,
|
||||
description: 'Category name (e.g., "Positive", "Urgent", "Customer Support")',
|
||||
}),
|
||||
description: Property.ShortText({
|
||||
displayName: 'Category Description',
|
||||
required: true,
|
||||
description: 'What this category represents',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
allowMultiple: Property.Checkbox({
|
||||
displayName: 'Allow Multiple Categories',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Text can be assigned to multiple categories.',
|
||||
}),
|
||||
includeConfidence: Property.Checkbox({
|
||||
displayName: 'Include Confidence Scores',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
description: 'Include confidence scores for each category.',
|
||||
}),
|
||||
customInstructions: Property.LongText({
|
||||
displayName: 'Custom Instructions',
|
||||
required: false,
|
||||
description: 'Additional instructions for categorization.',
|
||||
defaultValue: 'Analyze the text and assign it to the most appropriate category based on its content, tone, and context.',
|
||||
}),
|
||||
enableContextSearch: Property.Checkbox({
|
||||
displayName: 'Enable Context Search',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Search for additional context to improve categorization.',
|
||||
}),
|
||||
temperature: createTemperatureProperty(0.2),
|
||||
maxCompletionTokens: createTokenProperty(500),
|
||||
reasoningEffort: Property.StaticDropdown({
|
||||
displayName: 'Reasoning Effort',
|
||||
required: false,
|
||||
description: 'How thoroughly to analyze the text.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Default', value: '' },
|
||||
{ label: 'Low (Quick analysis)', value: 'low' },
|
||||
{ label: 'High (Deep analysis)', value: 'high' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
await propsValidation.validateZod(propsValue, {
|
||||
temperature: z.number().min(0).max(2).optional(),
|
||||
maxCompletionTokens: z.number().min(50).max(4000).optional(),
|
||||
text: z.string().min(1).max(100000),
|
||||
});
|
||||
|
||||
const {
|
||||
model,
|
||||
text,
|
||||
categories,
|
||||
allowMultiple,
|
||||
includeConfidence,
|
||||
customInstructions,
|
||||
enableContextSearch,
|
||||
temperature,
|
||||
maxCompletionTokens,
|
||||
reasoningEffort,
|
||||
} = propsValue;
|
||||
|
||||
if (!text.trim()) {
|
||||
throw new Error('Text to categorize cannot be empty');
|
||||
}
|
||||
|
||||
const categoriesArray = categories as Category[];
|
||||
|
||||
if (!categoriesArray || categoriesArray.length === 0) {
|
||||
throw new Error('At least one category must be defined');
|
||||
}
|
||||
|
||||
const categoryNames = categoriesArray.map(cat => cat.name);
|
||||
const categoryDescriptions = categoriesArray.map(cat =>
|
||||
`${cat.name}: ${cat.description}`
|
||||
).join('\n');
|
||||
|
||||
const jsonSchema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
categories: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
enum: categoryNames,
|
||||
},
|
||||
description: allowMultiple
|
||||
? "Array of category names that apply to the text"
|
||||
: "Single category name that best applies to the text",
|
||||
maxItems: allowMultiple ? categoryNames.length : 1,
|
||||
minItems: 1,
|
||||
},
|
||||
reasoning: {
|
||||
type: "string",
|
||||
description: "Detailed explanation of why these categories were chosen",
|
||||
},
|
||||
...(includeConfidence ? {
|
||||
confidence_scores: {
|
||||
type: "object",
|
||||
properties: Object.fromEntries(
|
||||
categoryNames.map(name => [
|
||||
name.toLowerCase().replace(/\s+/g, '_'),
|
||||
{
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 1,
|
||||
description: `Confidence score for ${name} category (0-1)`,
|
||||
}
|
||||
])
|
||||
),
|
||||
description: "Confidence scores for each category",
|
||||
}
|
||||
} : {}),
|
||||
},
|
||||
required: ["categories", "reasoning"],
|
||||
additionalProperties: false,
|
||||
};
|
||||
|
||||
const systemPrompt = `You are an expert text categorization system. Your task is to analyze text and assign it to appropriate categories.
|
||||
|
||||
${customInstructions}
|
||||
|
||||
Available Categories:
|
||||
${categoryDescriptions}
|
||||
|
||||
Categorization Rules:
|
||||
- ${allowMultiple ? 'You may assign multiple categories if the text fits multiple classifications' : 'You must assign exactly ONE category that best fits the text'}
|
||||
- Analyze the content, tone, intent, and context of the text
|
||||
- ${includeConfidence ? 'Provide confidence scores between 0 and 1 for each category' : ''}
|
||||
- Always provide clear reasoning for your categorization decision
|
||||
- Be consistent with the category definitions provided
|
||||
- If the text doesn't clearly fit any category, choose the closest match and explain why
|
||||
|
||||
Response Format: You must respond with valid JSON matching the specified schema.`;
|
||||
|
||||
const messages = [
|
||||
{
|
||||
role: 'system',
|
||||
content: systemPrompt,
|
||||
},
|
||||
{
|
||||
role: 'user',
|
||||
content: `Please categorize the following text:\n\n${text.trim()}`,
|
||||
},
|
||||
];
|
||||
|
||||
const requestBody: any = {
|
||||
model,
|
||||
messages,
|
||||
temperature: temperature || 0.2,
|
||||
max_completion_tokens: maxCompletionTokens || 500,
|
||||
response_format: {
|
||||
type: 'json_schema',
|
||||
json_schema: {
|
||||
name: "categorization_result",
|
||||
schema: jsonSchema,
|
||||
strict: true
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (reasoningEffort && !model.includes('grok-3')) {
|
||||
requestBody.reasoning_effort = reasoningEffort;
|
||||
}
|
||||
|
||||
if (enableContextSearch) {
|
||||
requestBody.search_parameters = {
|
||||
mode: 'auto',
|
||||
max_search_results: 5,
|
||||
return_citations: true,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await makeXaiRequest(auth, requestBody, 120000, 'Categorize Text');
|
||||
const { choice, content } = validateResponse(response, 'Categorize Text');
|
||||
const categorizationResult = parseJsonResponse(content, 'Categorize Text');
|
||||
|
||||
const result = {
|
||||
categories: categorizationResult.categories || [],
|
||||
reasoning: categorizationResult.reasoning || '',
|
||||
primary_category: Array.isArray(categorizationResult.categories)
|
||||
? categorizationResult.categories[0]
|
||||
: categorizationResult.categories,
|
||||
multiple_categories: allowMultiple,
|
||||
total_categories_assigned: Array.isArray(categorizationResult.categories)
|
||||
? categorizationResult.categories.length
|
||||
: 1,
|
||||
model: response.body.model,
|
||||
finish_reason: choice.finish_reason,
|
||||
};
|
||||
|
||||
if (includeConfidence && categorizationResult.confidence_scores) {
|
||||
(result as any).confidence_scores = categorizationResult.confidence_scores;
|
||||
|
||||
const confidenceValues = Object.values(categorizationResult.confidence_scores) as number[];
|
||||
if (confidenceValues.length > 0) {
|
||||
(result as any).avg_confidence = confidenceValues.reduce((a, b) => a + b, 0) / confidenceValues.length;
|
||||
(result as any).max_confidence = Math.max(...confidenceValues);
|
||||
(result as any).min_confidence = Math.min(...confidenceValues);
|
||||
}
|
||||
}
|
||||
|
||||
if (response.body.usage) {
|
||||
(result as any).usage = response.body.usage;
|
||||
}
|
||||
|
||||
if (enableContextSearch && response.body.citations) {
|
||||
(result as any).citations = response.body.citations;
|
||||
}
|
||||
|
||||
if (choice.message.reasoning_content) {
|
||||
(result as any).reasoning_content = choice.message.reasoning_content;
|
||||
}
|
||||
|
||||
return result as CategorizationResult;
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 400) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Bad request';
|
||||
throw new Error(`Text categorization failed: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 422) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Validation error';
|
||||
throw new Error(`Invalid categorization parameters: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 500) {
|
||||
throw new Error('Categorization service temporarily unavailable. Please try again.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new Error('Invalid API key. Please check your xAI API key.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error('Access denied. Please check your API key permissions.');
|
||||
}
|
||||
|
||||
if (error.message?.includes('timeout')) {
|
||||
throw new Error('Categorization timed out. Try reducing text length or simplifying categories.');
|
||||
}
|
||||
|
||||
throw new Error(`Text categorization failed: ${error.message || 'Unknown error occurred'}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,355 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { grokAuth } from '../common/auth';
|
||||
import {
|
||||
createModelProperty,
|
||||
createTemperatureProperty,
|
||||
createTokenProperty,
|
||||
makeXaiRequest,
|
||||
validateResponse,
|
||||
parseJsonResponse,
|
||||
XaiResponse,
|
||||
ExtractionResult
|
||||
} from '../common/utils';
|
||||
import { z } from 'zod';
|
||||
|
||||
interface ExtractDataField {
|
||||
fieldName: string;
|
||||
fieldType: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
||||
fieldDescription: string;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
export const extractDataFromText = createAction({
|
||||
auth: grokAuth,
|
||||
name: 'extract_data_from_text',
|
||||
displayName: 'Extract Data From Text',
|
||||
description: 'Extract structured data fields from unstructured text (e.g., names, addresses, dates).',
|
||||
props: {
|
||||
model: createModelProperty({
|
||||
displayName: 'Model',
|
||||
description: 'Grok model to use for data extraction.',
|
||||
defaultValue: 'grok-3-beta'
|
||||
}),
|
||||
text: Property.LongText({
|
||||
displayName: 'Text to Extract From',
|
||||
required: true,
|
||||
description: 'Text to extract data from.',
|
||||
}),
|
||||
extractionPrompt: Property.LongText({
|
||||
displayName: 'Extraction Instructions',
|
||||
required: false,
|
||||
description: 'How to extract the data.',
|
||||
defaultValue: 'Extract the following structured data from the provided text. Be accurate and only extract information that is explicitly present. If a field is not found, use null.',
|
||||
}),
|
||||
fields: Property.Array({
|
||||
displayName: 'Fields to Extract',
|
||||
required: true,
|
||||
description: 'Define the structured fields to extract from the text.',
|
||||
properties: {
|
||||
fieldName: Property.ShortText({
|
||||
displayName: 'Field Name',
|
||||
required: true,
|
||||
description: 'Name of the field (e.g., "firstName", "email", "phoneNumber")',
|
||||
}),
|
||||
fieldType: Property.StaticDropdown({
|
||||
displayName: 'Field Type',
|
||||
required: true,
|
||||
defaultValue: 'string',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Text (String)', value: 'string' },
|
||||
{ label: 'Number', value: 'number' },
|
||||
{ label: 'True/False (Boolean)', value: 'boolean' },
|
||||
{ label: 'List (Array)', value: 'array' },
|
||||
{ label: 'Object', value: 'object' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
fieldDescription: Property.ShortText({
|
||||
displayName: 'Field Description',
|
||||
required: true,
|
||||
description: 'What this field represents (e.g., "The person\'s first name")',
|
||||
}),
|
||||
required: Property.Checkbox({
|
||||
displayName: 'Required Field',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
description: 'Must be present in extracted data.',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
enableContextSearch: Property.Checkbox({
|
||||
displayName: 'Enable Context Search',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Search for additional context to improve extraction.',
|
||||
}),
|
||||
strictExtraction: Property.Checkbox({
|
||||
displayName: 'Strict Extraction',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
description: 'Only extract explicitly present information.',
|
||||
}),
|
||||
temperature: createTemperatureProperty(0.1),
|
||||
maxCompletionTokens: createTokenProperty(1000),
|
||||
reasoningEffort: Property.StaticDropdown({
|
||||
displayName: 'Reasoning Effort',
|
||||
required: false,
|
||||
description: 'How thoroughly to analyze the text.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Default', value: '' },
|
||||
{ label: 'Low (Quick extraction)', value: 'low' },
|
||||
{ label: 'High (Deep analysis)', value: 'high' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
includeConfidence: Property.Checkbox({
|
||||
displayName: 'Include Confidence Scores',
|
||||
required: false,
|
||||
defaultValue: true,
|
||||
description: 'Include confidence scores for extracted fields.',
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
await propsValidation.validateZod(propsValue, {
|
||||
temperature: z.number().min(0).max(2).optional(),
|
||||
maxCompletionTokens: z.number().min(100).max(4000).optional(),
|
||||
text: z.string().min(1).max(100000),
|
||||
});
|
||||
|
||||
const {
|
||||
model,
|
||||
text,
|
||||
extractionPrompt,
|
||||
fields,
|
||||
enableContextSearch,
|
||||
strictExtraction,
|
||||
temperature,
|
||||
maxCompletionTokens,
|
||||
reasoningEffort,
|
||||
includeConfidence,
|
||||
} = propsValue;
|
||||
|
||||
if (!text.trim()) {
|
||||
throw new Error('Text to extract from cannot be empty');
|
||||
}
|
||||
|
||||
const fieldsArray = fields as ExtractDataField[];
|
||||
|
||||
if (!fieldsArray || fieldsArray.length === 0) {
|
||||
throw new Error('At least one field must be defined for extraction');
|
||||
}
|
||||
|
||||
const extractedFieldsSchema: any = {};
|
||||
const requiredFields: string[] = [];
|
||||
|
||||
fieldsArray.forEach((field) => {
|
||||
extractedFieldsSchema[field.fieldName] = {
|
||||
type: field.fieldType === 'array' ? 'array' : field.fieldType,
|
||||
description: field.fieldDescription,
|
||||
...(field.fieldType === 'array' ? { items: { type: 'string' } } : {}),
|
||||
};
|
||||
|
||||
if (field.required) {
|
||||
requiredFields.push(field.fieldName);
|
||||
}
|
||||
});
|
||||
|
||||
const jsonSchema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
extracted_data: {
|
||||
type: "object",
|
||||
properties: extractedFieldsSchema,
|
||||
required: requiredFields,
|
||||
description: "The structured data extracted from the text",
|
||||
},
|
||||
extraction_notes: {
|
||||
type: "string",
|
||||
description: "Notes about the extraction process, any ambiguities, or missing information",
|
||||
},
|
||||
...(includeConfidence ? {
|
||||
confidence_scores: {
|
||||
type: "object",
|
||||
properties: Object.fromEntries(
|
||||
fieldsArray.map(field => [
|
||||
field.fieldName,
|
||||
{
|
||||
type: "number",
|
||||
minimum: 0,
|
||||
maximum: 1,
|
||||
description: `Confidence score for ${field.fieldName} extraction (0-1)`,
|
||||
}
|
||||
])
|
||||
),
|
||||
description: "Confidence scores for each extracted field",
|
||||
}
|
||||
} : {}),
|
||||
extraction_success: {
|
||||
type: "boolean",
|
||||
description: "Whether the extraction was successful overall",
|
||||
},
|
||||
},
|
||||
required: ["extracted_data", "extraction_notes", "extraction_success"],
|
||||
additionalProperties: false,
|
||||
};
|
||||
|
||||
const fieldDescriptions = fieldsArray.map(field =>
|
||||
`- ${field.fieldName} (${field.fieldType}${field.required ? ', required' : ', optional'}): ${field.fieldDescription}`
|
||||
).join('\n');
|
||||
|
||||
const systemPrompt = `You are an expert data extraction system. Your task is to extract structured data fields from unstructured text with high accuracy.
|
||||
|
||||
${extractionPrompt}
|
||||
|
||||
Fields to Extract:
|
||||
${fieldDescriptions}
|
||||
|
||||
Extraction Rules:
|
||||
- ${strictExtraction ? 'Only extract information that is explicitly present in the text. Do not infer or guess.' : 'Extract information that is present or can be reasonably inferred from context.'}
|
||||
- Use null for fields that cannot be found or determined
|
||||
- For array fields, extract all relevant items as a list
|
||||
- For boolean fields, use true/false based on explicit or clear implicit information
|
||||
- For number fields, extract numeric values (convert text numbers if needed)
|
||||
- ${includeConfidence ? 'Provide confidence scores (0-1) for each extracted field' : ''}
|
||||
- Always provide extraction notes explaining any challenges, ambiguities, or missing information
|
||||
- Be consistent with data types and formatting
|
||||
|
||||
Data Quality Standards:
|
||||
- Ensure accuracy over completeness
|
||||
- Maintain consistency in formatting (e.g., phone numbers, dates)
|
||||
- Flag any uncertain extractions in the notes
|
||||
- Preserve original formatting where appropriate
|
||||
|
||||
Response Format: You must respond with valid JSON matching the specified schema.`;
|
||||
|
||||
const messages = [
|
||||
{
|
||||
role: 'system',
|
||||
content: systemPrompt,
|
||||
},
|
||||
{
|
||||
role: 'user',
|
||||
content: `Please extract the structured data from the following text:\n\n${text.trim()}`,
|
||||
},
|
||||
];
|
||||
|
||||
const requestBody: any = {
|
||||
model,
|
||||
messages,
|
||||
temperature: temperature || 0.1,
|
||||
max_completion_tokens: maxCompletionTokens || 1000,
|
||||
response_format: {
|
||||
type: 'json_schema',
|
||||
json_schema: {
|
||||
name: "extraction_result",
|
||||
schema: jsonSchema,
|
||||
strict: true
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (reasoningEffort && !model.includes('grok-3')) {
|
||||
requestBody.reasoning_effort = reasoningEffort;
|
||||
}
|
||||
|
||||
if (enableContextSearch) {
|
||||
requestBody.search_parameters = {
|
||||
mode: 'auto',
|
||||
max_search_results: 3,
|
||||
return_citations: true, // Auto-enable citations when using context search
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await makeXaiRequest(auth, requestBody, 120000, 'Extract Data');
|
||||
const { choice, content } = validateResponse(response, 'Extract Data');
|
||||
const extractionResult = parseJsonResponse(content, 'Extract Data');
|
||||
|
||||
const extractedData = extractionResult.extracted_data || {};
|
||||
|
||||
const result = {
|
||||
extracted_data: extractedData,
|
||||
extraction_notes: extractionResult.extraction_notes || '',
|
||||
extraction_success: extractionResult.extraction_success || false,
|
||||
fields_extracted: Object.keys(extractedData).length,
|
||||
fields_requested: fieldsArray.length,
|
||||
completion_rate: fieldsArray.length > 0 ? Object.keys(extractedData).length / fieldsArray.length : 0,
|
||||
model: response.body.model,
|
||||
finish_reason: choice.finish_reason,
|
||||
};
|
||||
|
||||
if (includeConfidence && extractionResult.confidence_scores) {
|
||||
(result as any).confidence_scores = extractionResult.confidence_scores;
|
||||
|
||||
const confidenceValues = Object.values(extractionResult.confidence_scores) as number[];
|
||||
if (confidenceValues.length > 0) {
|
||||
(result as any).avg_confidence = confidenceValues.reduce((a, b) => a + b, 0) / confidenceValues.length;
|
||||
(result as any).max_confidence = Math.max(...confidenceValues);
|
||||
(result as any).min_confidence = Math.min(...confidenceValues);
|
||||
}
|
||||
}
|
||||
|
||||
const requiredFieldsExtracted = requiredFields.filter(field =>
|
||||
extractedData[field] !== null && extractedData[field] !== undefined
|
||||
);
|
||||
(result as any).required_fields_found = requiredFieldsExtracted.length;
|
||||
(result as any).required_fields_missing = requiredFields.length - requiredFieldsExtracted.length;
|
||||
|
||||
if (response.body.usage) {
|
||||
(result as any).usage = response.body.usage;
|
||||
}
|
||||
|
||||
if (enableContextSearch && response.body.citations) {
|
||||
(result as any).citations = response.body.citations;
|
||||
}
|
||||
|
||||
if (choice.message.reasoning_content) {
|
||||
(result as any).reasoning_content = choice.message.reasoning_content;
|
||||
}
|
||||
|
||||
return result as ExtractionResult;
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 400) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Bad request';
|
||||
throw new Error(`Data extraction failed: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 422) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Validation error';
|
||||
throw new Error(`Invalid extraction parameters: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 500) {
|
||||
throw new Error('Extraction service temporarily unavailable. Please try again.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new Error('Invalid API key. Please check your xAI API key.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error('Access denied. Please check your API key permissions.');
|
||||
}
|
||||
|
||||
if (error.message?.includes('timeout')) {
|
||||
throw new Error('Data extraction timed out. Try reducing text length or simplifying field definitions.');
|
||||
}
|
||||
|
||||
throw new Error(`Data extraction failed: ${error.message || 'Unknown error occurred'}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,158 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
AuthenticationType,
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { grokAuth } from '../common/auth';
|
||||
import { XAI_BASE_URL } from '../common/constants';
|
||||
import {
|
||||
createModelProperty
|
||||
} from '../common/utils';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const generateImage = createAction({
|
||||
auth: grokAuth,
|
||||
name: 'generate_image',
|
||||
displayName: 'Generate Image',
|
||||
description: 'Create images from text prompts using Grok\'s image generation.',
|
||||
props: {
|
||||
prompt: Property.LongText({
|
||||
displayName: 'Image Prompt',
|
||||
required: true,
|
||||
description: 'Detailed description of the image you want to generate.',
|
||||
}),
|
||||
model: createModelProperty({
|
||||
displayName: 'Image Model',
|
||||
description: 'Image generation model to use.',
|
||||
defaultValue: 'grok-2-image-1212',
|
||||
filterForImages: true
|
||||
}),
|
||||
numberOfImages: Property.Number({
|
||||
displayName: 'Number of Images',
|
||||
required: false,
|
||||
defaultValue: 1,
|
||||
description: 'Number of images to generate (1-10).',
|
||||
}),
|
||||
responseFormat: Property.StaticDropdown({
|
||||
displayName: 'Response Format',
|
||||
required: false,
|
||||
defaultValue: 'url',
|
||||
description: 'Format of the generated images.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'URL', value: 'url' },
|
||||
{ label: 'Base64 JSON', value: 'b64_json' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
await propsValidation.validateZod(propsValue, {
|
||||
numberOfImages: z.number().min(1).max(10).optional(),
|
||||
prompt: z.string().min(1).max(4000),
|
||||
});
|
||||
|
||||
const {
|
||||
prompt,
|
||||
model,
|
||||
numberOfImages,
|
||||
responseFormat,
|
||||
} = propsValue;
|
||||
|
||||
if (!prompt.trim()) {
|
||||
throw new Error('Prompt cannot be empty');
|
||||
}
|
||||
|
||||
const requestBody: any = {
|
||||
prompt: prompt.trim(),
|
||||
model,
|
||||
n: numberOfImages || 1,
|
||||
};
|
||||
|
||||
if (responseFormat) {
|
||||
requestBody.response_format = responseFormat;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: `${XAI_BASE_URL}/images/generations`,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.secret_text,
|
||||
},
|
||||
body: requestBody,
|
||||
timeout: 120000,
|
||||
});
|
||||
|
||||
if (!response.body.data || !Array.isArray(response.body.data)) {
|
||||
throw new Error('Invalid response format from image generation API');
|
||||
}
|
||||
|
||||
const images = response.body.data;
|
||||
|
||||
if (images.length === 0) {
|
||||
throw new Error('No images were generated');
|
||||
}
|
||||
|
||||
const result = {
|
||||
images: images.map((img: any, index: number) => {
|
||||
if (!img.url && !img.b64_json) {
|
||||
throw new Error(`Image ${index + 1} is missing both URL and base64 data`);
|
||||
}
|
||||
|
||||
return {
|
||||
index: index + 1,
|
||||
url: img.url || null,
|
||||
b64_json: img.b64_json || null,
|
||||
revised_prompt: img.revised_prompt || prompt,
|
||||
};
|
||||
}),
|
||||
prompt_used: prompt,
|
||||
model_used: model,
|
||||
total_images: images.length,
|
||||
response_format: responseFormat || 'url',
|
||||
};
|
||||
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 400) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Bad request';
|
||||
throw new Error(`Image generation failed: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 422) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Validation error';
|
||||
throw new Error(`Invalid parameters: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 500) {
|
||||
throw new Error('Image generation service temporarily unavailable. Please try again.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new Error('Invalid API key. Please check your xAI API key.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error('Access denied. Please check your API key permissions.');
|
||||
}
|
||||
|
||||
if (error.message?.includes('timeout')) {
|
||||
throw new Error('Image generation timed out. The request may have been too complex. Try simplifying your prompt.');
|
||||
}
|
||||
|
||||
throw new Error(`Image generation failed: ${error.message || 'Unknown error occurred'}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
AuthenticationType,
|
||||
HttpMethod,
|
||||
httpClient,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
|
||||
export const grokAuth = PieceAuth.SecretText({
|
||||
description: `
|
||||
**Get your xAI API Key**
|
||||
|
||||
1. Sign up at [xAI](https://x.ai)
|
||||
2. Go to your [API dashboard](https://console.x.ai)
|
||||
3. Generate a new API key
|
||||
4. Copy and paste the key here
|
||||
|
||||
Your API key should start with \`xai-\`
|
||||
`,
|
||||
displayName: 'API Key',
|
||||
required: true,
|
||||
validate: async (auth) => {
|
||||
try {
|
||||
await httpClient.sendRequest<{
|
||||
data: { id: string }[];
|
||||
}>({
|
||||
url: 'https://api.x.ai/v1/models',
|
||||
method: HttpMethod.GET,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.auth as string,
|
||||
},
|
||||
});
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch (e: any) {
|
||||
if (e.response?.status === 429) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Your xAI account has run out of credits or reached its spending limit. Please add more credits at console.x.ai or raise your spending limit.',
|
||||
};
|
||||
}
|
||||
if (e.response?.status === 401) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API key. Please check your xAI API key and try again.',
|
||||
};
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Unable to validate API key. Please check your key and account status at console.x.ai.',
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export const XAI_BASE_URL = 'https://api.x.ai/v1';
|
||||
@@ -0,0 +1,338 @@
|
||||
import { AppConnectionValueForAuthProperty, Property } from '@activepieces/pieces-framework';
|
||||
import { httpClient, HttpMethod, AuthenticationType } from '@activepieces/pieces-common';
|
||||
import { XAI_BASE_URL } from './constants';
|
||||
import { grokAuth } from './auth';
|
||||
|
||||
export interface XaiChoice {
|
||||
index: number;
|
||||
message: {
|
||||
role: string;
|
||||
content: string | null;
|
||||
reasoning_content?: string | null;
|
||||
refusal?: string | null;
|
||||
tool_calls?: any[];
|
||||
};
|
||||
finish_reason: string | null;
|
||||
logprobs?: any;
|
||||
}
|
||||
|
||||
export interface XaiUsage {
|
||||
prompt_tokens: number;
|
||||
completion_tokens: number;
|
||||
total_tokens: number;
|
||||
prompt_tokens_details?: any;
|
||||
completion_tokens_details?: any;
|
||||
num_sources_used?: number;
|
||||
}
|
||||
|
||||
export interface XaiResponse {
|
||||
body: {
|
||||
id: string;
|
||||
object: string;
|
||||
created: number;
|
||||
model: string;
|
||||
choices: XaiChoice[];
|
||||
usage?: XaiUsage;
|
||||
citations?: string[];
|
||||
debug_output?: any;
|
||||
system_fingerprint?: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AskGrokResult {
|
||||
content: string | null;
|
||||
reasoning_content?: string | null;
|
||||
refusal?: string | null;
|
||||
role: string;
|
||||
finish_reason: string | null;
|
||||
index: number;
|
||||
model: string;
|
||||
id: string;
|
||||
created: number;
|
||||
object: string;
|
||||
system_fingerprint?: string | null;
|
||||
tool_calls?: any[];
|
||||
logprobs?: any;
|
||||
all_choices?: XaiChoice[];
|
||||
usage?: XaiUsage;
|
||||
citations?: string[];
|
||||
debug_output?: any;
|
||||
}
|
||||
|
||||
export interface CategorizationResult {
|
||||
categories: any;
|
||||
reasoning: any;
|
||||
primary_category: any;
|
||||
multiple_categories?: boolean;
|
||||
total_categories_assigned: any;
|
||||
model: string;
|
||||
finish_reason: string | null;
|
||||
confidence_scores?: any;
|
||||
avg_confidence?: any;
|
||||
max_confidence?: any;
|
||||
min_confidence?: any;
|
||||
usage?: XaiUsage;
|
||||
citations?: string[];
|
||||
reasoning_content?: string | null;
|
||||
}
|
||||
|
||||
export interface ExtractionResult {
|
||||
extracted_data: any;
|
||||
extraction_notes: any;
|
||||
extraction_success: any;
|
||||
fields_extracted: number;
|
||||
fields_requested: number;
|
||||
completion_rate: number;
|
||||
model: string;
|
||||
finish_reason: string | null;
|
||||
confidence_scores?: any;
|
||||
avg_confidence?: any;
|
||||
max_confidence?: any;
|
||||
min_confidence?: any;
|
||||
required_fields_found?: any;
|
||||
required_fields_missing?: any;
|
||||
usage?: XaiUsage;
|
||||
citations?: string[];
|
||||
reasoning_content?: string | null;
|
||||
}
|
||||
|
||||
export const createModelProperty = (config?: {
|
||||
displayName?: string;
|
||||
description?: string;
|
||||
defaultValue?: string;
|
||||
filterForImages?: boolean;
|
||||
}) => {
|
||||
const {
|
||||
displayName = 'Model',
|
||||
description = 'The Grok model to use.',
|
||||
defaultValue = 'grok-3-beta',
|
||||
filterForImages = false,
|
||||
} = config || {};
|
||||
|
||||
const fallbackModels = filterForImages
|
||||
? [{ label: 'grok-2-image-1212', value: 'grok-2-image-1212' }]
|
||||
: [
|
||||
{ label: 'grok-3-beta', value: 'grok-3-beta' },
|
||||
{ label: 'grok-3-fast-beta', value: 'grok-3-fast-beta' },
|
||||
{ label: 'grok-3-mini-beta', value: 'grok-3-mini-beta' },
|
||||
];
|
||||
|
||||
return Property.Dropdown({
|
||||
displayName,
|
||||
required: true,
|
||||
description,
|
||||
refreshers: [],
|
||||
auth: grokAuth,
|
||||
defaultValue,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
placeholder: 'Enter your API key first',
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const endpoint = filterForImages
|
||||
? `${XAI_BASE_URL}/image-generation-models`
|
||||
: `${XAI_BASE_URL}/language-models`;
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
url: endpoint,
|
||||
method: HttpMethod.GET,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.secret_text,
|
||||
},
|
||||
});
|
||||
|
||||
let models = [];
|
||||
if (filterForImages) {
|
||||
models = response.body.models || [];
|
||||
} else {
|
||||
models = response.body.models || [];
|
||||
models = models.filter((model: any) =>
|
||||
model.output_modalities?.includes('text') &&
|
||||
!model.output_modalities?.includes('image')
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: models.map((model: any) => ({
|
||||
label: model.id,
|
||||
value: model.id,
|
||||
})),
|
||||
};
|
||||
} catch (error) {
|
||||
try {
|
||||
const response = await httpClient.sendRequest({
|
||||
url: `${XAI_BASE_URL}/models`,
|
||||
method: HttpMethod.GET,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.secret_text,
|
||||
},
|
||||
});
|
||||
|
||||
let models = response.body.data || [];
|
||||
|
||||
if (filterForImages) {
|
||||
models = models.filter((model: any) =>
|
||||
model.id.includes('image') || model.id.includes('vision')
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: models.map((model: any) => ({
|
||||
label: model.id,
|
||||
value: model.id,
|
||||
})),
|
||||
};
|
||||
} catch (fallbackError) {
|
||||
return {
|
||||
disabled: false,
|
||||
options: fallbackModels,
|
||||
placeholder: "Using fallback models",
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const createTemperatureProperty = (defaultValue = 0.7) =>
|
||||
Property.Number({
|
||||
displayName: 'Temperature',
|
||||
required: false,
|
||||
description: 'Controls randomness (0-2): 0 = deterministic, 1 = balanced, 2 = creative.',
|
||||
defaultValue,
|
||||
});
|
||||
|
||||
export const createTokenProperty = (defaultValue?: number) =>
|
||||
Property.Number({
|
||||
displayName: 'Max Completion Tokens',
|
||||
required: false,
|
||||
description: 'Maximum tokens for the response.',
|
||||
defaultValue,
|
||||
});
|
||||
|
||||
export const createSearchProperties = () => ({
|
||||
enableContextSearch: Property.Checkbox({
|
||||
displayName: 'Enable Context Search',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Allow the model to search for additional context.',
|
||||
}),
|
||||
includeCitations: Property.Checkbox({
|
||||
displayName: 'Include Citations',
|
||||
required: false,
|
||||
defaultValue: false,
|
||||
description: 'Include sources if context search is enabled.',
|
||||
}),
|
||||
});
|
||||
|
||||
export const createAdvancedProperties = () => ({
|
||||
reasoningEffort: Property.StaticDropdown({
|
||||
displayName: 'Reasoning Effort',
|
||||
required: false,
|
||||
description: 'How thoroughly the model should analyze.',
|
||||
options: {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Default', value: '' },
|
||||
{ label: 'Low (Quick)', value: 'low' },
|
||||
{ label: 'High (Deep)', value: 'high' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
user: Property.ShortText({
|
||||
displayName: 'User ID',
|
||||
required: false,
|
||||
description: 'Unique identifier for tracking.',
|
||||
}),
|
||||
});
|
||||
|
||||
const handleXaiError = (error: any, operation: string): never => {
|
||||
if (error.response?.status === 400) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Bad request';
|
||||
throw new Error(`${operation} failed: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 422) {
|
||||
const errorMessage = error.response?.body?.error?.message || 'Validation error';
|
||||
throw new Error(`Invalid ${operation.toLowerCase()} parameters: ${errorMessage}`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new Error('Rate limit exceeded. Please try again later.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 500) {
|
||||
throw new Error(`${operation} service temporarily unavailable. Please try again.`);
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new Error('Invalid API key. Please check your xAI API key.');
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error('Access denied. Please check your API key permissions.');
|
||||
}
|
||||
|
||||
if (error.message?.includes('timeout')) {
|
||||
throw new Error(`${operation} timed out. Try reducing complexity or text length.`);
|
||||
}
|
||||
|
||||
throw new Error(`${operation} failed: ${error.message || 'Unknown error occurred'}`);
|
||||
};
|
||||
|
||||
export const makeXaiRequest = async (
|
||||
{secret_text}: AppConnectionValueForAuthProperty<typeof grokAuth>,
|
||||
requestBody: any,
|
||||
timeout: number,
|
||||
operation: string
|
||||
): Promise<XaiResponse> => {
|
||||
try {
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: `${XAI_BASE_URL}/chat/completions`,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: secret_text,
|
||||
},
|
||||
body: requestBody,
|
||||
timeout,
|
||||
});
|
||||
|
||||
if (!response.body.choices || !Array.isArray(response.body.choices) || response.body.choices.length === 0) {
|
||||
throw new Error('Invalid response format: no choices returned');
|
||||
}
|
||||
|
||||
return response as XaiResponse;
|
||||
} catch (error: any) {
|
||||
handleXaiError(error, operation);
|
||||
throw new Error('This should never be reached');
|
||||
}
|
||||
};
|
||||
|
||||
export const validateResponse = (response: XaiResponse, operation: string) => {
|
||||
const choice = response.body.choices[0];
|
||||
const content = choice.message.content;
|
||||
|
||||
if (!content) {
|
||||
throw new Error(`No ${operation.toLowerCase()} result received`);
|
||||
}
|
||||
|
||||
return { choice, content };
|
||||
};
|
||||
|
||||
export const parseJsonResponse = (content: string, operation: string) => {
|
||||
try {
|
||||
return JSON.parse(content);
|
||||
} catch (parseError) {
|
||||
throw new Error(`Failed to parse ${operation.toLowerCase()} result: ${parseError}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user