Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Typescript Migration #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tabWidth": 4
}
27 changes: 0 additions & 27 deletions config/qa.js

This file was deleted.

17 changes: 0 additions & 17 deletions config/summarization.js

This file was deleted.

6 changes: 3 additions & 3 deletions examples/binaryClassificationExample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { binaryClassification } from "../config/binaryClassification.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { binaryClassification } from "../dist/config/binaryClassification.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";
import { binaryData } from "../examples/data/binary.js";

const model = OpenAI("api-key");
Expand Down
6 changes: 3 additions & 3 deletions examples/nerExample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ner } from "../config/ner.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { ner } from "../dist/config/ner.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";
import { nerData } from "../examples/data/optimized_ner.js";

const model = OpenAI("api-key");
Expand Down
13 changes: 7 additions & 6 deletions examples/qaExample.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { qa } from "../config/qa.js";
import { qa } from "../dist/config/qa.js";
import { qaData } from "../examples/data/qa.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";

const model = OpenAI("api-key");
const firstExample = qaData.slice(0, 3);

console.log(firstExample)
console.log(firstExample);

const prompt = qa({
domain: "nlp",
examples: firstExample,
context: 'Prompt engineering is a concept in artificial intelligence, particularly natural language processing (NLP). In prompt engineering, the description of the task is embedded in the input, e.g., as a question instead of it being implicitly given. Prompt engineering typically works by converting one or more tasks to a prompt-based dataset and training a language model with what has been called "prompt-based learning" or just "prompt learning".',
question: "What is prompt engineering?"
context:
'Prompt engineering is a concept in artificial intelligence, particularly natural language processing (NLP). In prompt engineering, the description of the task is embedded in the input, e.g., as a question instead of it being implicitly given. Prompt engineering typically works by converting one or more tasks to a prompt-based dataset and training a language model with what has been called "prompt-based learning" or just "prompt learning".',
question: "What is prompt engineering?",
});

const result = await Prompter(model, prompt, "text-davinci-003");
Expand Down
13 changes: 7 additions & 6 deletions examples/relationExtractionExample.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { relationExtraction } from "../config/relationExtraction.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { relationExtraction } from "../dist/config/relationExtraction.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";
import { relationExtractionData } from "../examples/data/relation_extraction.js";

const model = OpenAI("api-key");
const model = OpenAI("api key");
const examples = relationExtractionData;

const prompt = relationExtraction({
text_input: "Eren is a Person. Working for XYZ company, his job title is Software Engineer. He lives in Bielefeld, Germany",
text_input:
"Eren is a Person. Working for XYZ company, his job title is Software Engineer. He lives in Bielefeld, Germany",
description: "Relation Extraction",
domain: "Personal Information",
examples: examples,
});

const result = await Prompter(model, prompt, "text-davinci-003");

console.log(result);
console.log(result);
6 changes: 3 additions & 3 deletions examples/sqlExample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql } from "../config/sql.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { sql } from "../dist/config/sql.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";
import { sqlData } from "../examples/data/sql.js";

const model = OpenAI("");
Expand Down
16 changes: 8 additions & 8 deletions examples/summaryExample.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { summarization } from '../config/summarization.js';
import { summaryData } from '../examples/data/summary.js';
import { OpenAI } from '../models/openai.js';
import { Prompter } from '../promptify/index.js';
import { summarization } from "../dist/config/summarization.js";
import { summaryData } from "../examples/data/summary.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";

const model = OpenAI('api-key');
const model = OpenAI("api-key");

const prompt = summarization({
examples: summaryData,
context: `Google Chrome is a cross-platform web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, and also for Android, where it is the default browser. The browser is also the main component of ChromeOS, where it serves as the platform for web applications. Most of Chrome's source code comes from Google's free and open-source software project Chromium, but Chrome is licensed as proprietary freeware. WebKit was the original rendering engine, but Google eventually forked it to create the Blink engine; all Chrome variants except iOS now use Blink. As of October 2022, StatCounter estimates that Chrome has a 67% worldwide browser market share (after peaking at 72.38% in November 2018) on personal computers (PC), is most used on tablets (having surpassed Safari), and is also dominant on smartphones and at 65% across all platforms combined. Because of this success, Google has expanded the "Chrome" brand name to other products: ChromeOS, Chromecast, Chromebook, Chromebit, Chromebox, and Chromebase.`,
examples: summaryData,
context: `Google Chrome is a cross-platform web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, and also for Android, where it is the default browser. The browser is also the main component of ChromeOS, where it serves as the platform for web applications. Most of Chrome's source code comes from Google's free and open-source software project Chromium, but Chrome is licensed as proprietary freeware. WebKit was the original rendering engine, but Google eventually forked it to create the Blink engine; all Chrome variants except iOS now use Blink. As of October 2022, StatCounter estimates that Chrome has a 67% worldwide browser market share (after peaking at 72.38% in November 2018) on personal computers (PC), is most used on tablets (having surpassed Safari), and is also dominant on smartphones and at 65% across all platforms combined. Because of this success, Google has expanded the "Chrome" brand name to other products: ChromeOS, Chromecast, Chromebook, Chromebit, Chromebox, and Chromebase.`,
});

const result = await Prompter(model, prompt, 'text-davinci-003');
const result = await Prompter(model, prompt, "text-davinci-003");

console.log(result);
6 changes: 3 additions & 3 deletions examples/tabularExample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tabular } from "../config/tabular.js";
import { OpenAI } from "../models/openai.js";
import { Prompter } from "../promptify/index.js";
import { tabular } from "../dist/config/tabular.js";
import { OpenAI } from "../dist/models/openai.js";
import { Prompter } from "../dist/promptify/index.js";
import { tabularData } from "../examples/data/tabular.js";

const model = OpenAI("api-key");
Expand Down
2 changes: 1 addition & 1 deletion examples/turboExample.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Prompter } from "../promptify/index.js";
import { Prompter } from "../dist/promptify/index.js";

const prompt = [
{ role: "system", content: "you are an helpful assistat" },
Expand Down
Loading