npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@instill-ai/typescript-sdk

v0.0.12

Published

Instill AI's Typescript SDK

Downloads

32

Readme

Overview

Typescript SDK for Instill AI products

Unix Build Status NPM License NPM Version NPM Downloads

[!IMPORTANT]
This SDK tool is under heavy development!!
Currently there has yet to be a stable version release, please feel free to open any issue regarding this SDK in our community repo

Setup

Requirements

  • Node 16+
  • npm 7+ | pnpm 6+ | yarn 1+

installation

npm i @instill-ai/typescript-sdk
yarn add @instill-ai/typescript-sdk
pnpm add @instill-ai/typescript-sdk

Usage:

// node.js
const InstillClient = require("@instill-ai/typescript-sdk").default;

// next.js
import InstillClient from "@instill-ai/typescript-sdk";

config

baseUrl: string
appVersion: string
apiToken: string

Example app templetes

local

import { useEffect, useState } from "react";
import InstillClient, {
  Nullable,
  User,
} from "@instill-ai/typescript-sdk";

export default function TypescriptSdkDemo() {
  const [user, setUser] = useState<User[]>([]);

  const client = new InstillClient(
    "http://localhost:8080",
    "v1alpha",
    "<your_api_token>" // get console API token from `http://localhost:3000/settings`
  );

  useEffect(() => {
    client.Auth.getUserQuery()
      .then((data: any) => {
        console.log("data", data);
        setUser(data);
      })
      .catch((error: any) => {
        console.log("error", error);
      });
  }, []);

  return (
    <>
      <h1>User Data</h1>
      <pre style={{ backgroundColor: "white" }}>
        {JSON.stringify(user, null, 4)}
      </pre>
    </>
  );
}

With Token

import { useEffect, useState } from "react";
import InstillClient, {
  Nullable,
  Pipeline,
  User,
} from "@instill-ai/typescript-sdk";

export default function TypescriptSdkDemo() {
  const [pipelines, setPipelines] = useState<Pipeline[]>([]);
  const [user, setUser] = useState<User[]>([]);

  const client = new InstillClient(
    "https://api.instill.tech",
    "v1alpha",
    "<your_api_token>" // console API token
  );

  useEffect(() => {
    client.Auth.getUserQuery()
      .then((data: any) => {
        console.log("data", data);
        setUser(data);
      })
      .catch((error: any) => {
        console.log("error", error);
      });

    client.Pipeline.listPipelinesQuery({
      pageSize: null,
      nextPageToken: null,
    })
      .then((data: any) => {
        console.log("data", data);
        setPipelines(data);
      })
      .catch((error: any) => {
        console.log("error", error);
      });
  }, []);

  return (
    <>
      <h1>User Data</h1>
      <pre style={{ backgroundColor: "white" }}>
        {JSON.stringify(user, null, 4)}
      </pre>

      <h1>Pipelines List</h1>
      <pre style={{ backgroundColor: "white" }}>
        {JSON.stringify(pipelines, null, 4)}
      </pre>
    </>
  );
}

Next APP

Node APP

API Reference

Pipelines

create Pipeline


userName : check your userName: https://console.instill.tech/settings

client.PipelineClient.createUserPipelineMutation("<userName>",
  {
    "id": "overseas-blue-lobster",
    "recipe": {
      "version": "v1alpha",
      "components": [
        {
          "id": "start",
          "resource_name": "",
          "configuration": {
            "metadata": {
              "text": {
                "instillFormat": "string",
                "type": "string",
                "title": "text"
              }
            }
          },
          "definition_name": "operator-definitions/op-start"
        },
        {
          "id": "end",
          "resource_name": "",
          "configuration": {
            "metadata": {
              "output": {
                "title": "output"
              }
            },
            "input": {
              "output": "{ai_1.output.texts}"
            }
          },
          "definition_name": "operator-definitions/op-end"
        },
        {
          "id": "ai_1",
          "resource_name": "users/namananand-instill-ai/connector-resources/ai2",
          "configuration": {
            "task": "TASK_TEXT_GENERATION",
            "input": {
              "prompt": "{start.text}",
              "model": "gpt-3.5-turbo"
            }
          },
          "definition_name": "connector-definitions/ai-openai"
        }
      ]
    }
  }
).then((response) => {
  console.log(response.data)
})
.catch(error => {
  console.log(error)
})

| function | params | | :------------------------------------ | :---------------------------------------------: | | listPipelinesQuery | pageSize, nextPageToken | | listUserPipelinesQuery | pageSize, nextPageToken, userName | | getUserPipelineQuery | pipelineName | | ListUserPipelineReleasesQuery | userName, pipelineName, pageSize, nextPageToken | | getUserPipelineReleaseQuery | pipelineReleaseName | | watchUserPipelineReleaseQuery | pipelineReleaseName | | createUserPipelineMutation | userName, payload | | updateUserPipelineMutation | payload | | deleteUserPipelineMutation | pipelineName | | renameUserPipelineMutation | payload | | createUserPipelineReleaseMutation | pipelineName, payload | | updateUserPipelineReleaseMutation | pipelineReleaseName, payload | | deleteUserPipelineReleaseMutation | pipelineReleaseName | | triggerUserPipelineAction | pipelineName, payload, returnTraces | | triggerAsyncUserPipelineAction | pipelineName, payload, returnTraces | | setDefaultUserPipelineReleaseMutation | pipelineReleaseName | | restoreUserPipelineReleaseMutation | pipelineReleaseName | | triggerUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces | | triggerAsyncUserPipelineReleaseAction | pipelineReleaseName, payload, returnTraces |

Connector

Create new connector

userName : check your userName: https://console.instill.tech/settings

query.ConnectorClient.createUserConnectorResourceMutation("<userName>",
  {
    "id": "open-ai-model-1",
    "connector_definition_name": "connector-definitions/ai-openai",
    "configuration": {
      "organization": "my-org",
      "api_key": "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"
    }
  }
).then((response) => {
  console.log(response.data)
})
.catch(error => {
  console.log(error)
})

| function | params | | :---------------------------------------- | :---------------------------------------: | | listConnectorResourcesQuery | userName, pageSize, nextPageToken, filter | | listUserConnectorResourcesQuery | pageSize, nextPageToken, filter | | listConnectorDefinitionsQuery | connectorDefinitionName | | getConnectorDefinitionQuery | connectorDefinitionName | | getUserConnectorResourceQuery | connectorDefinitionName | | watchUserConnectorResource | connectorResourceName | | createUserConnectorResourceMutation | userName, payload | | deleteUserConnectorResourceMutation | payload | | updateUserConnectorResourceMutation | payload | | renameUserConnectorResource | payload | | testUserConnectorResourceConnectionAction | connectorDefinitionName | | connectUserConnectorResourceAction | connectorDefinitionName | | disconnectUserConnectorResourceAction | connectorDefinitionName |

Metric

| function | params | | :------------------------------ | :-----------------------------: | | listPipelineTriggerRecordsQuery | pageSize, nextPageToken, filter | | listTriggeredPipelineQuery | pageSize, nextPageToken, filter | | listTriggeredPipelineChartQuery | pageSize, nextPageToken, filter |

Model

| function | params | | :------------------------ | :-------------------------------: | | getModelDefinitionQuery | modelDefinitionName | | listModelDefinitionsQuery | pageSize, nextPageToken | | getUserModelQuery | modelName | | listModelsQuery | pageSize, nextPageToken | | listUserModelsQuery | userName, pageSize, nextPageToken | | getUserModelReadmeQuery | modelName | | watchUserModel | modelName | | createUserModelMutation | userName, payload | | updateModelMutation | payload | | deleteUserModelMutation | modelName | | deployUserModelAction | modelName | | undeployUserModeleAction | modelName |

Operation

| function | params | | :------------------------ | :-----------: | | getOperationQuery | operationName | | checkUntilOperationIsDoen | operationName |

Mgmt

create API token


client.AuthClient.createApiTokenMutation({
  "id": "aa",
  "ttl": -1
}).then((response) => {
  console.log(response.data)
})
.catch(error => {
  console.log(error)
})

| function | params | | :--------------------- | :---------------------: | | getUserQuery | | | checkUserIdExist | id | | getApiTokenQuery | tokenName | | listApiTokensQuery | pageSize, nextPageToken | | updateUserMutation | payload | | createApiTokenMutation | payload | | deleteApiTokenMutation | tokenName |

Contribution Guidelines:

Please refer to the Contributing Guidelines for more details.

Release Notes:

Release

Genrate proto-ts

  • run ./generate_proto.sh
  • it will genrate protobuf into dist/protogen-ts

Support:

Contact details for help and support resources. This list isn't exhaustive but covers major aspects usually included in most SDK design documents.