Skip to content

Commit

Permalink
docs: update intro
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniAkash committed Apr 1, 2024
1 parent 4511094 commit 0b9c763
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 128 deletions.
25 changes: 8 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ Clarifai Node.js SDK</a>
[![Build](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml/badge.svg)](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml)
[![Discord](https://img.shields.io/discord/1145701543228735582)](https://discord.com/invite/26upV8Y4Nd)

> This library is currently in Developer preview, any improvements & feedback welcome!
> This library is currently in developer preview, any improvements & feedback welcome!
# Clarifai Node.js SDK

This is the official Clarifai Node.js SDK for interacting with our [API](https://docs.clarifai.com).
Clarifai provides a platform for data scientists, developers, researchers and enterprises to master the entire artificial intelligence lifecycle. Gather valuable business insights from images, video and text using computer vision and natural language processing.
This is the official Node.js client for interacting with our powerful [API](https://docs.clarifai.com). The Clarifai Node.js SDK offers a comprehensive set of tools to integrate Clarifai's AI platform to leverage computer vision capabilities like classification, detection, segmentation and natural language capabilities like classification, summarisation, generation, Q&A, etc into your applications. With just a few lines of code, you can leverage cutting-edge artificial intelligence to unlock valuable insights from visual and textual content.

- Try the Clarifai demo at: https://clarifai.com/demo
- Sign up for a free account at: https://portal.clarifai.com/signup
- Read the documentation at: https://docs.clarifai.com/
[Website](https://www.clarifai.com/) | [Schedule Demo](https://www.clarifai.com/company/schedule-demo) | [Signup for a Free Account](https://clarifai.com/signup) | [API Docs](https://docs.clarifai.com/) | [Clarifai Community](https://clarifai.com/explore) | [Node.js SDK Docs](https://docs.clarifai.com/nodejs-sdk/api-reference) | [Examples](https://github.com/Clarifai/clarifai-nodejs/tree/main/examples) | [Discord](https://discord.gg/XAPE3Vtg)

Give the repo a star ⭐

## Installation

Expand All @@ -46,7 +45,7 @@ module.exports = nextConfig

### Using Models

Using the celebrity face recognition model to predict the celebrity in a given picture. For list of all available models visit [our models page](https://clarifai.com/explore/models).
Using the celebrity face recognition model to predict the celebrity in a given picture. For list of all available models visit [clarifai models page](https://clarifai.com/explore/models).

```ts
import { Input, Model } from "clarifai-nodejs";
Expand Down Expand Up @@ -79,7 +78,7 @@ model

### Using Workflows

Using a custom workflow built on [clarifai.com](https://docs.clarifai.com/portal-guide/workflows/) to analyze sentiment of a given image. For list of all available workflows visit [our workflows page](https://clarifai.com/explore/workflows)
Using a custom workflow built on [clarifai.com](https://docs.clarifai.com/portal-guide/workflows/) to analyze sentiment of a given image. For list of all available workflows visit [clarifai workflows page](https://clarifai.com/explore/workflows)

```ts
import { Input, Workflow } from "clarifai-nodejs";
Expand Down Expand Up @@ -114,7 +113,7 @@ workflow

### Listing available apps in an user account

On Clarifai, apps act as a central repository for models, datasets, inputs and other resources and information. Checkout how to create apps on [our portal](https://docs.clarifai.com/clarifai-basics/applications/create-an-application/).
On Clarifai, apps act as a central repository for models, datasets, inputs and other resources and information. Checkout how to create apps on [clarifai portal](https://docs.clarifai.com/clarifai-basics/applications/create-an-application/).

```ts
import { User } from "clarifai-nodejs";
Expand All @@ -140,11 +139,3 @@ console.log(apps);
```

For full usage details, checkout our [API Reference docs](https://docs.clarifai.com/nodejs-sdk/api-reference)

## Versioning

This library doesn't use semantic versioning. The first two version numbers (`X.Y` out of `X.Y.Z`) follow the API (backend) versioning, and whenever the API gets updated, this library follows it.

The third version number (`Z` out of `X.Y.Z`) is used by this library for any independent releases of library-specific improvements and bug fixes.

The developer preview versions of the SDK will follow `0.0.V` format where `V` simply a bump from previous developer preview version update
99 changes: 85 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
clarifai-nodejs / [Exports](modules.md)

![Clarifai logo](https://www.clarifai.com/hubfs/Clarifai-logo-dark.svg)
<h1 align="center">
<a href="https://www.clarifai.com/"><img alt="Clarifai" title="Clarifai" src="https://upload.wikimedia.org/wikipedia/commons/b/bc/Clarifai_Logo_FC_Web.png"></a>
</h1>

<h2 align="center">
Clarifai Node.js SDK</a>
</h2>

[![npm](https://img.shields.io/npm/v/clarifai-nodejs)](https://www.npmjs.com/package/clarifai-nodejs)
[![Build](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml/badge.svg)](https://github.com/Clarifai/clarifai-nodejs/actions/workflows/build.yml)
[![Discord](https://img.shields.io/discord/1145701543228735582)](https://discord.com/invite/26upV8Y4Nd)

> This library is currently in beta, any improvements & feedback welcome!
> This library is currently in developer preview, any improvements & feedback welcome!
# Clarifai Node.js SDK

This is the official Clarifai Node.js SDK for interacting with our [API](https://docs.clarifai.com).
Clarifai provides a platform for data scientists, developers, researchers and enterprises to master the entire artificial intelligence lifecycle. Gather valuable business insights from images, video and text using computer vision and natural language processing.
This is the official Node.js client for interacting with our powerful [API](https://docs.clarifai.com). The Clarifai Node.js SDK offers a comprehensive set of tools to integrate Clarifai's AI platform to leverage computer vision capabilities like classification, detection, segmentation and natural language capabilities like classification, summarisation, generation, Q&A, etc into your applications. With just a few lines of code, you can leverage cutting-edge artificial intelligence to unlock valuable insights from visual and textual content.

[Website](https://www.clarifai.com/) | [Schedule Demo](https://www.clarifai.com/company/schedule-demo) | [Signup for a Free Account](https://clarifai.com/signup) | [API Docs](https://docs.clarifai.com/) | [Clarifai Community](https://clarifai.com/explore) | [Node.js SDK Docs](https://docs.clarifai.com/nodejs-sdk/api-reference) | [Examples](https://github.com/Clarifai/clarifai-nodejs/tree/main/examples) | [Discord](https://discord.gg/XAPE3Vtg)

- Try the Clarifai demo at: https://clarifai.com/demo
- Sign up for a free account at: https://portal.clarifai.com/signup
- Read the documentation at: https://docs.clarifai.com/
Give the repo a star ⭐

## Installation

Expand All @@ -31,7 +36,7 @@ To use Clarifai Node.js in Next.js App Directory with server components, you wil
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ['@acme/ui'],
serverComponentsExternalPackages: ['clarifai-nodejs-grpc'],
},
}

Expand All @@ -40,6 +45,78 @@ module.exports = nextConfig

## Usage

### Using Models

Using the celebrity face recognition model to predict the celebrity in a given picture. For list of all available models visit [clarifai models page](https://clarifai.com/explore/models).

```ts
import { Input, Model } from "clarifai-nodejs";

const input = Input.getInputFromUrl({
inputId: "test-image",
imageUrl:
"https://samples.clarifai.com/celebrity.jpeg",
});

const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!
},
modelId: "celebrity-face-recognition",
});

model
.predict({
inputs: [input],
})
.then((response) => {
const result = response?.[0].data?.conceptsList[0].name ?? "unrecognized";
console.log(result);
})
.catch(console.error);
```

### Using Workflows

Using a custom workflow built on [clarifai.com](https://docs.clarifai.com/portal-guide/workflows/) to analyze sentiment of a given image. For list of all available workflows visit [clarifai workflows page](https://clarifai.com/explore/workflows)

```ts
import { Input, Workflow } from "clarifai-nodejs";

const input = Input.getInputFromUrl({
inputId: "test-image",
imageUrl:
"https://samples.clarifai.com/celebrity.jpeg",
});

const workflow = new Workflow({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!
},
workflowId: "workflow-238a93",
});

workflow
.predict({
inputs: [input],
})
.then((response) => {
const result =
response.resultsList[0].outputsList[0].data?.regionsList[0].data
?.conceptsList[0].name ?? "unrecognized";
console.log(result);
})
.catch(console.error);
```

### Listing available apps in an user account

On Clarifai, apps act as a central repository for models, datasets, inputs and other resources and information. Checkout how to create apps on [clarifai portal](https://docs.clarifai.com/clarifai-basics/applications/create-an-application/).

```ts
import { User } from "clarifai-nodejs";

Expand All @@ -64,9 +141,3 @@ console.log(apps);
```

For full usage details, checkout our [API Reference docs](https://docs.clarifai.com/nodejs-sdk/api-reference)

## Versioning

This library doesn't use semantic versioning. The first two version numbers (`X.Y` out of `X.Y.Z`) follow the API (backend) versioning, and whenever the API gets updated, this library follows it.

The third version number (`Z` out of `X.Y.Z`) is used by this library for any independent releases of library-specific improvements and bug fixes.
40 changes: 20 additions & 20 deletions docs/classes/App.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Lister.constructor

#### Defined in

[client/app.ts:98](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L98)
[client/app.ts:98](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L98)

## Properties

Expand All @@ -88,7 +88,7 @@ Lister.constructor

#### Defined in

[client/app.ts:83](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L83)
[client/app.ts:83](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L83)

## Methods

Expand Down Expand Up @@ -160,7 +160,7 @@ A Dataset object for the specified dataset ID.

#### Defined in

[client/app.ts:420](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L420)
[client/app.ts:420](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L420)

___

Expand Down Expand Up @@ -237,7 +237,7 @@ A Model object for the specified model ID.

#### Defined in

[client/app.ts:462](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L462)
[client/app.ts:462](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L462)

___

Expand Down Expand Up @@ -283,7 +283,7 @@ A Module object for the specified module ID.

#### Defined in

[client/app.ts:501](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L501)
[client/app.ts:501](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L501)

___

Expand Down Expand Up @@ -356,7 +356,7 @@ A Workflow object for the specified workflow config.

#### Defined in

[client/app.ts:537](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L537)
[client/app.ts:537](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L537)

___

Expand Down Expand Up @@ -398,7 +398,7 @@ A Dataset object for the existing dataset ID.

#### Defined in

[client/app.ts:727](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L727)
[client/app.ts:727](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L727)

___

Expand Down Expand Up @@ -436,7 +436,7 @@ await app.deleteDataset({ datasetId: "dataset-id" });

#### Defined in

[client/app.ts:754](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L754)
[client/app.ts:754](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L754)

___

Expand Down Expand Up @@ -474,7 +474,7 @@ await app.deleteModel({ modelId: "modelId" });

#### Defined in

[client/app.ts:777](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L777)
[client/app.ts:777](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L777)

___

Expand Down Expand Up @@ -512,7 +512,7 @@ await app.deleteModule({ moduleId: "moduleId" });

#### Defined in

[client/app.ts:823](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L823)
[client/app.ts:823](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L823)

___

Expand Down Expand Up @@ -550,7 +550,7 @@ await app.deleteWorkflow({ workflowId: "workflowId" });

#### Defined in

[client/app.ts:800](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L800)
[client/app.ts:800](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L800)

___

Expand Down Expand Up @@ -594,7 +594,7 @@ Concepts in the app.

#### Defined in

[client/app.ts:382](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L382)
[client/app.ts:382](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L382)

___

Expand Down Expand Up @@ -643,7 +643,7 @@ Defaults to 16 per page

#### Defined in

[client/app.ts:131](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L131)
[client/app.ts:131](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L131)

___

Expand Down Expand Up @@ -692,7 +692,7 @@ Defaults to 16 per page

#### Defined in

[client/app.ts:337](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L337)
[client/app.ts:337](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L337)

___

Expand Down Expand Up @@ -738,7 +738,7 @@ Defaults to 16 per page

#### Defined in

[client/app.ts:175](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L175)
[client/app.ts:175](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L175)

___

Expand Down Expand Up @@ -788,7 +788,7 @@ Defaults to 16 per page

#### Defined in

[client/app.ts:286](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L286)
[client/app.ts:286](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L286)

___

Expand All @@ -802,7 +802,7 @@ ___

#### Defined in

[client/app.ts:406](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L406)
[client/app.ts:406](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L406)

___

Expand Down Expand Up @@ -852,7 +852,7 @@ Defaults to 16 per page

#### Defined in

[client/app.ts:233](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L233)
[client/app.ts:233](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L233)

___

Expand Down Expand Up @@ -896,7 +896,7 @@ A model object for the specified model ID.

#### Defined in

[client/app.ts:666](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L666)
[client/app.ts:666](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L666)

___

Expand Down Expand Up @@ -937,4 +937,4 @@ A workflow object for the specified workflow ID.

#### Defined in

[client/app.ts:699](https://github.com/Clarifai/clarifai-nodejs/blob/a140e93/src/client/app.ts#L699)
[client/app.ts:699](https://github.com/Clarifai/clarifai-nodejs/blob/4511094/src/client/app.ts#L699)
Loading

0 comments on commit 0b9c763

Please sign in to comment.