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

@dandori/core

v0.0.25

Published

This repository is responsible for generating the task dependency from texts by using AI.

Downloads

4

Readme

dandori/core

This repository is responsible for generating the task dependency from texts by using AI.

Installation

npm install @dandori/core
yarn add @dandori/core
pnpm add @dandori/core

Usage

import generateDandoriTasks from '@dandori/core';

const source = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(source);

Requirements

  • @dandori/core depends on OpenAI API. You need to set OPENAI_API_KEY environment variable.
  • @dandori/core supports to load .env file. Please create .env file and set OPENAI_API_KEY environment variable.

API

generateDandoriTasks

 async function generateDandoriTasks(
  source: string,
  options?: GenerateDandoriTasksOptions,
): Promise<DandoriTask[]> {}

generateDandoriTasks generates the tasks from text with the dependencies by using Open AI GPT.

Parameters

source

The source text to generate the tasks like belows.

const source = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;
options
type GenerateDandoriTasksOptions = {
  chatGPTModel?: ChatGPTFunctionCallModel;
  envFilePath?: string;
  optionalTaskProps?: OptionalTaskPropsOption;
};
  • chatGPTModel

default is gpt-3.5-turbo-0613

The model of OpenAI GPT to generate the tasks which supports function calling.

You can choose gpt-3.5-turbo-0613 or gpt-4-0613 .

  • envFilePath

default is .env

The path of .env file to load environment variables.

  • optionalTaskProps

default is []

The optional task properties to add to the generated tasks.

You can add the optional task properties like belows.

const optionalTaskProps = ["description", "deadline", "assignee", "status"];
// or
// const optionalTaskProps = ["all"];

const tasks = await generateDandoriTasks(source, {
  optionalTaskProps,
});

If you want to know more details, please see Return Value.

Return Value

type DandoriTask = {
  id: string;
  name: string;
  description?: string;
  deadline?: string;
  assignee?: {
    id: string;
    name: string;
  };
  status?: DandoriTaskStatus;
  fromTaskIdList: string[];
}[];

NOTE

You must use optionalTaskProps parameter like description to add the optional task properties to the generated tasks.

  • id

The id of the task. The id is generated automatically.

  • name

The name of the task. The name is generated by AI.

  • description

The description of the task. The description is generated by AI.

  • deadline

The deadline of the task. The deadline is generated by AI.

  • assignee

The assignee of the task. The assignee is generated by AI.

assignee.id is generated automatically.

  • status

The status of the task. The status is todo , doing or done.

  • fromTaskIdList

The list of the task ids which are dependencies of the task.

Please see the example belows.

import generateDandoriTasks from '@dandori/core';

const source = `
Today's My Tasks
* Send Email to John
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(source);
console.log(tasks)

// [
//   {
//     "id": "1",
//     "name": "Send Email to John",
//     "fromTaskIdList": [] 
//   },
//   {
//     "id": "2",
//     "name": "Report to Boss after sending emails",
//     "fromTaskIdList": [
//       "1"
//     ]
//   }
// ]

Q&A

How to get OpenAI API Key?

Please visit https://platform.openai.com/api-keys and sign up.