Installation
Install the MeshAI JavaScript SDK using npm or yarn:Quick Start
Client Configuration
Basic Configuration
Core Methods
executeTask()
Execute a single AI task with automatic agent selection.| Parameter | Type | Description | Default |
|---|---|---|---|
taskType | string | Type of AI task to execute | Required |
input | any | Input data for the task | Required |
qualityLevel | string | Quality level: “basic”, “standard”, “high”, “premium" | "standard” |
maxCost | number | Maximum cost in SOL | null |
timeout | number | Timeout in milliseconds | 30000 |
agentRequirements | object | Specific agent requirements | null |
- Basic Usage
- With Options
- Error Handling
createWorkflow()
Create multi-step workflows with task dependencies.Workflow Management
Workflow Class
Task Dependencies
- Sequential Tasks
- Parallel Tasks
- Complex Dependencies
Task Types
Available Task Types
| Task Type | Description | Input Format | Output Format |
|---|---|---|---|
text_generation | Generate text content | string or object | string |
text_analysis | Analyze text sentiment, entities | string | object |
text_summarization | Summarize long text | string | string |
document_ocr | Extract text from documents | object with URL/base64 | string |
image_analysis | Analyze and caption images | object with URL/base64 | object |
image_generation | Generate images from text | string | object with URL |
code_generation | Generate code | string or object | string |
translation | Translate text | object with text and languages | string |
audio_transcription | Convert speech to text | object with audio URL | string |
Task-Specific Examples
- Text Generation
- Image Analysis
- Translation