0.1.2 • Published 8 months ago

argil v0.1.2

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
8 months ago

Argil JavaScript SDK

Welcome to the Argil JavaScript SDK. This library provides a simple and intuitive interface to interact with Argil's API, allowing you to leverage the power of AI-driven workflows and automations in your JavaScript applications.

For the full Argil documentation, please visit https://docs.argil.ai.

Table of Contents

Installation

This library is distributed on npm. In order to add it as a dependency, run the following command:

npm install argil --save

or if you prefer using yarn:

yarn add argil

Usage

Here is a quick example of how to use the Argil JavaScript SDK:

  1. Import from argil and SDK instanciation

You can either provide the ARGIL_API_KEY environment variable and instantiate the SDK without passing any parameters:

import { ArgilSdk } from 'argil';

const sdk = new ArgilSdk();

Or pass the configuration parameters to the constructor:

import { ArgilSdk, ArgilSdkGlobalConfigParams } from 'argil';

const config: ArgilSdkGlobalConfigParams = {
  apiKey: 'your-api-key', // optional, can be provided with an environment variable named ARGIL_API_KEY
  apiUrl: 'https://api.argil.ai', // optional, default is 'https://api.argil.ai'
  synchronous: false, // optional, default is false. Defines if the workflows should run synchronously or not.
  defaultSyncTimeout: 60000, // optional, default is 60000 milliseconds for synchronous requests
  defaultAsyncTimeout: 2000, // optional, default is 2000 milliseconds for asynchronous requests
};

const sdk = new ArgilSdk(config);
  1. Use the SDK client to call Argil's API routes
// Run a workflow
const run = await sdk.workflows.run(
  'workflow-id',
  {
    "input_field_name1": $input_value1,
    "input_field_name2": $input_value2
    // Input fields depends on the workflow you run, please look at our full documentation.
  },
  { // An optional runtime config object to set options for this specific run.
    timeout: 5000, // optional, can override the default timeout for this specific request
    synchronous: true // optional, can override the default synchronous flag for this specific request
  }
);

// Get a workflow run
const workflowRun = await sdk.workflowRuns.get(run.id);

// Get all workflow runs
const workflowRuns = await sdk.workflowRuns.list();

API Reference

The Argil JavaScript SDK provides the following classes:

  • ArgilSdk: The main class that provides access to the different services.
  • Workflows: A class for interacting with the Workflows service of the Argil API.
  • WorkflowRuns: A class for interacting with the WorkflowRuns service of the Argil API.
  • ArgilSdkGlobalConfig: A class for managing the global configuration for the SDK.
  • ArgilSdkRuntimeConfig: A class for managing the runtime configuration for the SDK.
  • ArgilError: A custom error class for providing more detailed and specific error messages.

For more detailed information, please refer to the source code and inline comments.

Contributing

We welcome contributions from the community.

License

This project is licensed under the GPL-3.0-or-later license. For more information, see the LICENSE.md file.

Support

If you encounter any problems or have any questions, please open an issue on our GitHub repository.

Acknowledgements

This project uses the following open-source packages:

  • axios: Promise based HTTP client for the browser and node.js

Contact

For any inquiries, please contact us at briva@argil.ai.

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

9 months ago

0.0.13

9 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago